Interface AnyAmount

All Superinterfaces:
AnyProvider
All Known Implementing Classes:
CursorSlot, DisplayEntitySlot, DroppedItemSlot, EquipmentSlot, InventorySlot, ItemFrameSlot, ItemType, SkriptQueue, Slot, SlotWithIndex, ThrowableProjectileSlot
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AnyAmount extends AnyProvider
A provider for anything with a (number) amount/size. Anything implementing this (or convertible to this) can be used by the ExprAmount property expression.
See Also:
  • Method Details

    • amount

      @NotNull @NotNull Number amount()
      Returns:
      This thing's amount/size
    • supportsAmountChange

      default boolean supportsAmountChange()
      This is called before setAmount(Number). If the result is false, setting the name will never be attempted.
      Returns:
      Whether this supports being set
    • setAmount

      default void setAmount(Number amount) throws UnsupportedOperationException
      The behaviour for changing this thing's name, if possible. If not possible, then supportsAmountChange() should return false and this may throw an error.
      Parameters:
      amount - The name to change
      Throws:
      UnsupportedOperationException - If this is impossible
    • isEmpty

      default boolean isEmpty()
      Returns:
      Whether the amount of this is zero, i.e. empty