Error in the command

Discussion in 'Plugin Help' started by cccdom21, Feb 10, 2019.

  1. cccdom21

    cccdom21 Creeper

    Messages:
    1
    Hello, I have a problem.

    While doing the commands I came across an unwanted error.

    Below:

    [19:17:52] [Server thread/CRITICAL]: TypeError: "Return value of epCore\epCore::eek:nCommand() must be of the type boolean, none returned" (EXCEPTION) in "plugins/epCore/src/epCore/epCore" at line 246
    [19:17:52] [Server thread/DEBUG]: #0 src/pocketmine/command/PluginCommand(58): epCore\epCore->onCommand(pocketmine\command\ConsoleCommandSender object, pocketmine\command\PluginCommand object, string gracz, array Array())
    [19:17:52] [Server thread/DEBUG]: #1 src/pocketmine/command/SimpleCommandMap(261): pocketmine\command\PluginCommand->execute(pocketmine\command\ConsoleCommandSender object, string gracz, array Array())
    [19:17:52] [Server thread/DEBUG]: #2 src/pocketmine/Server(2030): pocketmine\command\SimpleCommandMap->dispatch(pocketmine\command\ConsoleCommandSender object, string gracz)
    [19:17:52] [Server thread/DEBUG]: #3 src/pocketmine/Server(1615): pocketmine\Server->dispatchCommand(pocketmine\command\ConsoleCommandSender object, string gracz)
    [19:17:52] [Server thread/DEBUG]: #4 vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\Server->pocketmine\{closure}()
    [19:17:52] [Server thread/DEBUG]: #5 vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications()
    [19:17:52] [Server thread/DEBUG]: #6 src/pocketmine/Server(2349): pocketmine\snooze\SleeperHandler->sleepUntil(double 1549757872.5537)
    [19:17:52] [Server thread/DEBUG]: #7 src/pocketmine/Server(2209): pocketmine\Server->tickProcessor()
    [19:17:52] [Server thread/DEBUG]: #8 src/pocketmine/Server(1785): pocketmine\Server->start()
    [19:17:52] [Server thread/DEBUG]: #9 src/pocketmine/PocketMine(249): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string /root/1/, string /root/1/plugins/)
    [19:17:52] [Server thread/DEBUG]: #10 (1): require(string phar:///root/1/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

    Code:

    public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{
    if($cmd == "gracz"){
    $nick = $sender->getName();
    $this->data_smierc = new Config($this->getDataFolder() . "/smierci.yml", Config::YAML);
    $smierc = $this->data_smierc->get($sender->getName());
    if($smierc == null){
    $smierc = 0;
    }
    $this->data_zabojstwa = new Config($this->getDataFolder() . "/zabojstwa.yml", Config::YAML);
    $zabojstwo = $this->data_zabojstwa->get($sender->getName());
    if($zabojstwo == null){
    $zabojstwo = 0;
    }
    $this->data_odwiedziny = new Config($this->getDataFolder() . "/odwiedziny.yml", Config::YAML);
    $odwiedziny = $this->data_odwiedziny->get($sender->getName());
    $this->data_koxy = new Config($this->getDataFolder() . "/koxy.yml", Config::YAML);
    $koxy = $this->data_koxy->get($sender->getName());
    if($koxy == null){
    $koxy = 0;
    }
    $this->data_refile = new Config($this->getDataFolder() . "/refile.yml", Config::YAML);
    $refile = $this->data_refile->get($sender->getName());
    if($refile == null){
    $refile = 0;
    }
    $this->data_perly = new Config($this->getDataFolder() . "/perly.yml", Config::YAML);
    $pearly = $this->data_perly->get($sender->getName());
    if($pearly == null){
    $pearly = 0;
    }
    $sender->sendMessage("§7• §8]------[ §aGRACZ§8 ]------[ §7•");
    $sender->sendMessage("§8• §7Nick§8: §a" . $sender->getName() . " §8•");
    $sender->sendMessage("§8• §7Zabojstwa§8: §a" . $zabojstwo . " §8•");
    $sender->sendMessage("§8• §7Smierci§8: §a" . $smierc . " §8•");
    $sender->sendMessage("§8• §7Zjedzone Koxy/Refy§8: §a" . $koxy . "/". $refile . " §8•");
    $sender->sendMessage("§8• §7Rzucone Perly§8: §a" . $pearly . " §8•");
    $sender->sendMessage("§8• §7Odwiedziny serwera§8: §a" . $odwiedziny . " §8•");
    $sender->sendMessage("§7• §8]------[ §aGRACZ§8 ]------[ §7•");
    }

    if($cmd == "topka"){
    $sender->sendMessage("§7• §8]------[ §aTOPKA GRACZY§8 ]------[ §7•");
    $this->sendTop($sender);
    $sender->sendMessage("§7• §8]------[ §aTOPKA GRACZY§8 ]------[ §7•");
    }

    if($cmd == "chat"){
    if($sender->isOp()){
    if(empty($args)){
    $sender->sendMessage("§7• §8[§aTH§8] §7/chat on/off");
    return true;
    }

    if($args[0] == "on"){
    $this->disable = false;
    $this->getServer()->broadcastMessage("§7• §8[§aTH§8] §7Chat został włączony!");
    }

    if($args[0] == "off"){
    $this->disable = true;
    $this->getServer()->broadcastMessage("§7• §8[§aTH§8] §7Chat został wyłączony!");
    }
    }else{
    $sender->sendMessage("§7• §8[§aTH§8] §cBrak uprawnien do wykonania komendy!");
    }
    }

    if($cmd == "cc"){
    if($sender->isOp()){
    for($i = 1; $i <= 75; $i++) {
    $this->getServer()->broadcastMessage(" ");
    }
    $this->getServer()->broadcastMessage("§7• §8[§aTH§8] §7Chat został‚ wyczyszczony!");
    }else{
    $sender->sendMessage("§7• §8[§aTH§8] §cBrak uprawnien do wykonania komendy!");
    }
    }
    }



    Please help.
    I'm sorry for my English.
     
  2. Gianluxx

    Gianluxx Silverfish

    Messages:
    18
    GitHub:
    Gianluxx
    Do like this:
    onCommand(.............){
    ............... your commands ........
    return false;
    }
     

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.