I keep getting this crash dump when I load this plugin. What did I do wrong here? PocketMine-MP Crash Dump Fri Oct 6 21:18:49 EDT 2017 Error: Declaration of MenuSystem\Commands\BaseCommand::getPlugin() must be compatible with pocketmine\command\PluginIdentifiableCommand::getPlugin(): pocketmine\plugin\Plugin File: MenuSystem-master/src/MenuSystem/Commands/BaseCommand Line: 11 Type: E_COMPILE_ERROR THIS CRASH WAS CAUSED BY A PLUGIN BAD PLUGIN: MenuSystem v3.0.0 Code: [2] [3] namespace MenuSystem\Commands; [4] [5] use MenuSystem\Main; [6] [7] use pocketmine\command\Command; [8] use pocketmine\command\CommandSender; [9] use pocketmine\command\PluginIdentifiableCommand; [10] [11] class BaseCommand extends Command implements PluginIdentifiableCommand [12] { [13] private $plugin; [14] public function __construct(Main $plugin, $name, $description, $usageMessage, $aliases) [15] { [16] parent::__construct($name, $description, $usageMessage, $aliases); [17] $this->plugin = $plugin; [18] } [19] public function execute(CommandSender $sender, $commandLabel, array $args) [20] { [21] if ($this->testPermission($sender)) {
<?php namespace LobbySystem\Commands; use LobbySystem\Main; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\command\PluginIdentifiableCommand; class BaseCommand extends Command implements PluginIdentifiableCommand { private $plugin; public function __construct(Main $plugin, $name, $description, $usageMessage, $aliases) { parent::__construct($name, $description, $usageMessage, $aliases); $this->plugin = $plugin; } ppublic function execute(CommandSender $sender, $commandLabel, array $args) { if ($this->testPermission($sender)) { $result = $this->onExecute($sender, $args); if (is_string($result)) { $sender->sendMessage($result); } return true; } return false; } public function onExecute(CommandSender $sender, array $args) { } public function getPlugin() { return $this->plugin; } } Current Code
Read the error: Code: Declaration of MenuSystem\Commands\BaseCommand::getPlugin() must be compatible with pocketmine\command\PluginIdentifiableCommand::getPlugin(): pocketmine\plugin\Plugin It says that there is something wrong with the getPlugin() function in your BaseCommand.php file. It must be compatible with: pocketmine\command\PluginIdentifiableCommand::getPlugin(): pocketmine\plugin\Plugin The getPlugin() functions needs to return a Plugin object, that means you need to change public function getPlugin() to public function getPlugin(): Plugin. Don't forget to add the Plugin class with the use keyword.
Where does the error say that getPlugin() should return a BaseCommand? @WinterBuild7074 and @themestl already answered this correctly above so please don't add wrong information. When overriding a core class you must respect the types for both the arguments passed, and the return type (here the function getPlugin() must return... a Plugin object) as specified after a colon : and just before the opening curly brace { of your function. That said, it looks like there's a whole load of other problems with this code (ppublic function??), although without using code blocks it's impossible to read :-/ Why not contact the developer instead of asking people here to fix it for you? It's fine asking for help, but if you don't understand what a 'return type' is then you'll be unable to fix it yourself even if we tell you how.