Package org.bukkit.entity
Interface HumanEntity
- All Superinterfaces:
AnimalTamer
,CommandSender
,Damageable
,Entity
,InventoryHolder
,LivingEntity
,Metadatable
,Permissible
,ProjectileSource
,ServerOperator
- All Known Subinterfaces:
Player
public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, InventoryHolder
Represents a human entity, such as an NPC or a player
-
Nested Class Summary
-
Method Summary
Modifier and Type Method Description void
closeInventory()
Force-closes the currently open inventory view for this player, if any.Inventory
getEnderChest()
Get the player's EnderChest inventoryint
getExpToLevel()
Get the total amount of experience required for the player to levelGameMode
getGameMode()
Gets this human's currentGameMode
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.java.lang.String
getName()
Returns the name of this playerInventoryView
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 human's currentGameMode
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.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, getCustomName, getEntityId, getFallDistance, getFireTicks, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWorld, isCustomNameVisible, isDead, isEmpty, isInsideVehicle, isOnGround, isValid, leaveVehicle, playEffect, remove, setCustomName, setCustomNameVisible, setFallDistance, setFireTicks, setLastDamageCause, setPassenger, setTicksLived, setVelocity, spigot, teleport, teleport, teleport, teleport
Methods inherited from interface org.bukkit.entity.LivingEntity
_INVALID_getLastDamage, _INVALID_setLastDamage, addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getNoDamageTicks, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlock, hasLineOfSight, hasPotionEffect, isLeashed, removePotionEffect, setCanPickupItems, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, shootArrow, throwEgg, throwSnowball
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.projectiles.ProjectileSource
launchProjectile, launchProjectile
-
Method Details
-
getName
java.lang.String getName()Returns the name of this player- Specified by:
getName
in interfaceAnimalTamer
- Specified by:
getName
in interfaceCommandSender
- Returns:
- Player name
-
getInventory
PlayerInventory getInventory()Get the player's inventory.- Specified by:
getInventory
in interfaceInventoryHolder
- 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
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
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
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
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
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
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
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 human's currentGameMode
- Returns:
- Current game mode
-
setGameMode
Sets this human's currentGameMode
- 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
-