class Main extends PluginBase { public function onInventoryClick(InventoryClickEvent $e, Player $p, Block $b){ if($e->getClickedItem()->getType() == Material->SNOWBALL()); $p->performCommand("cmd"); $p->closeInventory();
First of all, please use [PHP ] [/PHP ] tags around code, it makes things so much easier to read. There are a lot of issues. InventoryClickEvent is not an event currently in pmmp. If it was, you would need to get the Player and the Block from member functions, not in the method you showed. What is Material? Material->SNOWBALL() makes no sense. As far as I can tell, Player:erformCommand() doesn't exist either. You didn't implement pocketmine\event\Listener in your code, so you can't properly listen for that event(assuming it did exist). I try not to say this, but read the docs. Your attempt is nowhere near working.
I can help you to correct it, but I won't correct it myself. I will assume you know the very basics of PHP. If you don't, you should. It will help a lot. If you do, read the docs. Learn the API, or at least learn enough to use it properly this time. To get you started, You must implement pocketmine\event\Listener in your plugin, and the proper event is pocketmine\event\player\PlayerInteractEvent.