From 803c3013d5a6197e8e5dd9b30ee9daa2973b8e78 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 6 May 2012 21:36:07 -0600 Subject: [PATCH] Add PlayerItemBreakEvent. Addresses BUKKIT-1600 By: Travis Ralston --- .../event/player/PlayerItemBreakEvent.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java new file mode 100644 index 0000000000..6b338e26a6 --- /dev/null +++ b/paper-api/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; + } +}