Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Will this work? or give me call to function null errors?

Comments in 'Plugin Development' started by CoolGuyPL, Oct 1, 2014.

  1. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    The code is there below
    PHP:
    <?php

    namespace coolguy\lastplayed;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\IPlayer;

    class 
    lastplayed extends PluginBase implements pocketmine\IPlayer {
       
        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
           if(
    strtolower($command->getName("lastplayed"))) {
                switch(
    $command->getName()):
                    case 
    "lastplayed":  //This is to find out when the player last played//
                              
    $sender->sendMessage($player->getName()."has last played".$player->getLastPlayed());
                              endswitch;
        }
       
    }
  2. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    sorry if there is some useless code....
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I already told you, $command->getName() accepts no parameters. Learn PHP and look at the source code oe the docs.
    LDX likes this.

Share This Page

Advertisement