PHP: <?php namespace Zombie_Power\me; use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerCommandPreproeccessEvent; class me extends PluginBase implements Listener{ Public Function onEnable (){ $this->getServer()->getPluginManager->registerEvents($this, $this); } Public Function onChat(PlayerCommandPreprocessEvent $event){ $player = $event->getPlayer(); $command = explode(" ", strtolower($event->getMessage())); if ($command[0] == "/me"){ $event->setCancelled(true); //setCancelled will always have (true) $player->sendMesage("Server: This command has been blocked"); } elseif ($command[0] == "/help"){ $event->setCancelled(true); $player->sendMessage(""); $player->sendMessage(""); //add message inside ("") $player->sendMessage(""); $player->sendMessage(""); }} hey guys, i am new to Pocketmine API, i am trying to code to block commands like /me and customise /help, so it can broadcast, whatever i feed in (""), can someone please check it, it would be great. Thanks.
1. please don't copy things blindly. 2. read the comments. 3. you don't need to (but it works when you do) pass a `true` with setCancelled(); it is the default value.
he was helping me on twitter, just found that getPluginManager is a class member, so just needed to edit the code to getPluginManager()
I was going to send this plugin to someone, so if he messed up anything, I added this quotes, as you can also see the second comments, which say to add lines in ("").