Class TreasureKey
java.lang.Object
com.Moshu.TreasureHunt.Components.TreasureKey
Represents a treasure key that can be used to unlock treasures.
This class manages the configuration and validation of treasure keys,
supporting various item types including vanilla items, custom items from
ItemsAdder, Oraxen, Nexo, and MMOItems.
-
Constructor Summary
ConstructorsConstructorDescriptionTreasureKey
(boolean enabled, String itemStr, String name, List<String> lore) Creates a new treasure key with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.Material
getItem()
org.bukkit.inventory.ItemStack
getItemStack
(int amount) getLore()
getName()
static boolean
isKey
(org.bukkit.inventory.ItemStack apparentKey) boolean
Checks if this key is an MMOItems item.boolean
isTreasureKey
(org.bukkit.inventory.ItemStack apparentKey) boolean
Checks if a key is required to open the treasure.void
setEnabled
(boolean enabled) void
setItem
(org.bukkit.Material item) void
setItemString
(String item) void
void
-
Constructor Details
-
TreasureKey
Creates a new treasure key with the specified configuration.- Parameters:
enabled
- Whether the key requirement is enableditemStr
- The item identifier stringname
- The display name of the keylore
- The lore text for the key
-
-
Method Details
-
requiresKey
public boolean requiresKey()Checks if a key is required to open the treasure.- Returns:
- True if a key is required, false otherwise
-
setEnabled
public void setEnabled(boolean enabled) -
getItem
public org.bukkit.Material getItem() -
setItem
public void setItem(org.bukkit.Material item) -
getName
-
setName
-
getLore
-
setLore
-
getItemId
-
setItemString
-
isMMOItem
public boolean isMMOItem()Checks if this key is an MMOItems item.- Returns:
- True if it's an MMOItems item, false otherwise
-
getItemStack
public org.bukkit.inventory.ItemStack getItemStack(int amount) -
isTreasureKey
public boolean isTreasureKey(org.bukkit.inventory.ItemStack apparentKey) -
isKey
public static boolean isKey(org.bukkit.inventory.ItemStack apparentKey)
-