Class Item

java.lang.Object
  extended by Item

public class Item
extends java.lang.Object

Item.java - Item stuff.


Nested Class Summary
Modifier and Type Class and Description
static class Item.Type
          Type - Used to identify items
 
Field Summary
Modifier and Type Field and Description
 Item.Type itemType
           
 
Constructor Summary
Constructor and Description
Item()
          Create an item with an id of 1 and amount of 1
Item(int itemId, int amount)
          Creates an item with specified id and amount
Item(int itemId, int amount, int slot)
          Creates an item with specified id, amount and slot
Item(Item.Type itemType)
          Create a new item.
Item(Item.Type itemType, int amount)
           
Item(jl hn)
          Creates an item from the actual item class
Item(jl hn, int slot)
          Creates an item from the actual item class at the given slot
 
Method Summary
Modifier and Type Method and Description
 boolean equals(java.lang.Object obj)
          Tests the given object to see if it equals this object
 int getAmount()
          Returns the amount
 int getDamage()
          Returns this item's current damage.
 int getItemId()
          Returns the item id
 int getSlot()
          Returns this item's current slot.
 Item.Type getType()
          Returns this item type
 int hashCode()
          Returns a semi-unique hashcode for this object
static boolean isValidItem(int itemId)
          Returns true if specified item id is a valid item id.
 void setAmount(int amount)
          Sets the amount
 void setDamage(int damage)
          Sets this item's damage
 void setItemId(int itemId)
          Sets item id to specified id
 void setSlot(int slot)
          Sets this item's slot
 void setType(Item.Type itemType)
          Set the item type
 java.lang.String toString()
          Returns a String value representing this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

itemType

public Item.Type itemType
Constructor Detail

Item

public Item()
Create an item with an id of 1 and amount of 1


Item

public Item(Item.Type itemType)
Create a new item.

Parameters:
itemType - type of item.

Item

public Item(Item.Type itemType,
            int amount)

Item

public Item(int itemId,
            int amount)
Creates an item with specified id and amount

Parameters:
itemId -
amount -

Item

public Item(int itemId,
            int amount,
            int slot)
Creates an item with specified id, amount and slot

Parameters:
itemId -
amount -
slot -

Item

public Item(jl hn)
Creates an item from the actual item class

Parameters:
hn -

Item

public Item(jl hn,
            int slot)
Creates an item from the actual item class at the given slot

Parameters:
hn -
slot -
Method Detail

getItemId

public int getItemId()
Returns the item id

Returns:
item id

setItemId

public void setItemId(int itemId)
Sets item id to specified id

Parameters:
itemId -

getAmount

public int getAmount()
Returns the amount

Returns:
amount

setAmount

public void setAmount(int amount)
Sets the amount

Parameters:
amount -

isValidItem

public static boolean isValidItem(int itemId)
Returns true if specified item id is a valid item id.

Parameters:
itemId -
Returns:

getSlot

public int getSlot()
Returns this item's current slot. -1 if no slot is specified

Returns:
slot

setSlot

public void setSlot(int slot)
Sets this item's slot

Parameters:
slot -

getDamage

public int getDamage()
Returns this item's current damage. 0 if no damage is specified

Returns:
damage

setDamage

public void setDamage(int damage)
Sets this item's damage

Parameters:
damage -

toString

public java.lang.String toString()
Returns a String value representing this object

Overrides:
toString in class java.lang.Object
Returns:
String representation of this object

equals

public boolean equals(java.lang.Object obj)
Tests the given object to see if it equals this object

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to test
Returns:
true if the two objects match

hashCode

public int hashCode()
Returns a semi-unique hashcode for this object

Overrides:
hashCode in class java.lang.Object
Returns:
hashcode

getType

public Item.Type getType()
Returns this item type

Returns:
the item type

setType

public void setType(Item.Type itemType)
Set the item type

Parameters:
itemType - the item type