Hi, I have but this one startup plugin execute a single command on any one I programmed while the other controls do not work (this / joinhg works). plugin.yml: Code: name: reskill main: reskill\MainClass version: 1.0.0 api: [1.0.0] load: POSTWORLD author: MrReskill description: Plugin base website: https://destinype.fr commands: joinhg: description: join HG usage: "Usage: /joinhg" permission: msg.command.hg jointtf: description: join ttf usage: "Usage: /jointtf" permission: msg.command.ttf joinsr: description: join sr usage: "Usage: /joinsr" permission: msg.command.sr lobbyvip: description: lobbyvip usage: "Usage: /lobbyvip" permission: msg.command.vip joinoff: description: join OFF game usage: "Usage: /joinoff" permission: msg.command.off permissions: msg.command.hg: description: "Run /joinhg command!" default: true msg.command.ttf: description: "Run /jointtf command!" default: true msg.command.sr: description: "Run /joinsr command!" default: true msg.command.vip: description: "Run /lobbyvip command!" default: true msg.command.off: description: "Run /joinoff command!" default: true MainClass.php: Code: <?php namespace reskill; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\event\Listener; use pocketmine\event\player\PlayerRespawnEvent; use pocketmine\event\player\PlayerCommandPreprocessEvent; use pocketmine\Player; use pocketmine\plugin\PluginBase; use pocketmine\Server; use pocketmine\utils\TextFormat; class MainClass extends PluginBase implements Listener{ public function onLoad(){ $this->getLogger()->info(TextFormat::WHITE . "DarkRealmsCore has been loaded!"); } public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TextFormat::DARK_GREEN . "DarkRealmsCore has been enabled!"); } public function onDisable(){ $this->getLogger()->info(TextFormat::DARK_RED . "DarkRealmsCore has been disabled!"); } public function onDamage(EntityDamageEvent $event){ if($event->getEntity() instanceof Player){ if($event->getCause() == EntityDamageEvent::CAUSE_FALL){ $event->setCancelled(); } } } public function onCommandChat(PlayerCommandPreprocessEvent $event){ $player = $event->getPlayer(); $cmd = explode(" ",strtolower($event->getmessage())); if($cmd[0] == "/buhc" or $cmd[0] == "/tg" or $cmd[0] == "/claim" or $cmd[0] == "/unclaim" or $cmd[0] == "/me"){ $pos = $player->getName(); if($player->getLevel()->getName() == "spawn"){ $player->sendMessage("§6[§5HUB§6]§c Ces commandes ne sont pas executable au lobby de §cBadlion§lPE"); $event->setCancelled(true); } } if($cmd[0] == "tg" or $cmd[0] == "connard" or $cmd[0] == "ez" or $cmd[0] == "eZ" or $cmd[0] == "putin"){ $player->sendMessage("§6[§5MODO§6]§c Vous avez cité un mot interdit par notre AntiCheat"); $event->setCancelled(true); } } if($cmd[0] == "pl" or $cmd[0] == "help" or $cmd[0] == "version"){ $player->sendMessage("§6[§5BadlionPE§6]§c NON! L'originalité est la recette du bon fonctionnement d'un serveur ! Cette commande à étez bloqué."); $event->setCancelled(true); } } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ switch($command->getName()){ case "joinhg": $sender->sendMessage("§5§l========================="); $sender->sendMessage("§aYou have selected the game."); $sender->sendMessage("§aGame: §cHungerGames"); $sender->sendMessage("§5§l========================="); return true; case "jointtf": $sender->sendMessage("§5§l========================="); $sender->sendMessage("§aYou have selected the game."); $sender->sendMessage("§aGame: §cTouchTheFlag (TTF)"); $sender->sendMessage("§5§l========================="); return true; case "joinsr": $sender->sendMessage("§5§l========================="); $sender->sendMessage("§aYou have selected the game."); $sender->sendMessage("§aGame: §cSurvie | Survival"); $sender->sendMessage("§5§l========================="); return true; case "lobbyvip": $sender->sendMessage("§5§l========================="); $sender->sendMessage("§aYou have been teleported to"); $sender->sendMessage("§aGame: §3Lobby VIP"); $sender->sendMessage("§5§l========================="); return true; case "joinoff": $sender->sendMessage("§5§l========================="); $sender->sendMessage("§aThis game is disabled"); $sender->sendMessage("§aReason: §cMaintenance Break "); $sender->sendMessage("§5§l========================="); return true; } } } Thanks you.
There is perfectly nothing wrong with return true. If you returned from the function, you don't need to break the switch anymore, because you already exited the whole function. Please stop posting wrong replies on the forums.
What will happen if you change the order? for example, change Code: commands: joinhg: ... into Code: commands: jointtf: ...
I listen to the plugin help for her from now the plugin works with the " break; " I send messages I want.
Nothing really. Think of it as simply referencing what the plugin's commands. in referencing, it doesn't matter much about the order, its just simply easier. It's basically the author's decision what order it's in. Feel free to test it out though.