Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
HumanEntity.java
1 package org.bukkit.entity;
2 
3 import org.bukkit.GameMode;
4 import org.bukkit.Location;
11 
12 /**
13  * Represents a human entity, such as an NPC or a player
14  */
16 
17  /**
18  * Returns the name of this player
19  *
20  * @return Player name
21  */
22  public String getName();
23 
24  /**
25  * Get the player's inventory.
26  *
27  * @return The inventory of the player, this also contains the armor
28  * slots.
29  */
31 
32  /**
33  * Get the player's EnderChest inventory
34  *
35  * @return The EnderChest of the player
36  */
37  public Inventory getEnderChest();
38 
39  /**
40  * If the player currently has an inventory window open, this method will
41  * set a property of that window, such as the state of a progress bar.
42  *
43  * @param prop The property.
44  * @param value The value to set the property to.
45  * @return True if the property was successfully set.
46  */
47  public boolean setWindowProperty(InventoryView.Property prop, int value);
48 
49  /**
50  * Gets the inventory view the player is currently viewing. If they do not
51  * have an inventory window open, it returns their internal crafting view.
52  *
53  * @return The inventory view.
54  */
56 
57  /**
58  * Opens an inventory window with the specified inventory on the top and
59  * the player's inventory on the bottom.
60  *
61  * @param inventory The inventory to open
62  * @return The newly opened inventory view
63  */
64  public InventoryView openInventory(Inventory inventory);
65 
66  /**
67  * Opens an empty workbench inventory window with the player's inventory
68  * on the bottom.
69  *
70  * @param location The location to attach it to. If null, the player's
71  * location is used.
72  * @param force If false, and there is no workbench block at the location,
73  * no inventory will be opened and null will be returned.
74  * @return The newly opened inventory view, or null if it could not be
75  * opened.
76  */
77  public InventoryView openWorkbench(Location location, boolean force);
78 
79  /**
80  * Opens an empty enchanting inventory window with the player's inventory
81  * on the bottom.
82  *
83  * @param location The location to attach it to. If null, the player's
84  * location is used.
85  * @param force If false, and there is no enchanting table at the
86  * location, no inventory will be opened and null will be returned.
87  * @return The newly opened inventory view, or null if it could not be
88  * opened.
89  */
90  public InventoryView openEnchanting(Location location, boolean force);
91 
92  /**
93  * Opens an inventory window to the specified inventory view.
94  *
95  * @param inventory The view to open
96  */
97  public void openInventory(InventoryView inventory);
98 
99  /**
100  * Force-closes the currently open inventory view for this player, if any.
101  */
102  public void closeInventory();
103 
104  /**
105  * Returns the ItemStack currently in your hand, can be empty.
106  *
107  * @return The ItemStack of the item you are currently holding.
108  */
109  public ItemStack getItemInHand();
110 
111  /**
112  * Sets the item to the given ItemStack, this will replace whatever the
113  * user was holding.
114  *
115  * @param item The ItemStack which will end up in the hand
116  */
117  public void setItemInHand(ItemStack item);
118 
119  /**
120  * Returns the ItemStack currently on your cursor, can be empty. Will
121  * always be empty if the player currently has no open window.
122  *
123  * @return The ItemStack of the item you are currently moving around.
124  */
125  public ItemStack getItemOnCursor();
126 
127  /**
128  * Sets the item to the given ItemStack, this will replace whatever the
129  * user was moving. Will always be empty if the player currently has no
130  * open window.
131  *
132  * @param item The ItemStack which will end up in the hand
133  */
134  public void setItemOnCursor(ItemStack item);
135 
136  /**
137  * Returns whether this player is slumbering.
138  *
139  * @return slumber state
140  */
141  public boolean isSleeping();
142 
143  /**
144  * Get the sleep ticks of the player. This value may be capped.
145  *
146  * @return slumber ticks
147  */
148  public int getSleepTicks();
149 
150  /**
151  * Gets this humans current {@link GameMode}
152  *
153  * @return Current game mode
154  */
155  public GameMode getGameMode();
156 
157  /**
158  * Sets this humans current {@link GameMode}
159  *
160  * @param mode New game mode
161  */
162  public void setGameMode(GameMode mode);
163 
164  /**
165  * Check if the player is currently blocking (ie with a sword).
166  *
167  * @return Whether they are blocking.
168  */
169  public boolean isBlocking();
170 
171  /**
172  * Get the total amount of experience required for the player to level
173  *
174  * @return Experience required to level up
175  */
176  public int getExpToLevel();
177 }
void setGameMode(GameMode mode)
void setItemOnCursor(ItemStack item)
PlayerInventory getInventory()
void setItemInHand(ItemStack item)
InventoryView openInventory(Inventory inventory)
InventoryView openEnchanting(Location location, boolean force)
InventoryView getOpenInventory()
InventoryView openWorkbench(Location location, boolean force)
boolean setWindowProperty(InventoryView.Property prop, int value)