Class TreasureKey

java.lang.Object
com.Moshu.TreasureHunt.Components.TreasureKey

public class TreasureKey extends Object
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 Details

    • TreasureKey

      public TreasureKey(boolean enabled, String itemStr, String name, List<String> lore)
      Creates a new treasure key with the specified configuration.
      Parameters:
      enabled - Whether the key requirement is enabled
      itemStr - The item identifier string
      name - The display name of the key
      lore - 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

      public String getName()
    • setName

      public void setName(String name)
    • getLore

      public List<String> getLore()
    • setLore

      public void setLore(List<String> lore)
    • getItemId

      public String getItemId()
    • setItemString

      public void setItemString(String item)
    • 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)