MinecraftConsoles/Minecraft.Server.FourKit/Event/Player/PlayerPickupItemEvent.cs
sylvessa f5f9aa1cf5 finish rewrite; port to cmake, loads of other changes
Theres documentation at https://sylvessa.zip/fourkit/ now. And a bunch of other changes. Check the discord server for a more comprehensive list
2026-03-21 14:01:49 -05:00

42 lines
1.1 KiB
C#

namespace Minecraft.Server.FourKit.Event.Player;
using Minecraft.Server.FourKit.Entity;
/// <summary>
/// Thrown when a player picks an item up from the ground.
/// If cancelled the item will not be picked up.
/// </summary>
public class PlayerPickupItemEvent : PlayerEvent, Cancellable
{
private readonly Item _item;
private readonly int _remaining;
private bool _cancelled;
internal PlayerPickupItemEvent(Player player, Item item, int remaining)
: base(player)
{
_item = item;
_remaining = remaining;
}
/// <summary>
/// Gets the Item picked up by the player.
/// </summary>
/// <returns>The <see cref="Item"/> entity.</returns>
public Item getItem() => _item;
/// <summary>
/// Gets the amount remaining on the ground, if any.
/// </summary>
/// <returns>Amount remaining on the ground.</returns>
public int getRemaining() => _remaining;
/// <inheritdoc/>
public bool isCancelled() => _cancelled;
/// <inheritdoc/>
public void setCancelled(bool cancel)
{
_cancelled = cancel;
}
}