org.bukkit.inventory
Interface PlayerInventory

All Superinterfaces:
Inventory, Iterable<ItemStack>

public interface PlayerInventory
extends Inventory

Includes interface to the 4 armor slots


Method Summary
 int clear(int id, int data)
          Deprecated. Magic value
 ItemStack[] getArmorContents()
          Get all ItemStacks from the armor slots
 ItemStack getBoots()
          Return the ItemStack from the boots slot
 ItemStack getChestplate()
          Return the ItemStack from the chestplate slot
 int getHeldItemSlot()
          Get the slot number of the currently held item
 ItemStack getHelmet()
          Return the ItemStack from the helmet slot
 HumanEntity getHolder()
          Gets the block or entity belonging to the open inventory
 ItemStack getItemInHand()
          Returns the ItemStack currently hold
 ItemStack getLeggings()
          Return the ItemStack from the leg slot
 void setArmorContents(ItemStack[] items)
          Put the given ItemStacks into the armor slots
 void setBoots(ItemStack boots)
          Put the given ItemStack into the boots slot This does not check if the ItemStack is a boots
 void setChestplate(ItemStack chestplate)
          Put the given ItemStack into the chestplate slot This does not check if the ItemStack is a chestplate
 void setHeldItemSlot(int slot)
          Set the slot number of the currently held item.
 void setHelmet(ItemStack helmet)
          Put the given ItemStack into the helmet slot This does not check if the ItemStack is a helmet
 void setItemInHand(ItemStack stack)
          Sets the item in hand
 void setLeggings(ItemStack leggings)
          Put the given ItemStack into the leg slot This does not check if the ItemStack is a pair of leggings
 
Methods inherited from interface org.bukkit.inventory.Inventory
addItem, all, all, all, clear, clear, contains, contains, contains, contains, contains, contains, containsAtLeast, first, first, first, firstEmpty, getContents, getItem, getMaxStackSize, getName, getSize, getTitle, getType, getViewers, iterator, iterator, remove, remove, remove, removeItem, setContents, setItem, setMaxStackSize
 

Method Detail

getArmorContents

ItemStack[] getArmorContents()
Get all ItemStacks from the armor slots

Returns:
All the ItemStacks from the armor slots

getHelmet

ItemStack getHelmet()
Return the ItemStack from the helmet slot

Returns:
The ItemStack in the helmet slot

getChestplate

ItemStack getChestplate()
Return the ItemStack from the chestplate slot

Returns:
The ItemStack in the chestplate slot

getLeggings

ItemStack getLeggings()
Return the ItemStack from the leg slot

Returns:
The ItemStack in the leg slot

getBoots

ItemStack getBoots()
Return the ItemStack from the boots slot

Returns:
The ItemStack in the boots slot

setArmorContents

void setArmorContents(ItemStack[] items)
Put the given ItemStacks into the armor slots

Parameters:
items - The ItemStacks to use as armour

setHelmet

void setHelmet(ItemStack helmet)
Put the given ItemStack into the helmet slot This does not check if the ItemStack is a helmet

Parameters:
helmet - The ItemStack to use as helmet

setChestplate

void setChestplate(ItemStack chestplate)
Put the given ItemStack into the chestplate slot This does not check if the ItemStack is a chestplate

Parameters:
chestplate - The ItemStack to use as chestplate

setLeggings

void setLeggings(ItemStack leggings)
Put the given ItemStack into the leg slot This does not check if the ItemStack is a pair of leggings

Parameters:
leggings - The ItemStack to use as leggings

setBoots

void setBoots(ItemStack boots)
Put the given ItemStack into the boots slot This does not check if the ItemStack is a boots

Parameters:
boots - The ItemStack to use as boots

getItemInHand

ItemStack getItemInHand()
Returns the ItemStack currently hold

Returns:
The currently held ItemStack

setItemInHand

void setItemInHand(ItemStack stack)
Sets the item in hand

Parameters:
stack - Stack to set

getHeldItemSlot

int getHeldItemSlot()
Get the slot number of the currently held item

Returns:
Held item slot number

setHeldItemSlot

void setHeldItemSlot(int slot)
Set the slot number of the currently held item.

This validates whether the slot is between 0 and 8 inclusive.

Parameters:
slot - The new slot number
Throws:
IllegalArgumentException - Thrown if slot is not between 0 and 8 inclusive

clear

@Deprecated
int clear(int id,
                     int data)
Deprecated. Magic value

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:
id - the id of the item you want to clear from the inventory
data - the data of the item you want to clear from the inventory
Returns:
The number of items cleared

getHolder

HumanEntity getHolder()
Description copied from interface: Inventory
Gets the block or entity belonging to the open inventory

Specified by:
getHolder in interface Inventory
Returns:
The holder of the inventory; null if it has no holder.


Copyright © 2014. All rights reserved.