Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.inventory.PlayerInventory Interface Reference

Includes interface to the 4 armor slots. More...

+ Inheritance diagram for org.bukkit.inventory.PlayerInventory:
+ Collaboration diagram for org.bukkit.inventory.PlayerInventory:

Public Member Functions

ItemStack[] getArmorContents ()
 Get all ItemStacks from the armor slots.
 
ItemStack getHelmet ()
 Return the ItemStack from the helmet slot.
 
ItemStack getChestplate ()
 Return the ItemStack from the chestplate slot.
 
ItemStack getLeggings ()
 Return the ItemStack from the leg slot.
 
ItemStack getBoots ()
 Return the ItemStack from the boots slot.
 
void setArmorContents (ItemStack[] items)
 Put the given ItemStacks into the armor slots.
 
void setHelmet (ItemStack helmet)
 Put the given ItemStack into the helmet slot This does not check if the ItemStack is a helmet.
 
void setChestplate (ItemStack chestplate)
 Put the given ItemStack into the chestplate slot This does not check if the ItemStack is a chestplate.
 
void setLeggings (ItemStack leggings)
 Put the given ItemStack into the leg slot This does not check if the ItemStack is a pair of leggings.
 
void setBoots (ItemStack boots)
 Put the given ItemStack into the boots slot This does not check if the ItemStack is a boots.
 
ItemStack getItemInHand ()
 Returns the ItemStack currently hold.
 
void setItemInHand (ItemStack stack)
 Sets the item in hand.
 
int getHeldItemSlot ()
 Get the slot number of the currently held item.
 
int clear (int id, int data)
 Clears all matching items from the inventory.
 
HumanEntity getHolder ()
 
- Public Member Functions inherited from org.bukkit.inventory.Inventory
int getSize ()
 Returns the size of the inventory.
 
int getMaxStackSize ()
 Returns the maximum stack size for an ItemStack in this inventory.
 
void setMaxStackSize (int size)
 This method allows you to change the maximum stack size for an inventory.
 
String getName ()
 Returns the name of the inventory.
 
ItemStack getItem (int index)
 Returns the ItemStack found in the slot at the given index.
 
void setItem (int index, ItemStack item)
 Stores the ItemStack at the given index of the inventory.
 
HashMap< Integer, ItemStackaddItem (ItemStack...items) throws IllegalArgumentException
 Stores the given ItemStacks in the inventory.
 
HashMap< Integer, ItemStackremoveItem (ItemStack...items) throws IllegalArgumentException
 Removes the given ItemStacks from the inventory.
 
ItemStack[] getContents ()
 Returns all ItemStacks from the inventory.
 
void setContents (ItemStack[] items) throws IllegalArgumentException
 Completely replaces the inventory's contents.
 
boolean contains (int materialId)
 Checks if the inventory contains any ItemStacks with the given materialId.
 
boolean contains (Material material) throws IllegalArgumentException
 Checks if the inventory contains any ItemStacks with the given material.
 
boolean contains (ItemStack item)
 Checks if the inventory contains any ItemStacks matching the given ItemStack.
 
boolean contains (int materialId, int amount)
 Checks if the inventory contains any ItemStacks with the given materialId, adding to at least the minimum amount specified.
 
boolean contains (Material material, int amount) throws IllegalArgumentException
 Checks if the inventory contains any ItemStacks with the given material, adding to at least the minimum amount specified.
 
boolean contains (ItemStack item, int amount)
 Checks if the inventory contains any ItemStacks matching the given ItemStack and at least the minimum amount specified This will only match if both the type and the amount of the stack match.
 
boolean containsAtLeast (ItemStack item, int amount)
 Returns a HashMap with all slots and ItemStacks in the inventory with given materialId.
 
HashMap< Integer,?extends
ItemStack
all (int materialId)
 Find all slots in the inventory containing any ItemStacks with the given materialId.
 
HashMap< Integer,?extends
ItemStack
all (Material material) throws IllegalArgumentException
 Returns a HashMap with all slots and ItemStacks in the inventory with the given Material.
 
HashMap< Integer,?extends
ItemStack
all (ItemStack item)
 Finds all slots in the inventory containing any ItemStacks with the given ItemStack This will only match slots if both the type and the amount of the stack match.
 
int first (int materialId)
 Finds the first slot in the inventory containing an ItemStack with the given materialId.
 
int first (Material material) throws IllegalArgumentException
 Finds the first slot in the inventory containing an ItemStack with the given material.
 
int first (ItemStack item)
 Returns the first slot in the inventory containing an ItemStack with the given stack This will only match a slot if both the type and the amount of the stack match.
 
int firstEmpty ()
 Returns the first empty Slot.
 
void remove (int materialId)
 Removes all stacks in the inventory matching the given materialId.
 
void remove (Material material) throws IllegalArgumentException
 Removes all stacks in the inventory matching the given material.
 
void remove (ItemStack item)
 Removes all stacks in the inventory matching the given stack.
 
void clear (int index)
 Clears out a particular slot in the index.
 
void clear ()
 Clears out the whole Inventory.
 
List< HumanEntitygetViewers ()
 Gets a list of players viewing.
 
String getTitle ()
 Returns the title of this inventory.
 
InventoryType getType ()
 Returns what type of inventory this is.
 
InventoryHolder getHolder ()
 Gets the block or entity belonging to the open inventory.
 
ListIterator< ItemStackiterator ()
 
ListIterator< ItemStackiterator (int index)
 Returns an iterator starting at the given index.
 

Detailed Description

Includes interface to the 4 armor slots.

Definition at line 8 of file PlayerInventory.java.

Member Function Documentation

int org.bukkit.inventory.PlayerInventory.clear ( int  id,
int  data 
)

Clears all matching items from the inventory.

Setting either value to -1 will skip it's check, while setting both to -1 will clear all items in your inventory unconditionally.

Parameters
idthe id of the item you want to clear from the inventory
datathe data of the item you want to clear from the inventory
Returns
The number of items cleared

Referenced by org.bukkit.command.defaults.ClearCommand.execute().

ItemStack [] org.bukkit.inventory.PlayerInventory.getArmorContents ( )

Get all ItemStacks from the armor slots.

Returns
All the ItemStacks from the armor slots
ItemStack org.bukkit.inventory.PlayerInventory.getBoots ( )

Return the ItemStack from the boots slot.

Returns
The ItemStack in the boots slot
ItemStack org.bukkit.inventory.PlayerInventory.getChestplate ( )

Return the ItemStack from the chestplate slot.

Returns
The ItemStack in the chestplate slot
int org.bukkit.inventory.PlayerInventory.getHeldItemSlot ( )

Get the slot number of the currently held item.

Returns
Held item slot number
ItemStack org.bukkit.inventory.PlayerInventory.getHelmet ( )

Return the ItemStack from the helmet slot.

Returns
The ItemStack in the helmet slot
HumanEntity org.bukkit.inventory.PlayerInventory.getHolder ( )
ItemStack org.bukkit.inventory.PlayerInventory.getItemInHand ( )

Returns the ItemStack currently hold.

Returns
The currently held ItemStack
ItemStack org.bukkit.inventory.PlayerInventory.getLeggings ( )

Return the ItemStack from the leg slot.

Returns
The ItemStack in the leg slot
void org.bukkit.inventory.PlayerInventory.setArmorContents ( ItemStack[]  items)

Put the given ItemStacks into the armor slots.

Parameters
itemsThe ItemStacks to use as armour
void org.bukkit.inventory.PlayerInventory.setBoots ( ItemStack  boots)

Put the given ItemStack into the boots slot This does not check if the ItemStack is a boots.

Parameters
bootsThe ItemStack to use as boots
void org.bukkit.inventory.PlayerInventory.setChestplate ( ItemStack  chestplate)

Put the given ItemStack into the chestplate slot This does not check if the ItemStack is a chestplate.

Parameters
chestplateThe ItemStack to use as chestplate
void org.bukkit.inventory.PlayerInventory.setHelmet ( ItemStack  helmet)

Put the given ItemStack into the helmet slot This does not check if the ItemStack is a helmet.

Parameters
helmetThe ItemStack to use as helmet
void org.bukkit.inventory.PlayerInventory.setItemInHand ( ItemStack  stack)

Sets the item in hand.

Parameters
stackStack to set
void org.bukkit.inventory.PlayerInventory.setLeggings ( ItemStack  leggings)

Put the given ItemStack into the leg slot This does not check if the ItemStack is a pair of leggings.

Parameters
leggingsThe ItemStack to use as leggings

The documentation for this interface was generated from the following file: