mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
SPIGOT-5282: Improve bucket event API
This commit is contained in:
parent
bde198c9e9
commit
84df6df192
3 changed files with 27 additions and 0 deletions
|
@ -14,10 +14,15 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
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) {
|
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);
|
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
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
|
|
|
@ -15,12 +15,19 @@ import org.jetbrains.annotations.Nullable;
|
||||||
public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
|
public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
|
private final Block block;
|
||||||
private final Block blockClicked;
|
private final Block blockClicked;
|
||||||
private final BlockFace blockFace;
|
private final BlockFace blockFace;
|
||||||
private final Material bucket;
|
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) {
|
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);
|
super(who);
|
||||||
|
this.block = block;
|
||||||
this.blockClicked = blockClicked;
|
this.blockClicked = blockClicked;
|
||||||
this.blockFace = blockFace;
|
this.blockFace = blockFace;
|
||||||
this.itemStack = itemInHand;
|
this.itemStack = itemInHand;
|
||||||
|
@ -56,6 +63,16 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||||
this.itemStack = itemStack;
|
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
|
* Return the block clicked
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,10 +14,15 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
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) {
|
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);
|
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
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue