Undefined property: pocketmine\Server::$getCommandMap" (EXCEPTION) in PHP: use pocketmine\Player;use pocketmine\Server;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\command\CommandMap;use pocketmine\command\Command;use pocketmine\command\CommandSender;class Core extends PluginBase{ public function onEnable() { $this->getServer()->getCommandMap->register("info", new Info($this)); $this->getServer()->getCommandMap->register("refill", new Refill($this)); }} Is this the way to register a command? I dont like coming here to ask about this topix because most of you guys say “dont do it if you dont know” but how is someone supposed to learn. Anyways. Can someone help me register this the right way?
Well, the error is telling you that $this->getServer()->getCommandMap isn't a property. I see your error and so should you. (hint: your trying to access getCommandMap as a variable, not as a function )
Confused. I see everyone enabling it like this, this is my first time trying can you show me with some example code? Please
Create a folder name Commands create anyname.php PHP: $this->getServer()->getCommandMap()->register("anyname", new Commands\anyname());
Have a good look into this thread, I have made a detailed explanation. Look at my first post I have explained it in pretty much detail.