@@ -18,11 +18,11 @@ import org.bukkit.event.HandlerList;
|
||||
public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
private final Player player;
|
||||
private boolean cancel;
|
||||
|
||||
public BlockBreakEvent(final Block theBlock, Player player) {
|
||||
super(Type.BLOCK_BREAK, theBlock);
|
||||
public BlockBreakEvent(final Block theBlock, final Player player) {
|
||||
super(theBlock);
|
||||
this.player = player;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
public BlockBurnEvent(Block block) {
|
||||
super(Type.BLOCK_BURN, block);
|
||||
public BlockBurnEvent(final Block block) {
|
||||
super(block);
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
protected boolean buildable;
|
||||
protected int material;
|
||||
|
||||
public BlockCanBuildEvent(Block block, int id, boolean canBuild) {
|
||||
super(Type.BLOCK_CANBUILD, block);
|
||||
public BlockCanBuildEvent(final Block block, final int id, final boolean canBuild) {
|
||||
super(block);
|
||||
buildable = canBuild;
|
||||
material = id;
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ import org.bukkit.inventory.ItemStack;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
private final Player player;
|
||||
private boolean instaBreak;
|
||||
private boolean cancel;
|
||||
private ItemStack itemstack;
|
||||
private final ItemStack itemstack;
|
||||
|
||||
public BlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
|
||||
super(Type.BLOCK_DAMAGE, block);
|
||||
public BlockDamageEvent(final Player player, final Block block, final ItemStack itemInHand, final boolean instaBreak) {
|
||||
super(block);
|
||||
this.instaBreak = instaBreak;
|
||||
this.player = player;
|
||||
this.itemstack = itemInHand;
|
||||
|
||||
@@ -19,8 +19,8 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
private ItemStack item;
|
||||
private Vector velocity;
|
||||
|
||||
public BlockDispenseEvent(Block block, ItemStack dispensed, Vector velocity) {
|
||||
super(Type.BLOCK_DISPENSE, block);
|
||||
public BlockDispenseEvent(final Block block, final ItemStack dispensed, final Vector velocity) {
|
||||
super(block);
|
||||
this.item = dispensed;
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ import org.bukkit.event.Event;
|
||||
public abstract class BlockEvent extends Event {
|
||||
protected Block block;
|
||||
|
||||
public BlockEvent(final Event.Type type, final Block theBlock) {
|
||||
super(type);
|
||||
public BlockEvent(final Block theBlock) {
|
||||
block = theBlock;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ import org.bukkit.event.HandlerList;
|
||||
public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private BlockState newState;
|
||||
private final BlockState newState;
|
||||
|
||||
public BlockFadeEvent(Block block, BlockState newState) {
|
||||
super(Type.BLOCK_FADE, block);
|
||||
public BlockFadeEvent(final Block block, final BlockState newState) {
|
||||
super(block);
|
||||
this.newState = newState;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,10 @@ import org.bukkit.event.HandlerList;
|
||||
public class BlockFormEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private BlockState newState;
|
||||
private final BlockState newState;
|
||||
|
||||
public BlockFormEvent(Block block, BlockState newState) {
|
||||
super(Type.BLOCK_FORM, block);
|
||||
this.block = block;
|
||||
this.newState = newState;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public BlockFormEvent(Type type, Block block, BlockState newState) {
|
||||
super(type, block);
|
||||
public BlockFormEvent(final Block block, final BlockState newState) {
|
||||
super(block);
|
||||
this.block = block;
|
||||
this.newState = newState;
|
||||
this.cancelled = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
protected boolean cancel;
|
||||
|
||||
public BlockFromToEvent(final Block block, final BlockFace face) {
|
||||
super(Type.BLOCK_FROMTO, block);
|
||||
super(block);
|
||||
this.face = face;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
@@ -14,12 +13,12 @@ import org.bukkit.event.HandlerList;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private IgniteCause cause;
|
||||
private final IgniteCause cause;
|
||||
private boolean cancel;
|
||||
private Player thePlayer;
|
||||
private final Player thePlayer;
|
||||
|
||||
public BlockIgniteEvent(Block theBlock, IgniteCause cause, Player thePlayer) {
|
||||
super(Event.Type.BLOCK_IGNITE, theBlock);
|
||||
public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Player thePlayer) {
|
||||
super(theBlock);
|
||||
this.cause = cause;
|
||||
this.thePlayer = thePlayer;
|
||||
this.cancel = false;
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
* Handles all events thrown in relation to Blocks
|
||||
*/
|
||||
@Deprecated
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public BlockListener() {}
|
||||
|
||||
/**
|
||||
* Called when a block is damaged by a player.
|
||||
* <p />
|
||||
* If a Block Damage event is cancelled, the block will not be damaged.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockDamage(BlockDamageEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when we try to place a block, to see if we can build it here or not.
|
||||
* <p />
|
||||
* Note:
|
||||
* <ul>
|
||||
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
||||
* <li>If you want to figure out what is being placed, use {@link BlockCanBuildEvent#getMaterial()} or {@link BlockCanBuildEvent#getMaterialId()} instead.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockCanBuild(BlockCanBuildEvent event) {}
|
||||
|
||||
/**
|
||||
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
|
||||
* <p />
|
||||
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockFromTo(BlockFromToEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
||||
* <p />
|
||||
* If a Block Ignite event is cancelled, the block will not be ignited.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when block physics occurs.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is placed by a player.
|
||||
* <p />
|
||||
* If a Block Place event is cancelled, the block will not be placed.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPlace(BlockPlaceEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when redstone changes.<br />
|
||||
* From: the source of the redstone change.<br />
|
||||
* To: The redstone dust that changed.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockRedstoneChange(BlockRedstoneEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when leaves are decaying naturally.
|
||||
* <p />
|
||||
* If a Leaves Decay event is cancelled, the leaves will not decay.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a sign is changed by a player.
|
||||
* <p />
|
||||
* If a Sign Change event is cancelled, the sign will not be changed.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onSignChange(SignChangeEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is destroyed as a result of being burnt by fire.
|
||||
* <p />
|
||||
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBurn(BlockBurnEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is broken by a player.
|
||||
* <p />
|
||||
* Note:
|
||||
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining
|
||||
* what the default drop for the block being broken is and what to do about it, if anything.
|
||||
* <p />
|
||||
* If a Block Break event is cancelled, the block will not break.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBreak(BlockBreakEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is formed or spreads based on world conditions.
|
||||
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
||||
* <p />
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Snow forming due to a snow storm.</li>
|
||||
* <li>Ice forming in a snowy Biome like Tiga or Tundra.</li>
|
||||
* </ul>
|
||||
* <p />
|
||||
* If a Block Form event is cancelled, the block will not be formed or will not spread.
|
||||
*
|
||||
* @see BlockSpreadEvent
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockForm(BlockFormEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block spreads based on world conditions.
|
||||
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
||||
* <p />
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Mushrooms spreading.</li>
|
||||
* <li>Fire spreading.</li>
|
||||
* </ul>
|
||||
* <p />
|
||||
* If a Block Spread event is cancelled, the block will not spread.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockSpread(BlockSpreadEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block fades, melts or disappears based on world conditions
|
||||
* <p />
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Snow melting due to being near a light source.</li>
|
||||
* <li>Ice melting due to being near a light source.</li>
|
||||
* </ul>
|
||||
* <p />
|
||||
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockFade(BlockFadeEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an item is dispensed from a block.
|
||||
* <p />
|
||||
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockDispense(BlockDispenseEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a piston retracts
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a piston extends
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
|
||||
public BlockPhysicsEvent(final Block block, final int changed) {
|
||||
super(Type.BLOCK_PHYSICS, block);
|
||||
super(block);
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import org.bukkit.event.Cancellable;
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BlockPistonEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private BlockFace direction;
|
||||
private final BlockFace direction;
|
||||
|
||||
public BlockPistonEvent(Type type, Block block, BlockFace direction) {
|
||||
super(type, block);
|
||||
public BlockPistonEvent(final Block block, final BlockFace direction) {
|
||||
super(block);
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import org.bukkit.event.HandlerList;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int length;
|
||||
private final int length;
|
||||
private List<Block> blocks;
|
||||
|
||||
public BlockPistonExtendEvent(Block block, int length, BlockFace direction) {
|
||||
super(Type.BLOCK_PISTON_EXTEND, block, direction);
|
||||
public BlockPistonExtendEvent(final Block block, final int length, final BlockFace direction) {
|
||||
super(block, direction);
|
||||
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.event.HandlerList;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public BlockPistonRetractEvent(Block block, BlockFace direction) {
|
||||
super(Type.BLOCK_PISTON_RETRACT, block, direction);
|
||||
public BlockPistonRetractEvent(final Block block, final BlockFace direction) {
|
||||
super(block, direction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,8 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
protected ItemStack itemInHand;
|
||||
protected Player player;
|
||||
|
||||
public BlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) {
|
||||
super(Type.BLOCK_PLACE, placedBlock);
|
||||
public BlockPlaceEvent(final Block placedBlock, final BlockState replacedBlockState, final Block placedAgainst, final ItemStack itemInHand, final Player thePlayer, final boolean canBuild) {
|
||||
super(placedBlock);
|
||||
this.placedAgainst = placedAgainst;
|
||||
this.itemInHand = itemInHand;
|
||||
this.player = thePlayer;
|
||||
|
||||
@@ -9,11 +9,11 @@ import org.bukkit.event.HandlerList;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockRedstoneEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int oldCurrent;
|
||||
private final int oldCurrent;
|
||||
private int newCurrent;
|
||||
|
||||
public BlockRedstoneEvent(Block block, int oldCurrent, int newCurrent) {
|
||||
super(Type.REDSTONE_CHANGE, block);
|
||||
public BlockRedstoneEvent(final Block block, final int oldCurrent, final int newCurrent) {
|
||||
super(block);
|
||||
this.oldCurrent = oldCurrent;
|
||||
this.newCurrent = newCurrent;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ import org.bukkit.event.HandlerList;
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockSpreadEvent extends BlockFormEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Block source;
|
||||
private final Block source;
|
||||
|
||||
public BlockSpreadEvent(Block block, Block source, BlockState newState) {
|
||||
super(Type.BLOCK_SPREAD, block, newState);
|
||||
public BlockSpreadEvent(final Block block, final Block source, final BlockState newState) {
|
||||
super(block, newState);
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ import org.bukkit.entity.Entity;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityBlockFormEvent extends BlockFormEvent {
|
||||
private Entity entity;
|
||||
private final Entity entity;
|
||||
|
||||
public EntityBlockFormEvent(Entity entity, Block block, BlockState blockstate) {
|
||||
public EntityBlockFormEvent(final Entity entity, final Block block, final BlockState blockstate) {
|
||||
super(block, blockstate);
|
||||
|
||||
this.entity = entity;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
|
||||
public LeavesDecayEvent(final Block block) {
|
||||
super(Type.LEAVES_DECAY, block);
|
||||
super(block);
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
@@ -14,11 +14,11 @@ import org.bukkit.event.HandlerList;
|
||||
public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Player player;
|
||||
private String[] lines;
|
||||
private final Player player;
|
||||
private final String[] lines;
|
||||
|
||||
public SignChangeEvent(final Block theBlock, final Player thePlayer, String[] theLines) {
|
||||
super(Type.SIGN_CHANGE, theBlock);
|
||||
public SignChangeEvent(final Block theBlock, final Player thePlayer, final String[] theLines) {
|
||||
super(theBlock);
|
||||
this.player = thePlayer;
|
||||
this.lines = theLines;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user