hey, I keep on geting this same warning on my console when i don't wear a helmet , all i want is to remove a effect when the player doesn't wear a helmet WARNING: Warning: Illegal offset type in isset or empty in phar:///jar/pocketmine/clearsky/1.0.5/ClearSky.phar/src/pocketmine/entity/Entity.php on line 515
PHP: public function getHead(PlayerMoveEvent $e) { $p = $e->getPlayer(); $pInv = $p->getInventory(); $effect = Effect::getEffect(5); if($pInv->getHelmet()->getId() === 0){ $p->removeEffect($effect); } }
1. PMMP forums do not support forks there is allowed only pocketmine 2. You can use following code. PHP: public function getHead(PlayerMoveEvent $e) { $p = $e->getPlayer(); $pInv = $p->getInventory(); $effect = Effect::getEffect(5);$armor = array("some armorid", "blah blah");foreach($armor as $armors){ if(!$pInv->getHelmet())->getId() !== $armors){ $p->removeEffect($effect); }} } I think it do not give you the warning.