I have this code and it works perfectly fine. Everything works but I tried putting Item Ids and Effect ids and it crashed the server I got an error message. Then I changed to the actual “BLAZE_ROD” and “SPEED” and the plugin worked. There is no issue with what the plugin is supposed to do but is there anyway I can make it so that it uses Ids and not the name? PHP: public function onHold(PlayerItemHeldEvent $event){ $item = $event->getItem(); $player = $event->getPlayer(); if($item->getId() === Item::BLAZE_ROD){ $player->addEffect(Effect::getEffect(Effect::SPEED)->setDuration(20 * 10)->setVisible(true));
What did you put in for the id? And better yet, why do you want to hard code your plugin to those values?? If mcpe changes the id, then your plugin instantly fails
I find it easier to use Ids due to wanting to use Pink Dye or Some item that you can find easier on ids I dont mind if they change ids I will change its a simple change. Thanks hopefully you can help
I guess you do make sense. Then If I want to use an item with a diffrent meta do I do DYE:8 In the Item:YE:8 Section?
What you tried to use isn't even PHP or mcpe syntax. An item's Id is the first number before the : The item's metadata or damage is after the :