Hey,I was wondering if anyone has a code to set a (item) to give effect (potion) for example I use BlazePowder and it gives strength effect and then the BlazePowder goes down (Removed Or Goes Down By 1)
PHP: public function onHeld(PlayerItemHeldEvent $event){ $player = $event->getPlayer(); $hand = $player->getInventory()->getItemInHand(); $count = $hand->getCount(); $air = Item::get(0, 0, 1); if($hand->getId() == 1){ $player->sendMessage("You Have ".$count." Stones!"); $speed = Effect::getEffect(Effect::SPEED); $speed->setDuration($count); $player->addEffect($speed); $player->getInventory()->setItemInHand($air); } }
If you request code, this belongs in the development section. If you are requesting a plugin, then it belongs in the Request section. Make up your mind. What do you want?