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
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Numberamount()abstract intabstract @Nullable org.bukkit.inventory.ItemStackgetItem()abstract booleanisSameSlot(Slot o) Checks if given slot is in same position with this.@UnknownNullability Stringname()abstract voidsetAmount(int amount) voidThe behaviour for changing this thing's name, if possible.abstract voidsetItem(@Nullable org.bukkit.inventory.ItemStack item) voidThe behaviour for changing this thing's name, if possible.booleanThis is called beforeAnyAmount.setAmount(Number).booleanThis is called beforeAnyNamed.setName(String).final StringtoString()Should returntoString(null, false)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:DebuggableShould returntoString(null, false)- Specified by:
toStringin interfaceDebuggable- Overrides:
toStringin 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:AnyNamedThis is called beforeAnyNamed.setName(String). If the result is false, setting the name will never be attempted.- Specified by:
supportsNameChangein interfaceAnyNamed- Returns:
- Whether this supports being set
-
setName
Description copied from interface:AnyNamedThe 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:AnyAmountThis is called beforeAnyAmount.setAmount(Number). If the result is false, setting the name will never be attempted.- Specified by:
supportsAmountChangein interfaceAnyAmount- Returns:
- Whether this supports being set
-
setAmount
Description copied from interface:AnyAmountThe behaviour for changing this thing's name, if possible. If not possible, thenAnyAmount.supportsAmountChange()should return false and this may throw an error.
-