forked from Bukkit/Bukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PlayerItemBreakEvent. Addresses BUKKIT-1600
- Loading branch information
1 parent
ae4f1c0
commit ae3b5cc
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/main/java/org/bukkit/event/player/PlayerItemBreakEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |