Package ch.njol.skript.util.slot
Class Slot
java.lang.Object
ch.njol.skript.util.slot.Slot
- All Implemented Interfaces:
Debuggable
,AnyAmount
,AnyNamed
,AnyProvider
- Direct Known Subclasses:
CursorSlot
,DisplayEntitySlot
,DroppedItemSlot
,ItemFrameSlot
,SlotWithIndex
,ThrowableProjectileSlot
Represents a container for a single item. It could be an ordinary inventory
slot or perhaps an item frame.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Number
amount()
abstract int
abstract @Nullable org.bukkit.inventory.ItemStack
getItem()
abstract boolean
isSameSlot
(Slot o) Checks if given slot is in same position with this.@UnknownNullability String
name()
abstract void
setAmount
(int amount) void
The behaviour for changing this thing's name, if possible.abstract void
setItem
(@Nullable org.bukkit.inventory.ItemStack item) void
The behaviour for changing this thing's name, if possible.boolean
This is called beforeAnyAmount.setAmount(Number)
.boolean
This is called beforeAnyNamed.setName(String)
.final String
toString()
Should returntoString
(null, false)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.njol.skript.lang.Debuggable
toString
-
Constructor Details
-
Slot
protected Slot()
-
-
Method Details
-
getItem
@Nullable public abstract @Nullable org.bukkit.inventory.ItemStack getItem() -
setItem
public abstract void setItem(@Nullable @Nullable org.bukkit.inventory.ItemStack item) -
getAmount
public abstract int getAmount() -
setAmount
public abstract void setAmount(int amount) -
toString
Description copied from interface:Debuggable
Should returntoString
(null, false)- Specified by:
toString
in interfaceDebuggable
- Overrides:
toString
in classObject
-
isSameSlot
Checks if given slot is in same position with this. Ignores slot contents.- Parameters:
o
- Another slot- Returns:
- True if positions equal, false otherwise.
-
name
-
supportsNameChange
public boolean supportsNameChange()Description copied from interface:AnyNamed
This is called beforeAnyNamed.setName(String)
. If the result is false, setting the name will never be attempted.- Specified by:
supportsNameChange
in interfaceAnyNamed
- Returns:
- Whether this supports being set
-
setName
Description copied from interface:AnyNamed
The behaviour for changing this thing's name, if possible. If not possible, thenAnyNamed.supportsNameChange()
should return false and this may throw an error. -
amount
-
supportsAmountChange
public boolean supportsAmountChange()Description copied from interface:AnyAmount
This is called beforeAnyAmount.setAmount(Number)
. If the result is false, setting the name will never be attempted.- Specified by:
supportsAmountChange
in interfaceAnyAmount
- Returns:
- Whether this supports being set
-
setAmount
Description copied from interface:AnyAmount
The behaviour for changing this thing's name, if possible. If not possible, thenAnyAmount.supportsAmountChange()
should return false and this may throw an error.
-