Error: Code: [19:01:46] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\block\BlockPlaceEvent' to 'Admin v1': Call to undefined method pocketmine\Player::isAdmin() on DanielYTK\Coder\code [19:01:46] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Player::isAdmin()" (EXCEPTION) in "/Admin/src/DanielYTK/Coder/code" at line 173 Code: PHP: public function aoQuebrar(BlockPlaceEvent $ev){ $player = $ev->getPlayer(); $id = $ev->getBlock()->getId(); if($player->isAdmin()){ if($id === 101){ $ev->setCancelled(true); } } } Function isAdmin(): PHP: public function isAdmin(Player $p){ if(isset($this->admin[$p->getName()])){ return true; } }
You need to do $this->isAdmin($player) not $player->isAdmin(); unless you encapsulate isadmin inside a custom player class that expands on player
PHP: public function aoQuebrar(BlockPlaceEvent $ev){ $p = $ev->getPlayer(); $id = $ev->getBlock()->getId(); if($this->isAdmin($p)){ if($id === 101){ $ev->setCancelled(true); } } }