1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved removeItem() not working

Discussion in 'Development' started by Astro, Nov 26, 2018.

  1. Astro

    Astro Slime

    Messages:
    78
    GitHub:
    RealAstro
    removeItem() doesn't work at all and there are no errors displayed here is the code
    PHP:
        public function onInteract(PlayerInteractEvent $event) {
            
    $player $event->getPlayer();
            
    $item $event->getItem();
            
    $damage $event->getItem()->getDamage();
            if (
    $item->getId() == 130) {
                switch (
    $damage) {
                    case 
    1:
                        
    $jackpot mt_rand(0100);
                        if (
    $jackpot <= 10) {
                            
    $chance mt_rand(5000075000);
                            
    EconomyAPI::getInstance()->addMoney($player$chance);
                            
    $player->addTitle("§8§l[§5!§8] §r§7JACKPOT! §8§l[§5!§8]");
                            
    $player->sendMessage("§7You have received §f{$chance}§7 from a Simple Money Pouch!");
                            
    $this->plugin->getServer()->broadcastMessage("§l§dJACKPOT:§r§7 " $player " §7received {$chance} from a §fSimple§7 Money Pouch!");
                        } else {
                            
    $chance mt_rand(100050000);
                            
    EconomyAPI::getInstance()->addMoney($player$chance);
                            
    $player->addTitle("§8§l[§5!§8] §r§7Opening a §f§lSimple§r§7 Money Pouch! §8§l[§5!§8]");
                            
    $player->sendMessage("§7You have won §f{$chance}§7 from a Simple Money Pouch!");
                        }
                        
    $player->getInventory()->removeItem(Item::get(5411));
                        break;
                }
            }
        }
    }[/
    CODE]
     
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    $player->setItemInHand(Item::get(0));
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.