I made a plugin to remove items and armor from players inventory when change gamemode but it doesnt work here is code: <?php namespace inv\clear{ use pocketmine\event\player\PlayerGameModeChangeEvent; use pocketmine\event\Listener; class MainClass extends PluginBase implements Listener { public function onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent $player){ $player->getInventory()->clearAll() $player->getArmorInventory()->clearAll(); } }
Try This PHP: public function onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent $event){$player = $event->getPlayer(); $player->getInventory()->clearAll() $player->getArmorInventory()->clearAll(); }
This is error i get : syntax error, unexpected 'public function onPlayerGame' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)" (EXCEPTION) in "plugins/invclear.phar/src/inv/clear/invclear" at line 11