mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 09:17:36 +01:00
Add PlayerItemBreakEvent. Addresses BUKKIT-1600
By: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
8b6f1612a1
commit
803c3013d5
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user