Class LodeStarUtility

java.lang.Object
com.winterhavenmc.lodestar.util.LodeStarUtility

public final class LodeStarUtility extends Object
Utility class for creating and testing SpawnStar item stacks

A loadstar item has two persistent data objects: 1) namespaced key "ITEM_KEY" contains the item key string, corresponding to the item definition in the language file 2) namespaced key "DESTINATION" contains the item destination name, whether spawn, home or stored destination

  • Field Details

    • HOME_KEY

      public static final com.winterhavenmc.library.messagebuilder.models.keys.ValidConstantKey HOME_KEY
    • SPAWN_KEY

      public static final com.winterhavenmc.library.messagebuilder.models.keys.ValidConstantKey SPAWN_KEY
  • Constructor Details

    • LodeStarUtility

      public LodeStarUtility(org.bukkit.plugin.Plugin plugin, com.winterhavenmc.library.messagebuilder.MessageBuilder messageBuilder, ConnectionProvider datastore)
      Class constructor
      Parameters:
      plugin - instance of plugin main class
      messageBuilder - instance of message builder library
      datastore - instance of datastore
  • Method Details

    • create

      public org.bukkit.inventory.ItemStack create(int passedQuantity, String destinationName)
      Create a SpawnStar item stack of given quantity, with custom display name and lore
      Parameters:
      passedQuantity - number of SpawnStar items in newly created stack
      Returns:
      ItemStack of SpawnStar items
    • setPersistentDestination

      public void setPersistentDestination(org.bukkit.inventory.ItemStack itemStack, String destinationName)
    • getDisplayName

      public Optional<String> getDisplayName(String key)
      Get display name from key
      Parameters:
      key - the destination key for which to retrive the display name
      Returns:
      the destination display name
    • homeDisplayName

      public String homeDisplayName()
    • spawnDisplayName

      public String spawnDisplayName()
    • isRerservedName

      public boolean isRerservedName(String destinationName)
    • isHomeKey

      public boolean isHomeKey(String key)
    • isSpawnKey

      public boolean isSpawnKey(String key)
    • isDefaultMaterial

      public boolean isDefaultMaterial(org.bukkit.inventory.ItemStack itemStack)
    • destinationExists

      public boolean destinationExists(String key)
    • getDestination

      public Destination getDestination(String destinationName)
    • getDestination

      public Destination getDestination(org.bukkit.inventory.ItemStack itemStack)
    • getDestinationKey

      public String getDestinationKey(org.bukkit.inventory.ItemStack itemStack)
      Get destination key encoded in item persistent meta data
      Parameters:
      itemStack - the item stack from which to retrieve stored key
      Returns:
      String - destination key, or null if item does not have key in persistent metadata
    • deriveKey

      public String deriveKey(List<String> args)
    • itemRecord

      public com.winterhavenmc.library.messagebuilder.models.language.ItemRecord itemRecord(String key)
    • setItemMetadata

      public void setItemMetadata(org.bukkit.inventory.ItemStack itemStack, String destinationName)