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 voidcloseInventory()Force-closes the currently open inventory view for this player, if any.InventorygetEnderChest()Get the player's EnderChest inventoryintgetExpToLevel()Get the total amount of experience required for the player to levelGameModegetGameMode()Gets this human's currentGameModePlayerInventorygetInventory()Get the player's inventory.ItemStackgetItemInHand()Returns the ItemStack currently in your hand, can be empty.ItemStackgetItemOnCursor()Returns the ItemStack currently on your cursor, can be empty.java.lang.StringgetName()Returns the name of this playerInventoryViewgetOpenInventory()Gets the inventory view the player is currently viewing.intgetSleepTicks()Get the sleep ticks of the player.booleanisBlocking()Check if the player is currently blocking (ie with a sword).booleanisSleeping()Returns whether this player is slumbering.InventoryViewopenEnchanting(Location location, boolean force)Opens an empty enchanting inventory window with the player's inventory on the bottom.InventoryViewopenInventory(Inventory inventory)Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.voidopenInventory(InventoryView inventory)Opens an inventory window to the specified inventory view.InventoryViewopenWorkbench(Location location, boolean force)Opens an empty workbench inventory window with the player's inventory on the bottom.voidsetGameMode(GameMode mode)Sets this human's currentGameModevoidsetItemInHand(ItemStack item)Sets the item to the given ItemStack, this will replace whatever the user was holding.voidsetItemOnCursor(ItemStack item)Sets the item to the given ItemStack, this will replace whatever the user was moving.booleansetWindowProperty(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, setMaxHealthMethods 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, teleportMethods 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, throwSnowballMethods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadataMethods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachmentMethods inherited from interface org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile
-
Method Details
-
getName
java.lang.String getName()Returns the name of this player- Specified by:
getNamein interfaceAnimalTamer- Specified by:
getNamein interfaceCommandSender- Returns:
- Player name
-
getInventory
PlayerInventory getInventory()Get the player's inventory.- Specified by:
getInventoryin 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
-