namespace Minecraft.Server.FourKit.Event.Block; using Minecraft.Server.FourKit.Block; /// /// Called when a piston block is triggered. /// public abstract class BlockPistonEvent : BlockEvent, Cancellable { private bool _cancel; private readonly BlockFace _direction; internal protected BlockPistonEvent(Block block, BlockFace direction) : base(block) { _direction = direction; _cancel = false; } /// public bool isCancelled() => _cancel; /// public void setCancelled(bool cancelled) { _cancel = cancelled; } /// /// Returns true if the Piston in the event is sticky. /// /// Stickiness of the piston. public bool isSticky() { var type = getBlock().getType(); return type == Material.PISTON_STICKY_BASE; } /// /// Return the direction in which the piston will operate. /// /// Direction of the piston. public BlockFace getDirection() => _direction; }