hello, i want help i want remove item or block from player like >> the player have 32 diamonds ! i want remove 5 dimaond from the player and the 27 diamond stell wath him how ? sorry for bad english !
PHP: public function onItemHeld(PlayerItemHeldEvent $eve1){if($eve1->getPlayer()->getInventory()->getItemInHand()->getId() === 281){$eve1->getPlayer()->sendTip(Color::YELLOW." You have now a PACKAGE tools !!");$eve1->getPlayer()->getInventory()->removeItem(Item::get(Item::Bowl, 0, 1));$eve1->getPlayer()->addEffect(Effect::getEffect(8)->setDuration(100)->setAmplifier(9));}} this will work ?
Youu Want Remove Item WITH ID ? PHP: $count = 3;$id = 1;$player->getInventory()->removeItem($id,0,$count);
PHP: public function onItemHeld(PlayerItemHeldEvent $eve1){if($eve1->getPlayer()->getInventory()->getItemInHand()->getId() === 328){$level = $this->getServer()->getLevelByName("mg");$p = $eve1->getPlayer();$eve1->getPlayer()->sendTip(Color::YELLOW." You have now a PACKAGE tools !!");$count = 1;$id = 328;$eve1->getPlayer()->getInventory()->removeItem($id,0,$count);$level->addParticle(new ExplodeParticle(new Vector3($p->x, $p->y + 2, $p->z)));$eve1->getPlayer()->addEffect(Effect::getEffect(5)->setDuration(100)->setAmplifier(2));}} is not working