Class BoxStickItem
java.lang.Object
net.okocraft.box.feature.stick.item.BoxStickItem
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
ConstructorsConstructorDescriptionBoxStickItem
(@NotNull org.bukkit.NamespacedKey key) The constructor ofBoxStickItem
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
check
(@NotNull org.bukkit.inventory.ItemStack itemStack) Checks if theItemStack
is a Box Stick.boolean
int
hashCode()
@NotNull org.bukkit.NamespacedKey
key()
Gets theNamespacedKey
that is used for saving data toPersistentDataContainer
.void
onRightClick
(@NotNull Consumer<org.bukkit.entity.Player> onRightClick) Sets the action called when thePlayer
right-clicked.void
onRightClick
(@NotNull org.bukkit.entity.Player player) Calls the action of right-clickvoid
saveBoxStickKey
(@NotNull org.bukkit.persistence.PersistentDataContainer target) Saves thekey()
toPersistentDataContainer
toString()
-
Constructor Details
-
BoxStickItem
@Internal public BoxStickItem(@NotNull @NotNull org.bukkit.NamespacedKey key) The constructor ofBoxStickItem
.- Parameters:
key
- theNamespacedKey
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 thekey()
toPersistentDataContainer
- Parameters:
target
- the targetPersistentDataContainer
-
check
public boolean check(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Checks if theItemStack
is a Box Stick.- Parameters:
itemStack
- theItemStack
to check- Returns:
- if the
ItemStack
haskey()
inPersistentDataContainer
, returnstrue
, otherwisefalse
-
key
@NotNull public @NotNull org.bukkit.NamespacedKey key()Gets theNamespacedKey
that is used for saving data toPersistentDataContainer
.- Returns:
- the
NamespacedKey
that is used for saving data toPersistentDataContainer
-
onRightClick
Sets the action called when thePlayer
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
- thePlayer
who clicked
-
equals
-
hashCode
public int hashCode() -
toString
-