Hello, could someone help me? I managed to give myself a red armor, but not to know if the armor was red, here is my code PHP: public function onArmorChange(EntityArmorChangeEvent $ev){ $player = $ev->getEntity(); $Nid = $ev->getNewItem()->getID(); $Oid = $ev->getOldItem()->getID(); if($player instanceof Player){ if($Nid == 298 and $Nid->getCustomColor() == Color(255, 0, 0)){ $eff = new EffectInstance(Effect::getEffect(Effect::NIGHT_VISION) , 1 * 999999, 0, true); $player->addEffect($eff); }elseif($Oid == 298 and $Nid->getCustomColor() == Color(255, 0, 0)){ $player->removeEffect(16); } } }
the idea you provided is correct, but i suggest you use NBT if you need to difference your special item from all the regular items
it is not a good practice to use hard coded values for item IDs because they can change at any time you are calling a function on an int you forgot the `new` keyword to make a new instance of Color