PHP: public function onEDBEE(EntityDamageEvent $ev){ if($ev instanceof EntityDamageByEntityEvent){ $damager = $ev->getDamager(); $entity = $ev->getEntity(); if($damager instanceof Player){ if($enitity instanceof SLIME){ $ev->setDamage(0); $ev->setKnockBack(10); } } } } My Idea is using Slime entity as a ball for football with resourcepack and plugin I want to when a player attacked Slime, Slime knockback to 10 block farther and don't took any damage from attack When I started the server, There wasn't any error but in many years I program in C++ I know when my code ran for first time and I don't have any error there is a problem However, I'm amateur in PMMP API please check my code and post my problem in this thread and sorry for my incorrect English grammer if there is a problem in my text grammer
instanceof doesn't give errors when a class does not exist. So, for example: PHP: /** @var Player $player */return ($player instanceof AClassThatDoesNotExist);//AClassThatDoesNotExist is a class that does not exist will return false and no errors. Did you name your slime class SLIME and not Slime? And did you import the Player class? There's a typo in $entity vs $enitity. You probably didn't import the Player class so the code isn't being executed beyond.