Class ItemIds

java.lang.Object
net.glowstone.constants.ItemIds

public final class ItemIds extends Object
Temporary mappings for Minecraft's string-based item ids.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.Material
    Get the Material corresponding to the specified block identifier.
    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.
    static List<String>
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getName

      public static String getName(org.bukkit.Material type)
      Get the full string identifier for a specified Material.
      Parameters:
      type - the Material.
      Returns:
      the identifier.
    • getKeyName

      public static String getKeyName(org.bukkit.Material mat)
      Get the key segment of the string identifier for a specified Material.
      Parameters:
      mat - the Material.
      Returns:
      the identifier.
    • getItem

      public static org.bukkit.Material getItem(String name)
      Get the Material corresponding to the specified item identifier.
      Parameters:
      name - the identifier.
      Returns:
      the Material, or null.
    • getBlock

      public static org.bukkit.Material getBlock(String name)
      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

      public static Collection<String> 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

      public static List<String> getTabCompletion(String prefix)
      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.