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

Solved Cancel crafting a item

Discussion in 'Development' started by iCirgio, Jan 16, 2018.

  1. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    How do I use itemcraftevent to cancel a player from crafting a certain item.
     
    OnTheVerge likes this.
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    getRecipe()->getResult() returns the recipe's resulting Item.
    Something like this if you are trying to ban god apples
    PHP:
    if(CraftItemEvent::getRecipe()->getResult()->getId() === Item::ENCHANTED_GOLDEN_APPLE){
        
    $event->setCancelled();
    }
     
  3. Flupko

    Flupko Silverfish

    Messages:
    24
    GitHub:
    Warex
    I am a beginner in coding and I would like to know that she is the "public function" please. Thank you
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    we will be happy to help you but PLEASE consider making a new post for your needs rather than posting them here
     
  5. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Its about the same topic. Why make a new thread
     
    Tee7even likes this.
  6. Flupko

    Flupko Silverfish

    Messages:
    24
    GitHub:
    Warex
    Ok
     
  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.