Your code is also wrong. What have you even learned from our previous attempts to guide you through a WHOLE plugin? I don't think anyone is willing to walk you through the whole process AGAIN that took more than a month man. Seriously, just have at least basic knowledge on coding in general before asking. Please. If you're willing to take your time for US to fix your code, why not take time to actually learn coding? C'mon man, I'm not even trying to be mean. I'm just telling you what you are supposed to be doing. If you're offended by this, you seriously might want to consider giving up on developing for pocketmine-mp, or anything in general. Reference: https://forums.pmmp.io/threads/use-player-name-in-config-yml.10959/#post-78398
Code: Fatal error: Cannot redeclare GameMode\main::onCommand() in /home/minecraft/plugins/GameMode/src/gamemode/main.php on line 31 Why?
That doesn't exactly help me. There it says that if you have "a" aaa is displayed, otherwise bbb But I want to do 4 different commands
It exactly says what your problem is if you could read. You dumb ass declared the same function more than once! PHP: class Main extends PluginBase { public function onCommand(): bool {} public function onCommand() : bool {} # That is not allowed ^}
Can this code work? Code: public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args):bool { switch($cmd) { case "gm0": if($sender->hasPermission("pocketmine.command.gamemode")) { $sender->setGamemode(0); } break; case "gm1": if($sender->hasPermission("pocketmine.command.gamemode")) { $sender->setGamemode(1); } break; case "gm2": if($sender->hasPermission("pocketmine.command.gamemode")) { $sender->setGamemode(2); } break; case "gm3": if($sender->hasPermission("pocketmine.command.gamemode")) { $sender->setGamemode(3); } break; }return true; }
Did you mean this? Code: name: GameMode version: Beta 1.0 main: gamemode\main api: [3.0.0, 4.0.0] author: GeistFan commands: gm0: description: Set to Survival permission: pocketmine.command.gamemode gm1: description: Set to Creative permission: pocketmine.command.gamemode gm2: description: Set to Adventure permission: pocketmine.command.gamemode gm3: description: Set to Spectator permission: pocketmine.command.gamemode permissions: pocketmine.command.gamemode: default: op