Class PylonItem
-
- All Implemented Interfaces:
-
net.kyori.adventure.key.Keyed,org.bukkit.Keyed
public class PylonItem implements Keyed
PylonItems are wrappers around ItemStacks that allow you to easily add extra functionality.
Unlike PylonBlock and PylonEntity, PylonItem isn't persisted in memory, so you should avoid storing any fields in your PylonItem classes. Instead, use the stack's PersistentDataContainer to store data persistently.
An implementation of PylonItem must have a constructor that takes an ItemStack as its only parameter. This will be used to load an in-world ItemStack as this particular PylonItem class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPylonItem.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static PylonItem.CompanionCompanion
-
Method Summary
Modifier and Type Method Description final ItemStackgetStack()final PylonItemSchemagetSchema()Additional data about the item's type. final StringgetResearchBypassPermission()final PylonAddongetAddon()final NamespacedKeygetPylonBlock()final BooleanisDisabled()final ResearchgetResearch()final ConfiggetSettings()Returns settings associated with the item. Booleanequals(Object other)IntegerhashCode()NamespacedKeygetKey()List<PylonArgument>getPlaceholders()Returns the list of placeholders to be substituted into the item's lore. PylonBlockplace(BlockCreateContext context)Places the block associated with this item, if it exists. final static voidregister(Class<out PylonItem> itemClass, ItemStack template, NamespacedKey pylonBlockKey)final static voidregister(Class<out PylonItem> itemClass, ItemStack template)final static PylonItemfromStack(ItemStack stack)Converts a regular ItemStack to a PylonItemStack Returns null if the ItemStack is not a Pylon item final static BooleanisPylonItem(ItemStack stack)Checks if stack is a Pylon item. final static voidsuppressNameWarnings(NamespacedKey key)Suppresses warnings about missing/incorrect translation keys for the item name and lore for the given item key final static ConfiggetSettings(NamespacedKey key)-
-
Constructor Detail
-
PylonItem
PylonItem(ItemStack stack)
-
-
Method Detail
-
getSchema
final PylonItemSchema getSchema()
Additional data about the item's type.
-
getResearchBypassPermission
final String getResearchBypassPermission()
-
getAddon
final PylonAddon getAddon()
-
getPylonBlock
final NamespacedKey getPylonBlock()
-
isDisabled
final Boolean isDisabled()
-
getResearch
final Research getResearch()
-
getSettings
final Config getSettings()
Returns settings associated with the item.
Shorthand for
Settings.get(getKey())
-
getKey
NamespacedKey getKey()
-
getPlaceholders
List<PylonArgument> getPlaceholders()
Returns the list of placeholders to be substituted into the item's lore.
Each placeholder is written as
%placeholder_name%in the lore.
-
place
PylonBlock place(BlockCreateContext context)
Places the block associated with this item, if it exists.
-
register
@JvmOverloads() final static void register(Class<out PylonItem> itemClass, ItemStack template, NamespacedKey pylonBlockKey)
-
register
@JvmOverloads() final static void register(Class<out PylonItem> itemClass, ItemStack template)
-
fromStack
@Contract(value = "null -> null") final static PylonItem fromStack(ItemStack stack)
Converts a regular ItemStack to a PylonItemStack Returns null if the ItemStack is not a Pylon item
-
isPylonItem
@Contract(value = "null -> false") final static Boolean isPylonItem(ItemStack stack)
Checks if stack is a Pylon item.
-
suppressNameWarnings
final static void suppressNameWarnings(NamespacedKey key)
Suppresses warnings about missing/incorrect translation keys for the item name and lore for the given item key
-
getSettings
final static Config getSettings(NamespacedKey key)
-
-
-
-