EatEvent

Discussion in 'Plugin Development' started by m4rku1s, Jan 26, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    m4rku1s

    Hi! Is there something as EatEvent? I would like to write a plugin to make a infinity porkchop and I have no idea how should I do it. I was wondering to make something like "if player ate porkchop, give it him back"
     
  2. Offline

    mythbusterma

    @m4rku1s

    It's the PlayerInteractEvent and check if they have food in their hand, if I recall correctly.
     
  3. Offline

    BobTheHamster9

    I believe you can also you the PlayerItemConsumeEvent but I think either one will work.
     
  4. Offline

    87pen

    Last edited: Jan 26, 2016
  5. Offline

    WolfMage1

    Also a FoodLevelChangeEvent :3
     
  6. Offline

    Zombie_Striker

    @WolfMage1
    That gets triggered after the the player consumes the food.
     
  7. Offline

    WolfMage1

    yes but before the food level gets modified (I believe)
     
  8. Offline

    Zombie_Striker

    @WolfMage1
    Yes, it does trigger before it is modified, because you can cancel it or change the amount of health restored, but that still happens after the food item is consumed. Because of that, if you add a new food item after it is consumed, it will "flash" as the old object disappears and the new object takes it's place. It would be better to add the item before the food item is consumed, that way it does not "flash".
     
Thread Status:
Not open for further replies.

Share This Page