diff options
author | Travis Ralston <travpc@gmail.com> | 2012-05-06 21:36:07 -0600 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-06-21 02:08:31 -0500 |
commit | e7396e74c4b869d5900582e11e90b8b7d5cfa04d (patch) | |
tree | 882f44cdbc7256f62674becefdc34cabb271bf09 /src/main/java | |
parent | b17ca47d88ead17f79332daf360886097e547672 (diff) | |
download | bukkit-e7396e74c4b869d5900582e11e90b8b7d5cfa04d.tar bukkit-e7396e74c4b869d5900582e11e90b8b7d5cfa04d.tar.gz bukkit-e7396e74c4b869d5900582e11e90b8b7d5cfa04d.tar.lz bukkit-e7396e74c4b869d5900582e11e90b8b7d5cfa04d.tar.xz bukkit-e7396e74c4b869d5900582e11e90b8b7d5cfa04d.zip |
Add PlayerItemBreakEvent. Addresses BUKKIT-1600
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java new file mode 100644 index 00000000..6b338e26 --- /dev/null +++ b/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java @@ -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; + } +} |