org.bukkit.entity
Interface HumanEntity

All Superinterfaces:
AnimalTamer, Damageable, Entity, InventoryHolder, LivingEntity, Metadatable, Permissible, ServerOperator
All Known Subinterfaces:
Player

public interface HumanEntity
extends LivingEntity, AnimalTamer, Permissible, InventoryHolder

Represents a human entity, such as an NPC or a player


Method Summary
 void closeInventory()
          Force-closes the currently open inventory view for this player, if any.
 Inventory getEnderChest()
          Get the player's EnderChest inventory
 int getExpToLevel()
          Get the total amount of experience required for the player to level
 GameMode getGameMode()
          Gets this humans current GameMode
 PlayerInventory getInventory()
          Get the player's inventory.
 ItemStack getItemInHand()
          Returns the ItemStack currently in your hand, can be empty.
 ItemStack getItemOnCursor()
          Returns the ItemStack currently on your cursor, can be empty.
 String getName()
          Returns the name of this player
 InventoryView getOpenInventory()
          Gets the inventory view the player is currently viewing.
 int getSleepTicks()
          Get the sleep ticks of the player.
 boolean isBlocking()
          Check if the player is currently blocking (ie with a sword).
 boolean isSleeping()
          Returns whether this player is slumbering.
 InventoryView openEnchanting(Location location, boolean force)
          Opens an empty enchanting inventory window with the player's inventory on the bottom.
 InventoryView openInventory(Inventory inventory)
          Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.
 void openInventory(InventoryView inventory)
          Opens an inventory window to the specified inventory view.
 InventoryView openWorkbench(Location location, boolean force)
          Opens an empty workbench inventory window with the player's inventory on the bottom.
 void setGameMode(GameMode mode)
          Sets this humans current GameMode
 void setItemInHand(ItemStack item)
          Sets the item to the given ItemStack, this will replace whatever the user was holding.
 void setItemOnCursor(ItemStack item)
          Sets the item to the given ItemStack, this will replace whatever the user was moving.
 boolean setWindowProperty(InventoryView.Property prop, int value)
          If the player currently has an inventory window open, this method will set a property of that window, such as the state of a progress bar.
 
Methods inherited from interface org.bukkit.entity.LivingEntity
_INVALID_getLastDamage, _INVALID_setLastDamage, addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getCustomName, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getNoDamageTicks, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, hasLineOfSight, hasPotionEffect, isCustomNameVisible, isLeashed, launchProjectile, removePotionEffect, setCanPickupItems, setCustomName, setCustomNameVisible, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, shootArrow, throwEgg, throwSnowball
 
Methods inherited from interface org.bukkit.entity.Damageable
_INVALID_damage, _INVALID_damage, _INVALID_getHealth, _INVALID_getMaxHealth, _INVALID_setHealth, _INVALID_setMaxHealth, damage, damage, getHealth, getMaxHealth, resetMaxHealth, setHealth, setMaxHealth
 
Methods inherited from interface org.bukkit.entity.Entity
eject, getEntityId, getFallDistance, getFireTicks, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWorld, isDead, isEmpty, isInsideVehicle, isOnGround, isValid, leaveVehicle, playEffect, remove, setFallDistance, setFireTicks, setLastDamageCause, setPassenger, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
 
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
 
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
 
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
 

Method Detail

getName

String getName()
Returns the name of this player

Specified by:
getName in interface AnimalTamer
Returns:
Player name

getInventory

PlayerInventory getInventory()
Get the player's inventory.

Specified by:
getInventory in interface InventoryHolder
Returns:
The inventory of the player, this also contains the armor slots.

getEnderChest

Inventory getEnderChest()
Get the player's EnderChest inventory

Returns:
The EnderChest of the player

setWindowProperty

boolean setWindowProperty(InventoryView.Property prop,
                          int value)
If the player currently has an inventory window open, this method will set a property of that window, such as the state of a progress bar.

Parameters:
prop - The property.
value - The value to set the property to.
Returns:
True if the property was successfully set.

getOpenInventory

InventoryView getOpenInventory()
Gets the inventory view the player is currently viewing. If they do not have an inventory window open, it returns their internal crafting view.

Returns:
The inventory view.

openInventory

InventoryView openInventory(Inventory inventory)
Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.

Parameters:
inventory - The inventory to open
Returns:
The newly opened inventory view

openWorkbench

InventoryView openWorkbench(Location location,
                            boolean force)
Opens an empty workbench inventory window with the player's inventory on the bottom.

Parameters:
location - The location to attach it to. If null, the player's location is used.
force - If false, and there is no workbench block at the location, no inventory will be opened and null will be returned.
Returns:
The newly opened inventory view, or null if it could not be opened.

openEnchanting

InventoryView openEnchanting(Location location,
                             boolean force)
Opens an empty enchanting inventory window with the player's inventory on the bottom.

Parameters:
location - The location to attach it to. If null, the player's location is used.
force - If false, and there is no enchanting table at the location, no inventory will be opened and null will be returned.
Returns:
The newly opened inventory view, or null if it could not be opened.

openInventory

void openInventory(InventoryView inventory)
Opens an inventory window to the specified inventory view.

Parameters:
inventory - The view to open

closeInventory

void closeInventory()
Force-closes the currently open inventory view for this player, if any.


getItemInHand

ItemStack getItemInHand()
Returns the ItemStack currently in your hand, can be empty.

Returns:
The ItemStack of the item you are currently holding.

setItemInHand

void setItemInHand(ItemStack item)
Sets the item to the given ItemStack, this will replace whatever the user was holding.

Parameters:
item - The ItemStack which will end up in the hand

getItemOnCursor

ItemStack getItemOnCursor()
Returns the ItemStack currently on your cursor, can be empty. Will always be empty if the player currently has no open window.

Returns:
The ItemStack of the item you are currently moving around.

setItemOnCursor

void setItemOnCursor(ItemStack item)
Sets the item to the given ItemStack, this will replace whatever the user was moving. Will always be empty if the player currently has no open window.

Parameters:
item - The ItemStack which will end up in the hand

isSleeping

boolean isSleeping()
Returns whether this player is slumbering.

Returns:
slumber state

getSleepTicks

int getSleepTicks()
Get the sleep ticks of the player. This value may be capped.

Returns:
slumber ticks

getGameMode

GameMode getGameMode()
Gets this humans current GameMode

Returns:
Current game mode

setGameMode

void setGameMode(GameMode mode)
Sets this humans current GameMode

Parameters:
mode - New game mode

isBlocking

boolean isBlocking()
Check if the player is currently blocking (ie with a sword).

Returns:
Whether they are blocking.

getExpToLevel

int getExpToLevel()
Get the total amount of experience required for the player to level

Returns:
Experience required to level up


Copyright © 2013. All Rights Reserved.