mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 18:50:51 +01:00
SPIGOT-5282: Improve bucket event API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
dccbb3aeee
commit
80f20528ed
3 changed files with 27 additions and 0 deletions
|
@ -14,10 +14,15 @@ import org.jetbrains.annotations.NotNull;
|
|||
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Deprecated
|
||||
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
|
|
@ -15,12 +15,19 @@ import org.jetbrains.annotations.Nullable;
|
|||
public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
|
||||
private ItemStack itemStack;
|
||||
private boolean cancelled = false;
|
||||
private final Block block;
|
||||
private final Block blockClicked;
|
||||
private final BlockFace blockFace;
|
||||
private final Material bucket;
|
||||
|
||||
@Deprecated
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
this(who, null, blockClicked.getRelative(blockFace), blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who);
|
||||
this.block = block;
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
|
@ -56,6 +63,16 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
|||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block involved in this event.
|
||||
*
|
||||
* @return The Block which block is involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public final Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block clicked
|
||||
*
|
||||
|
|
|
@ -14,10 +14,15 @@ import org.jetbrains.annotations.NotNull;
|
|||
public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Deprecated
|
||||
public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
|
Loading…
Reference in a new issue