Eating Event

Discussion in 'Plugin Development' started by Dark-Panther, Apr 5, 2011.

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

    Dark-Panther

    Hey Guys...
    I want to make an Event on eating Cookies.
    I searched through the javadocs, but I can't finde anything.
    So can you give me an Event or anything like that (oneatingCookies)
    greetings DarkPantherX
     
  2. Offline

    narrowtux

    You should use the PlayerInteractEvent
    you should look if event.getAction()==RIGHTCLICK_AIR
    and if event.getItem().getType()==Material.COOKIE

    and this is your onCookieEatEvent...
     
  3. Offline

    Pianosaurus

    Did you solve this? The only way I can see to find out if something was eaten, is to check for RIGHT_CLICK_AIR or (RIGHT_CLICK_BLOCK and (useInteractedBlock is not denied) and (block not door) and (block not chest) and (block not a ton of other things either)), which seems a bit silly.

    Is there really no way to find out if an item will be used or not?
     
  4. Offline

    Carnes

  5. Offline

    Pianosaurus

    Nah, that code has the problem I mentioned. It doesn't work if you eat a cookie while pointing at a wall, which is most of the time while indoors.
     
Thread Status:
Not open for further replies.

Share This Page