Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 51 lines 1.3 kB view raw
1package org.bukkit.event.block; 2 3import org.bukkit.block.Block; 4import org.bukkit.block.BlockFace; 5import org.bukkit.event.Cancellable; 6 7/** 8 * Represents events with a source block and a destination block, currently only applies to liquid (lava and water). 9 * <p/> 10 * If a Block From To event is cancelled, the block will not move (the liquid will not flow). 11 */ 12public class BlockFromToEvent extends BlockEvent implements Cancellable { 13 protected Block to; 14 protected BlockFace face; 15 protected boolean cancel; 16 17 public BlockFromToEvent(final Block block, final BlockFace face) { 18 super(Type.BLOCK_FROMTO, block); 19 this.face = face; 20 this.cancel = false; 21 } 22 23 /** 24 * Gets the BlockFace that the block is moving to. 25 * 26 * @return The BlockFace that the block is moving to 27 */ 28 public BlockFace getFace() { 29 return face; 30 } 31 32 /** 33 * Convenience method for getting the faced Block. 34 * 35 * @return The faced Block 36 */ 37 public Block getToBlock() { 38 if (to == null) { 39 to = block.getRelative(face.getModX(), face.getModY(), face.getModZ()); 40 } 41 return to; 42 } 43 44 public boolean isCancelled() { 45 return cancel; 46 } 47 48 public void setCancelled(boolean cancel) { 49 this.cancel = cancel; 50 } 51}