Package com.winterhavenmc.lodestar.util
Class LodeStarUtility
java.lang.Object
com.winterhavenmc.lodestar.util.LodeStarUtility
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLodeStarUtility(org.bukkit.plugin.Plugin plugin, com.winterhavenmc.library.messagebuilder.MessageBuilder messageBuilder, ConnectionProvider datastore) Class constructor -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStackCreate a SpawnStar item stack of given quantity, with custom display name and lorebooleandestinationExists(String key) getDestination(String destinationName) getDestination(org.bukkit.inventory.ItemStack itemStack) getDestinationKey(org.bukkit.inventory.ItemStack itemStack) Get destination key encoded in item persistent meta datagetDisplayName(String key) Get display name from keybooleanisDefaultMaterial(org.bukkit.inventory.ItemStack itemStack) booleanbooleanisRerservedName(String destinationName) booleanisSpawnKey(String key) com.winterhavenmc.library.messagebuilder.models.language.ItemRecorditemRecord(String key) voidsetItemMetadata(org.bukkit.inventory.ItemStack itemStack, String destinationName) voidsetPersistentDestination(org.bukkit.inventory.ItemStack itemStack, String destinationName)
-
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 classmessageBuilder- instance of message builder librarydatastore- instance of datastore
-
-
Method Details
-
create
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
Get display name from key- Parameters:
key- the destination key for which to retrive the display name- Returns:
- the destination display name
-
homeDisplayName
-
spawnDisplayName
-
isRerservedName
-
isHomeKey
-
isSpawnKey
-
isDefaultMaterial
public boolean isDefaultMaterial(org.bukkit.inventory.ItemStack itemStack) -
destinationExists
-
getDestination
-
getDestination
-
getDestinationKey
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
-
itemRecord
-
setItemMetadata
-