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

public abstract class Slot extends Object implements Debuggable, AnyNamed, AnyAmount
Represents a container for a single item. It could be an ordinary inventory slot or perhaps an item frame.
  • 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

      public final String toString()
      Description copied from interface: Debuggable
      Should return toString(null, false)
      Specified by:
      toString in interface Debuggable
      Overrides:
      toString in class Object
    • isSameSlot

      public abstract boolean isSameSlot(Slot o)
      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

      public @UnknownNullability String name()
      Specified by:
      name in interface AnyNamed
      Returns:
      The name of the item in this slot
    • supportsNameChange

      public boolean supportsNameChange()
      Description copied from interface: AnyNamed
      This is called before AnyNamed.setName(String). If the result is false, setting the name will never be attempted.
      Specified by:
      supportsNameChange in interface AnyNamed
      Returns:
      Whether this supports being set
    • setName

      public void setName(String name)
      Description copied from interface: AnyNamed
      The behaviour for changing this thing's name, if possible. If not possible, then AnyNamed.supportsNameChange() should return false and this may throw an error.
      Specified by:
      setName in interface AnyNamed
      Parameters:
      name - The name to change
    • amount

      @NotNull public @NotNull Number amount()
      Specified by:
      amount in interface AnyAmount
      Returns:
      This thing's amount/size
    • supportsAmountChange

      public boolean supportsAmountChange()
      Description copied from interface: AnyAmount
      This is called before AnyAmount.setAmount(Number). If the result is false, setting the name will never be attempted.
      Specified by:
      supportsAmountChange in interface AnyAmount
      Returns:
      Whether this supports being set
    • setAmount

      public void setAmount(@Nullable @Nullable Number amount)
      Description copied from interface: AnyAmount
      The behaviour for changing this thing's name, if possible. If not possible, then AnyAmount.supportsAmountChange() should return false and this may throw an error.
      Specified by:
      setAmount in interface AnyAmount
      Parameters:
      amount - The name to change