Package net.glowstone.constants
Class ItemIds
java.lang.Object
net.glowstone.constants.ItemIds
Temporary mappings for Minecraft's string-based item ids.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.Material
Get the Material corresponding to the specified block identifier.static Collection<String>
getIds()
Gets a copy of the list of registered item IDs, in their name-spaced form.static org.bukkit.Material
Get the Material corresponding to the specified item identifier.static String
getKeyName
(org.bukkit.Material mat) Get the key segment of the string identifier for a specified Material.static String
getName
(org.bukkit.Material type) Get the full string identifier for a specified Material.getTabCompletion
(String prefix) Generates a list of possible tab-completion item ID entries for a given prefix.static boolean
isValidItem
(org.bukkit.Material material) Verify that a given material is a valid item.static org.bukkit.inventory.ItemStack
sanitize
(org.bukkit.inventory.ItemStack stack) Convert an ItemStack which may have a type that is unrepresentable as an item to one that does, or to an empty stack if this is not possible.
-
Method Details
-
getName
Get the full string identifier for a specified Material.- Parameters:
type
- the Material.- Returns:
- the identifier.
-
getKeyName
Get the key segment of the string identifier for a specified Material.- Parameters:
mat
- the Material.- Returns:
- the identifier.
-
getItem
Get the Material corresponding to the specified item identifier.- Parameters:
name
- the identifier.- Returns:
- the Material, or null.
-
getBlock
Get the Material corresponding to the specified block identifier.- Parameters:
name
- the identifier.- Returns:
- the Material, or null.
-
isValidItem
public static boolean isValidItem(org.bukkit.Material material) Verify that a given material is a valid item. All non-blocks are valid items, but some blocks cannot be represented as items.- Parameters:
material
- The material to verify.- Returns:
- true if the material is a valid item.
-
sanitize
public static org.bukkit.inventory.ItemStack sanitize(org.bukkit.inventory.ItemStack stack) Convert an ItemStack which may have a type that is unrepresentable as an item to one that does, or to an empty stack if this is not possible.- Parameters:
stack
- The stack to sanitize.- Returns:
- The sanitized stack, or null.
-
getIds
Gets a copy of the list of registered item IDs, in their name-spaced form.- Returns:
- a copy of the list of registered item IDs.
-
getTabCompletion
Generates a list of possible tab-completion item ID entries for a given prefix.- Parameters:
prefix
- the item ID prefix.- Returns:
- a list of tab-completed item ID entries.
-