namespace Minecraft.Server.FourKit.Event.Block; using Minecraft.Server.FourKit.Block; using Minecraft.Server.FourKit.Entity; using Minecraft.Server.FourKit.Inventory; /// /// Called when a block is placed by a player. /// public class BlockPlaceEvent : BlockEvent, Cancellable { protected Block placedAgainst; protected ItemStack itemInHand; protected Player player; protected bool canBuild; protected bool cancel; internal BlockPlaceEvent(Block placedBlock, Block placedAgainst, ItemStack itemInHand, Player thePlayer, bool canBuild) : base(placedBlock) { this.placedAgainst = placedAgainst; this.itemInHand = itemInHand; this.player = thePlayer; this.canBuild = canBuild; this.cancel = false; } /// /// Gets the player who placed the block involved in this event. /// /// The Player who placed the block involved in this event. public Player getPlayer() => player; /// /// Clarity method for getting the placed block. Not really needed except /// for reasons of clarity. /// /// The Block that was placed. public Block getBlockPlaced() => getBlock(); /// /// Gets the block that this block was placed against. /// /// Block the block that the new block was placed against. public Block getBlockAgainst() => placedAgainst; /// /// Gets the item in the player's hand when they placed the block. /// /// The ItemStack for the item in the player's hand when they placed the block. public ItemStack getItemInHand() => itemInHand; /// public bool isCancelled() => cancel; /// public void setCancelled(bool cancel) => this.cancel = cancel; }