org.bukkit.event.player.PlayerBucketEvent Maven / Gradle / Ivy
package org.bukkit.event.player;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.inventory.ItemStack;
/**
* Called when a player interacts with a Bucket
*/
public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
private final Block blockClicked;
private final BlockFace blockFace;
private final Material bucket;
private ItemStack itemStack;
private boolean cancelled = false;
public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
super(who);
this.blockClicked = blockClicked;
this.blockFace = blockFace;
this.itemStack = itemInHand;
this.bucket = bucket;
}
/**
* Returns the bucket used in this event
*
* @return the used bucket
*/
public Material getBucket() {
return bucket;
}
/**
* Get the resulting item in hand after the bucket event
*
* @return Itemstack hold in hand after the event.
*/
public ItemStack getItemStack() {
return itemStack;
}
/**
* Set the item in hand after the event
*
* @param itemStack the new held itemstack after the bucket event.
*/
public void setItemStack(ItemStack itemStack) {
this.itemStack = itemStack;
}
/**
* Return the block clicked
*
* @return the blicked block
*/
public Block getBlockClicked() {
return blockClicked;
}
/**
* Get the face on the clicked block
*
* @return the clicked face
*/
public BlockFace getBlockFace() {
return blockFace;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy