Solved Cancel ConsumeEvent [Bug within Bukkit API]

Discussion in 'Plugin Development' started by L33m4n123, Apr 7, 2013.

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

    L33m4n123

    Hey,

    I got following Code

    Code:java
    1. @EventHandler
    2. public final void onFoodEat(final PlayerItemConsumeEvent event) {
    3. Player p = event.getPlayer();
    4. if (p.getItemInHand().getType() == Material.COOKIE) {
    5. event.setCancelled(true);
    6. }
    7. }


    But however I found a little bug within that code that I cannot seem to fix..

    Every second or third time the Cookie disapears out of my hand and is in the crafting menu in the Inventory.
    [​IMG]
     
  2. Offline

    Hoolean

    L33m4n123

    Post this as a bug here! From what I've seen it looks like your bug is a flaw with Bukkit rather than what you've done :)
     
  3. Offline

    horoking

    Perhaps change the
    Code:
    final PlayerItemConsumeEvent event
    to
    Code:
    PlayerItemConsumeEvent
    :)

    horoking

    EDIT:

    MrBluebear3 Yes or post this as a bug :D
     
    MrBluebear3 likes this.
  4. Offline

    L33m4n123

    Ok. Checking that Bugsite it is already mentioned there. Ok. Means I either need to find a workarround or they need to fix it. Thanks
     
    MrBluebear3 likes this.
Thread Status:
Not open for further replies.

Share This Page