1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Why wont a simple command work I double checked everything and it says that the command doesnt exist

Discussion in 'Development' started by Remarkabless, Nov 10, 2017.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    PHP:

    use pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat as ChatColor;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginBase;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable() {
            
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
        }
       
        public function 
    onCommand(CommandSender $senderCommand $cmdstring $label, array $args): bool{
            if(
    $cmd->getName() == "info"){
                
    $sender->sendMessage(ChatColor::GOLD"Sample");
            }
            return 
    true;
        }
    }
    Code:
    name: ServerInfo
    description: FruityIsGay
    author: Remarks
    main: ServerInfo\Main
    version: 1.0.0
    api:
      - 3.0.0
      - 3.0.0-ALPHA5
      - 3.0.0-ALPHA6
      - 3.0.0-ALPHA7
      - 3.0.0-ALPHA8
      - 3.0.0-ALPHA9
    commands:
       /info:
        description: Shows info about server
        usage: "/info"
    
    Please help this makes no sense!
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Don't put the forward slash before the command name while declaring the command in plugin.yml
    Code:
    commands:
      info:
        description: Shows info about server
        usage: "/info"
    
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.