namespace Minecraft.Server.FourKit.Event.Inventory; using Minecraft.Server.FourKit.Entity; using Minecraft.Server.FourKit.Inventory; /// /// Called when a player opens an inventory. Cancelling this event will prevent /// the inventory screen from showing. /// public class InventoryOpenEvent : InventoryEvent, Cancellable { private bool _cancelled; internal InventoryOpenEvent(InventoryView transaction) : base(transaction) { } /// /// Returns the player involved in this event. /// /// Player who is involved in this event. public HumanEntity getPlayer() => transaction.getPlayer(); /// /// Gets the cancellation state of this event. A cancelled event will not /// be executed in the server, but will still pass to other plugins. /// If an inventory open event is cancelled, the inventory screen will not show. /// /// true if this event is cancelled. public bool isCancelled() => _cancelled; /// /// Sets the cancellation state of this event. A cancelled event will not /// be executed in the server, but will still pass to other plugins. /// If an inventory open event is cancelled, the inventory screen will not show. /// /// true if you wish to cancel this event. public void setCancelled(bool cancel) => _cancelled = cancel; }