com.amoebaman.kitmaster.handlers
Class InventoryUtil

java.lang.Object
  extended by com.amoebaman.kitmaster.handlers.InventoryUtil

public class InventoryUtil
extends java.lang.Object


Nested Class Summary
static class InventoryUtil.Armor
          Represents a piece of armor,
static class InventoryUtil.EnchantmentWithLevel
          Stores both the type and level of an enchantment.
static class InventoryUtil.Weapon
          Represents a weapon
 
Field Summary
static java.util.HashMap<org.bukkit.Material,InventoryUtil.Armor> armor
          Stores the Armor that corresponds to each Material.
static java.util.HashMap<org.bukkit.Material,InventoryUtil.Weapon> weapons
          Stores the Weapon that corresponds to each Material.
 
Constructor Summary
InventoryUtil()
           
 
Method Summary
static void addItemsToInventory(org.bukkit.entity.Player player, java.util.List<org.bukkit.inventory.ItemStack> items)
          Adds a list of ItemStack to a player's inventory.
static void addItemToInventory(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack stack)
          Adds an ItemStack to a player's inventory.
static java.lang.String effectToString(org.bukkit.potion.PotionEffect effect)
          Gets a user-friendly String that represents an PotionEffect.
static org.bukkit.potion.PotionEffectType getEffectByCommonName(java.lang.String name)
          Gets a PotionEffectType by it's more common name.
static org.bukkit.enchantments.Enchantment getEnchantmentByCommonName(java.lang.String name)
          Gets an Enchantment by it's more common name.
static org.bukkit.Material getMat(java.lang.String name)
          Gets a material by its enumerated name, common name, or type ID.
static boolean isInt(java.lang.String str)
          Tests whether a String can be safely interpreted as an int.
static java.lang.String itemToString(org.bukkit.inventory.ItemStack stack)
          Gets a user-friendly String that represents an ItemStack.
static org.bukkit.potion.PotionEffect parseEffect(java.lang.String str)
          Parses a PotionEffect from a String.
static InventoryUtil.EnchantmentWithLevel parseEnchantment(java.lang.String str)
          Parses an EnchantmentWithLevel from a String.
static org.bukkit.inventory.ItemStack parseItem(java.lang.String str)
          Parses an ItemStack from a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

armor

public static final java.util.HashMap<org.bukkit.Material,InventoryUtil.Armor> armor
Stores the Armor that corresponds to each Material.


weapons

public static final java.util.HashMap<org.bukkit.Material,InventoryUtil.Weapon> weapons
Stores the Weapon that corresponds to each Material.

Constructor Detail

InventoryUtil

public InventoryUtil()
Method Detail

getEnchantmentByCommonName

public static org.bukkit.enchantments.Enchantment getEnchantmentByCommonName(java.lang.String name)
Gets an Enchantment by it's more common name.

Parameters:
name - The common name of the desired enchantment.
Returns:
The enchantment whose common name matches the given name.

getEffectByCommonName

public static org.bukkit.potion.PotionEffectType getEffectByCommonName(java.lang.String name)
Gets a PotionEffectType by it's more common name.

Parameters:
name - The common name of the desired effect.
Returns:
The effect whose common name matches the given name.

addItemsToInventory

public static void addItemsToInventory(org.bukkit.entity.Player player,
                                       java.util.List<org.bukkit.inventory.ItemStack> items)
Adds a list of ItemStack to a player's inventory.

Parameters:
player - The player to give the items to.
items - The items to give.

addItemToInventory

public static void addItemToInventory(org.bukkit.entity.Player player,
                                      org.bukkit.inventory.ItemStack stack)
Adds an ItemStack to a player's inventory.

Parameters:
player - The player to give the item to.
items - The item to give.

parseItem

public static org.bukkit.inventory.ItemStack parseItem(java.lang.String str)
                                                throws ParseItemException
Parses an ItemStack from a String.

Parameters:
str - The String to parse from.
Returns:
The item parsed.
Throws:
ParseItemException - If str is not formatted properly.

parseEffect

public static org.bukkit.potion.PotionEffect parseEffect(java.lang.String str)
                                                  throws ParseItemException
Parses a PotionEffect from a String.

Parameters:
str - The String to parse from.
Returns:
The effect parsed.
Throws:
ParseItemException - If str is not formatted properly.

parseEnchantment

public static InventoryUtil.EnchantmentWithLevel parseEnchantment(java.lang.String str)
Parses an EnchantmentWithLevel from a String.

Parameters:
str - The String to parse from.
Returns:
The enchantment parsed.

getMat

public static org.bukkit.Material getMat(java.lang.String name)
Gets a material by its enumerated name, common name, or type ID.

Parameters:
name - The name to search for.
Returns:
The item matched

itemToString

public static java.lang.String itemToString(org.bukkit.inventory.ItemStack stack)
Gets a user-friendly String that represents an ItemStack.

Parameters:
stack - The item to read.
Returns:
The string.

effectToString

public static java.lang.String effectToString(org.bukkit.potion.PotionEffect effect)
Gets a user-friendly String that represents an PotionEffect.

Parameters:
stack - The effect to read.
Returns:
The string.

isInt

public static boolean isInt(java.lang.String str)
Tests whether a String can be safely interpreted as an int.

Parameters:
str - The string to test.
Returns:
True if Integer.parseInt(String) can be safely used on str, false otherwise.