Package ch.njol.skript.lang.util.common
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.
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 Summary
Modifier and TypeMethodDescription@NotNull Number
amount()
default boolean
isEmpty()
default void
The behaviour for changing this thing's name, if possible.default boolean
This is called beforesetAmount(Number)
.
-
Method Details
-
amount
- Returns:
- This thing's amount/size
-
supportsAmountChange
default boolean supportsAmountChange()This is called beforesetAmount(Number)
. If the result is false, setting the name will never be attempted.- Returns:
- Whether this supports being set
-
setAmount
The behaviour for changing this thing's name, if possible. If not possible, thensupportsAmountChange()
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
-