mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 09:21:57 +01:00
SPIGOT-6910: Add BlockDamageAbortEvent
By: FreeSoccerHDX <unconfigured@null.spigotmc.org>
This commit is contained in:
parent
7bcd1d10f2
commit
e6392d1992
1 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a player stops damaging a Block.
|
||||
*/
|
||||
public class BlockDamageAbortEvent extends BlockEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final ItemStack itemstack;
|
||||
|
||||
public BlockDamageAbortEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final ItemStack itemInHand) {
|
||||
super(block);
|
||||
this.player = player;
|
||||
this.itemstack = itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player that stopped damaging the block involved in this event.
|
||||
*
|
||||
* @return The player that stopped damaging the block
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ItemStack for the item currently in the player's hand.
|
||||
*
|
||||
* @return The ItemStack for the item currently in the player's hand
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue