Code: public function onProcess(PlayerCommandPreprocessEvent $event){ if($event->getMessage() == "/command"){ $event->getPlayer()->sendMessage("Sorry. This command is disabled"); $event->setCancelled(true); } }
What if you want to block the login command? Every player has different password! For example if you want to block the register command (SimpleAuth plugin): PHP: public function onCmd(PlayerCommandPreprocessEvent $event){ if(in_array($event->getPlayer()->getName(), (array) $this->blocked_players)){ $cmd = explode(" ", $event->getMessage()); if($cmd[0] == "/register") { $event->getPlayer()->sendTip("You are not able to use this command now!"); $event->setCancelled(true); } }}