TypeError: "Return value of MarcosDEV\TopWins\Main::onCommand() must be of the type boolean, none re

Discussion in 'Plugin Help' started by Mochi, Jun 14, 2019 at 8:20 AM.

  1. Mochi

    Mochi Spider Jockey

    Messages:
    36
    Error line 82
    Code :
    PHP:
        public function onCommand(CommandSender $senderCommand $cmd$lbl, array $args):bool{
            if(
    $cmd->getName() == "topfarm"){
                
    $item Item::get(Item::STICK01);
                
    $item->setCustomName("§r§7TopFarm MAGIC");
                
    $sender->getInventory()->addItem($item);
                
    $sender->sendMessage("§9[ §6MARCOS §9]§7 Varinha adiciona ao seu inventário");
            }
        }
    public function onCommand(CommandSender $sender, Command $cmd, $lbl, array $args):bool{
    if($cmd->getName() == "topfarm"){
    $item = Item::get(Item::STICK, 0, 1);
    $item->setCustomName("§r§7TopFarm MAGIC");
    $sender->getInventory()->addItem($item);
    $sender->sendMessage("§9[ §6MARCOS §9]§7 Varinha adiciona ao seu inventário");
    }
    }
     
  2. wolfdale

    wolfdale Zombie

    Messages:
    300
    Add a return true at the last line of the function
     

Share This Page

  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.