Class BoxStickItem

java.lang.Object
net.okocraft.box.feature.stick.item.BoxStickItem

public final class BoxStickItem extends Object
A record to hold a key representing that the item is a Box Stick and provide methods to check if the ItemStack is Box Item.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoxStickItem(@NotNull org.bukkit.NamespacedKey key)
    The constructor of BoxStickItem.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(@NotNull org.bukkit.inventory.ItemStack itemStack)
    Checks if the ItemStack is a Box Stick.
    boolean
     
    int
     
    @NotNull org.bukkit.NamespacedKey
    key()
    Gets the NamespacedKey that is used for saving data to PersistentDataContainer.
    void
    onRightClick(@NotNull Consumer<org.bukkit.entity.Player> onRightClick)
    Sets the action called when the Player right-clicked.
    void
    onRightClick(@NotNull org.bukkit.entity.Player player)
    Calls the action of right-click
    void
    saveBoxStickKey(@NotNull org.bukkit.persistence.PersistentDataContainer target)
    Saves the key() to PersistentDataContainer
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BoxStickItem

      @Internal public BoxStickItem(@NotNull @NotNull org.bukkit.NamespacedKey key)
      The constructor of BoxStickItem.
      Parameters:
      key - the NamespacedKey to use for representing that the item is a Box Stick
  • Method Details

    • saveBoxStickKey

      public void saveBoxStickKey(@NotNull @NotNull org.bukkit.persistence.PersistentDataContainer target)
      Saves the key() to PersistentDataContainer
      Parameters:
      target - the target PersistentDataContainer
    • check

      public boolean check(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Checks if the ItemStack is a Box Stick.
      Parameters:
      itemStack - the ItemStack to check
      Returns:
      if the ItemStack has key() in PersistentDataContainer, returns true, otherwise false
    • key

      @NotNull public @NotNull org.bukkit.NamespacedKey key()
      Gets the NamespacedKey that is used for saving data to PersistentDataContainer.
      Returns:
      the NamespacedKey that is used for saving data to PersistentDataContainer
    • onRightClick

      public void onRightClick(@NotNull @NotNull Consumer<org.bukkit.entity.Player> onRightClick)
      Sets the action called when the Player right-clicked.
      Parameters:
      onRightClick - the action on right-click
    • onRightClick

      public void onRightClick(@NotNull @NotNull org.bukkit.entity.Player player)
      Calls the action of right-click
      Parameters:
      player - the Player who clicked
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object