cn.nukkit.event.block.BlockBreakEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.event.block;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.event.Cancellable;
import cn.nukkit.event.HandlerList;
import cn.nukkit.item.Item;
import cn.nukkit.math.BlockFace;
/**
* @author MagicDroidX (Nukkit Project)
*/
public class BlockBreakEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlers() {
return handlers;
}
protected final Player player;
protected final Item item;
protected final BlockFace face;
protected boolean instaBreak = false;
protected Item[] blockDrops = Item.EMPTY_ARRAY;
protected int blockXP = 0;
protected boolean fastBreak = false;
public BlockBreakEvent(Player player, Block block, Item item, Item[] drops) {
this(player, block, item, drops, false, false);
}
public BlockBreakEvent(Player player, Block block, Item item, Item[] drops, boolean instaBreak) {
this(player, block, item, drops, instaBreak, false);
}
public BlockBreakEvent(Player player, Block block, Item item, Item[] drops, boolean instaBreak, boolean fastBreak) {
this(player, block, null, item, drops, instaBreak, fastBreak);
}
public BlockBreakEvent(Player player, Block block, BlockFace face, Item item, Item[] drops, boolean instaBreak, boolean fastBreak) {
super(block);
this.face = face;
this.item = item;
this.player = player;
this.instaBreak = instaBreak;
this.blockDrops = drops;
this.fastBreak = fastBreak;
this.blockXP = block.getDropExp();
}
public Player getPlayer() {
return player;
}
public BlockFace getFace() {
return face;
}
public Item getItem() {
return item;
}
public boolean getInstaBreak() {
return this.instaBreak;
}
public Item[] getDrops() {
return blockDrops;
}
public void setDrops(Item[] drops) {
this.blockDrops = drops;
}
public int getDropExp() {
return this.blockXP;
}
public void setDropExp(int xp) {
this.blockXP = xp;
}
public void setInstaBreak(boolean instaBreak) {
this.instaBreak = instaBreak;
}
public boolean isFastBreak() {
return this.fastBreak;
}
}