Getting Player Eat Event?

Discussion in 'Plugin Development' started by xxCoderForLifexx, Jan 24, 2013.

Thread Status:
Not open for further replies.
  1. Can you do that? and If so how could I do this but with an Item (Ex. Bread)
    Thanks Guys!! [cake]
  2. Offline


    First of all, no, you can't eat wheat. Second, I'm pretty sure eating falls under PlayerInteractEvent
  3. I know I meant bread and Ok thanks

    How would I get the eating Event?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 31, 2016
  4. Offline


    You even quoted my post... Use PlayerInteractEvent
  5. I am in the event but I don't know how to get the eating action
  6. Offline


    With the right click actions.
  7. Ohh Yeah I gaped that..
  8. Offline


    onNomNom(PlayerInteractEvent e){
  9. I have that LaxWasHere
  10. Offline


    Is this you recording on my server?
  11. Offline


    You might want to check for hunger levels, too.
  12. Haha yeah How did you find that?
    It needs a re-render I had bad settings :'(
  13. Offline


  14. Offline


    Yeah, I would add them to a list when they interact, and after they should be done eating remove them, then in food level change event see if they are on the list, if they are, they have eaten something. Just make sure you take them off the list AFTER they should be done eating it.
  15. Offline


    public void onRightClick(PlayerInteractEvent e){
    Player p = (Player)e.getPlayer();
    if(e.getAction().equals(Action.RIGHT_CLICK_AIR) && p.getItemInHand().equals(new ItemStack(Material.[FOOD YOU WANT]))){
    p.sendMessage(ChatColor.AQUA + "I just ate food.");"Food.");
    You can add anything you want when they right click and eat food. You can make them say something in chat or add a potion effect. Whatever you want really.
    xxCoderForLifexx likes this.
  16. Offline


    I search every videos for my server, people are sometimes stupid and record with their hacked client on.
    jorisk322 likes this.
  17. Offline


    I wish I had players recording them playing on my server :p

    When you use the foodlevelchangeevent to verify, keep in mind this might not work for golden apples, as you can eat them when you're on full health.
Thread Status:
Not open for further replies.

Share This Page