Solved Server crashed because onCommand

Discussion in 'Plugin Help' started by GeistFan, Nov 13, 2022.

  1. GeistFan

    GeistFan Slime

    Messages:
    84
    GitHub:
    GeistFan
    Hey again, I just finished a new plugin and i wanted to test it but the server just crashed. I get this error:
    Error: Declaration of ForeverCMD\main::eek:nCommand(pocketmine\command\Command $cmd, pocketmine\command\CommandSender $sender, array $args, string $label): bool must be compatible with pocketmine\plugin\PluginBase::eek:nCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, string $label, array $args): bool
    I just don't know what it means because I think mine and the "Compatible" are the same.
     
  2. GeistFan

    GeistFan Slime

    Messages:
    84
    GitHub:
    GeistFan
    I solved it, strangely you had to put the uses in the right order...
    Now i have another error that says: pocketmine\plugin\PluginManager::registerEvent(): Argument #1 ($event) must be of type string, ForeverCMD\main given, called in C:\Users\arese\Desktop\PocketMine-MP-stable\plugins\forevercmd\src\forevercmd\main.php on line 24
    Does anyone know what i'm doing wrong? I didn't code since PM3.20
     
  3. GeistFan

    GeistFan Slime

    Messages:
    84
    GitHub:
    GeistFan
    Heres the Code by the way
    Code:
    public function onEnable(): void
        {
            $this->getLogger()->info("ForeverCMD is activated!");
            $this->getServer()->getPluginManager()->registerEvent($this, $this);
            @mkdir($this->getDataFolder());
            $this->saveDefaultConfig();
            $this->getResource("config.yml");
        }
     
  4. GeistFan

    GeistFan Slime

    Messages:
    84
    GitHub:
    GeistFan
    Solved!
     

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.