Skip to content

Commit

Permalink
Add PlayerItemBreakEvent. Addresses BUKKIT-1600
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live authored and Wolvereness committed Jun 21, 2012
1 parent ae4f1c0 commit ae3b5cc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.bukkit.event.player;

import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;

/**
* Fired when a player's item breaks (such as a shovel or flint and steel).
* The item that's breaking will exist in the inventory with a stack size of 0.
* After the event, the item's durability will be reset to 0.
*/
public class PlayerItemBreakEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final ItemStack brokenItem;

public PlayerItemBreakEvent(final Player player, final ItemStack brokenItem) {
super(player);
this.brokenItem = brokenItem;
}

/**
* Gets the item that broke
*
* @return The broken item
*/
public ItemStack getBrokenItem() {
return brokenItem;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}

0 comments on commit ae3b5cc

Please sign in to comment.