geforkt von Mirrors/Paper
Refactor Bucket events
By: Erik Broes <erikbroes@grum.nl>
Dieser Commit ist enthalten in:
Ursprung
ecc7ca0477
Commit
c11905550e
@ -4,52 +4,14 @@ 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 empties a bucket
|
||||
*/
|
||||
public class PlayerBucketEmptyEvent extends PlayerEvent implements Cancellable {
|
||||
ItemStack itemStack;
|
||||
boolean cancelled = false;
|
||||
Block blockClicked;
|
||||
BlockFace blockFace;
|
||||
Material bucket;
|
||||
|
||||
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_EMPTY, who);
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
}
|
||||
super(Type.PLAYER_BUCKET_EMPTY, who, blockClicked, blockFace, bucket, itemInHand);
|
||||
|
||||
public Material getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public Block getBlockClicked() {
|
||||
return blockClicked;
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
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;
|
||||
|
||||
public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private ItemStack itemStack;
|
||||
private boolean cancelled = false;
|
||||
private Block blockClicked;
|
||||
private BlockFace blockFace;
|
||||
private Material bucket;
|
||||
|
||||
public PlayerBucketEvent(Type type, Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(type, 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;
|
||||
}
|
||||
}
|
@ -4,52 +4,13 @@ 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 fills a bucket
|
||||
*/
|
||||
public class PlayerBucketFillEvent extends PlayerEvent implements Cancellable {
|
||||
ItemStack itemStack;
|
||||
boolean cancelled = false;
|
||||
Block blockClicked;
|
||||
BlockFace blockFace;
|
||||
Material bucket;
|
||||
|
||||
public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||
public PlayerBucketFillEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_FILL, who);
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
}
|
||||
|
||||
public Material getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public Block getBlockClicked() {
|
||||
return blockClicked;
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
super(Type.PLAYER_BUCKET_FILL, who, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren