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 TypeMethodDescriptionbooleancheck(@NotNull org.bukkit.inventory.ItemStack itemStack) Checks if theItemStackis a Box Stick.booleaninthashCode()@NotNull org.bukkit.NamespacedKeykey()Gets theNamespacedKeythat is used for saving data toPersistentDataContainer.voidonRightClick(@NotNull Consumer<org.bukkit.entity.Player> onRightClick) Sets the action called when thePlayerright-clicked.voidonRightClick(@NotNull org.bukkit.entity.Player player) Calls the action of right-clickvoidsaveBoxStickKey(@NotNull org.bukkit.persistence.PersistentDataContainer target) Saves thekey()toPersistentDataContainertoString()
-
Constructor Details
-
BoxStickItem
@Internal public BoxStickItem(@NotNull @NotNull org.bukkit.NamespacedKey key) The constructor ofBoxStickItem.- Parameters:
key- theNamespacedKeyto 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 theItemStackis a Box Stick.- Parameters:
itemStack- theItemStackto check- Returns:
- if the
ItemStackhaskey()inPersistentDataContainer, returnstrue, otherwisefalse
-
key
@NotNull public @NotNull org.bukkit.NamespacedKey key()Gets theNamespacedKeythat is used for saving data toPersistentDataContainer.- Returns:
- the
NamespacedKeythat is used for saving data toPersistentDataContainer
-
onRightClick
Sets the action called when thePlayerright-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- thePlayerwho clicked
-
equals
-
hashCode
public int hashCode() -
toString
-