001 package org.bukkit.inventory;
002
003 import org.bukkit.entity.HumanEntity;
004
005 /**
006 * Interface to the inventory of a Player, including the four armor slots.
007 */
008 public interface PlayerInventory extends Inventory {
009
010 /**
011 * Get all ItemStacks from the armor slots
012 *
013 * @return All the ItemStacks from the armor slots
014 */
015 public ItemStack[] getArmorContents();
016
017 /**
018 * Return the ItemStack from the helmet slot
019 *
020 * @return The ItemStack in the helmet slot
021 */
022 public ItemStack getHelmet();
023
024 /**
025 * Return the ItemStack from the chestplate slot
026 *
027 * @return The ItemStack in the chestplate slot
028 */
029 public ItemStack getChestplate();
030
031 /**
032 * Return the ItemStack from the leg slot
033 *
034 * @return The ItemStack in the leg slot
035 */
036 public ItemStack getLeggings();
037
038 /**
039 * Return the ItemStack from the boots slot
040 *
041 * @return The ItemStack in the boots slot
042 */
043 public ItemStack getBoots();
044
045 /**
046 * Put the given ItemStacks into the armor slots
047 *
048 * @param items The ItemStacks to use as armour
049 */
050 public void setArmorContents(ItemStack[] items);
051
052 /**
053 * Put the given ItemStack into the helmet slot. This does not check if
054 * the ItemStack is a helmet
055 *
056 * @param helmet The ItemStack to use as helmet
057 */
058 public void setHelmet(ItemStack helmet);
059
060 /**
061 * Put the given ItemStack into the chestplate slot. This does not check
062 * if the ItemStack is a chestplate
063 *
064 * @param chestplate The ItemStack to use as chestplate
065 */
066 public void setChestplate(ItemStack chestplate);
067
068 /**
069 * Put the given ItemStack into the leg slot. This does not check if the
070 * ItemStack is a pair of leggings
071 *
072 * @param leggings The ItemStack to use as leggings
073 */
074 public void setLeggings(ItemStack leggings);
075
076 /**
077 * Put the given ItemStack into the boots slot. This does not check if the
078 * ItemStack is a boots
079 *
080 * @param boots The ItemStack to use as boots
081 */
082 public void setBoots(ItemStack boots);
083
084 /**
085 * Returns the ItemStack currently hold
086 *
087 * @return The currently held ItemStack
088 */
089 public ItemStack getItemInHand();
090
091 /**
092 * Sets the item in hand
093 *
094 * @param stack Stack to set
095 */
096 public void setItemInHand(ItemStack stack);
097
098 /**
099 * Get the slot number of the currently held item
100 *
101 * @return Held item slot number
102 */
103 public int getHeldItemSlot();
104
105 /**
106 * Set the slot number of the currently held item.
107 * <p>
108 * This validates whether the slot is between 0 and 8 inclusive.
109 *
110 * @param slot The new slot number
111 * @throws IllegalArgumentException Thrown if slot is not between 0 and 8
112 * inclusive
113 */
114 public void setHeldItemSlot(int slot);
115
116 /**
117 * Clears all matching items from the inventory. Setting either value to
118 * -1 will skip it's check, while setting both to -1 will clear all items
119 * in your inventory unconditionally.
120 *
121 * @param id the id of the item you want to clear from the inventory
122 * @param data the data of the item you want to clear from the inventory
123 * @return The number of items cleared
124 * @deprecated Magic value
125 */
126 @Deprecated
127 public int clear(int id, int data);
128
129 public HumanEntity getHolder();
130 }