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

Making Items Consumable

Discussion in 'Development' started by OnTheVerge, Jan 1, 2018.

  1. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
    Hello there,
    lastnight I attempted a project which was to make a custom potions plugin. It all worked fine however the item was not fully consumable... The itemId I used was "373, 8770, 1" it basically gave me a water bottle with the name "Mining Concoction" whenever I performed a command. I tried consuming the concoction and I recieved the effect however it did not have a glass bottle residue:( im new to plugin development, can anyone help me?
    Thanks in Advance! :)

    My Code so far:

    PHP:
     public function onConsume(PlayerItemConsumeEvent $event){
       
    $player $event->getPlayer();
       
    $item $event->getItem();
       
    $speed Effect::getEffect(1);
       
    $speed->setVisible(true);
       
    $speed->setAmplifier(3);
       
    $speed->setDuration(600);
            if(
    $item->getId() == 373 && $event->getItem()->getCustomName() == "§k§bll§r§6Mining Concoction§k§bll§r"){
      
    $player->addEffect($speed);
      
    $player->sendMessage("§7(§3!§7)§cConcoction Consumed!");
       }
    }
     
    Last edited: Jan 1, 2018
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
  3. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
  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.