namespace Minecraft.Server.FourKit.Event.Block; using Minecraft.Server.FourKit.Block; /// /// Represents events with a source block and a destination block, currently /// only applies to liquid (lava and water) and teleporting dragon eggs. /// /// If a Block From To event is cancelled, the block will not move /// (the liquid will not flow). /// public class BlockFromToEvent : BlockEvent, Cancellable { private readonly Block _to; private readonly BlockFace _face; private bool _cancel; internal BlockFromToEvent(Block block, BlockFace face) : base(block) { _face = face; _to = block.getRelative(face); _cancel = false; } internal BlockFromToEvent(Block block, Block toBlock) : base(block) { _to = toBlock; _face = BlockFace.SELF; _cancel = false; } internal BlockFromToEvent(Block block, Block toBlock, BlockFace face) : base(block) { _to = toBlock; _face = face; _cancel = false; } /// /// Gets the BlockFace that the block is moving to. /// /// The BlockFace that the block is moving to. public BlockFace getFace() => _face; /// /// Convenience method for getting the faced Block. /// /// The faced Block. public Block getToBlock() => _to; /// public bool isCancelled() => _cancel; /// public void setCancelled(bool cancel) { _cancel = cancel; } }