MinecraftConsoles/Minecraft.Server.FourKit/Event/Inventory/InventoryInteractEvent.cs

41 lines
1.4 KiB
C#

namespace Minecraft.Server.FourKit.Event.Inventory;
using Minecraft.Server.FourKit.Entity;
using Minecraft.Server.FourKit.Inventory;
/// <summary>
/// An abstract base class for events that describe an interaction between a
/// <see cref="HumanEntity"/> and the contents of an <see cref="Inventory"/>.
/// This is currently not emitted anywhere, use <see cref="InventoryClickEvent"/> instead.
/// </summary>
public abstract class InventoryInteractEvent : InventoryEvent, Cancellable
{
private bool _cancelled;
internal protected InventoryInteractEvent(InventoryView transaction) : base(transaction)
{
}
/// <summary>
/// Gets the player who performed the click.
/// </summary>
/// <returns>The clicking player.</returns>
public HumanEntity getWhoClicked()
{
return transaction.getPlayer();
}
/// <summary>
/// Gets the cancellation state of this event. A cancelled event will not
/// be executed in the server, but will still pass to other plugins.
/// </summary>
/// <returns>true if this event is cancelled.</returns>
public bool isCancelled() => _cancelled;
/// <summary>
/// Sets the cancellation state of this event. A cancelled event will not
/// be executed in the server, but will still pass to other plugins.
/// </summary>
/// <param name="cancel">true if you wish to cancel this event.</param>
public void setCancelled(bool cancel) => _cancelled = cancel;
}