public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
Entity.Spigot
Modifier and Type | Method and Description |
---|---|
void |
closeInventory()
Force-closes the currently open inventory view for this player, if any.
|
void |
closeInventory(InventoryCloseEvent.Reason reason)
Force-closes the currently open inventory view for this player, if any.
|
boolean |
discoverRecipe(@NotNull NamespacedKey recipe)
Discover a recipe for this player such that it has not already been
discovered.
|
int |
discoverRecipes(@NotNull Collection<NamespacedKey> recipes)
Discover a collection of recipes for this player such that they have not
already been discovered.
|
boolean |
dropItem(boolean dropAll)
Make the entity drop the item in their hand.
|
float |
getAttackCooldown()
Gets the current cooldown for a player's attack.
|
@NotNull Location |
getBedLocation()
Gets the location of the bed the player is currently sleeping in
|
int |
getCooldown(@NotNull Material material)
Get the cooldown time in ticks remaining for the specified material.
|
@NotNull Set<NamespacedKey> |
getDiscoveredRecipes()
Get an immutable set of recipes this entity has discovered.
|
@NotNull Inventory |
getEnderChest()
Get the player's EnderChest inventory
|
float |
getExhaustion()
Gets the players current exhaustion level.
|
int |
getExpToLevel()
Get the total amount of experience required for the player to level
|
int |
getFoodLevel()
Gets the players current food level
|
@NotNull GameMode |
getGameMode()
Gets this human's current
GameMode |
@NotNull PlayerInventory |
getInventory()
Get the player's inventory.
|
@NotNull ItemStack |
getItemInHand()
Deprecated.
Humans may now dual wield in their off hand, use explicit
methods in
PlayerInventory . |
@NotNull ItemStack |
getItemOnCursor()
Returns the ItemStack currently on your cursor, can be empty.
|
@NotNull MainHand |
getMainHand()
Gets the player's selected main hand
|
@NotNull String |
getName()
Returns the name of this player
|
@NotNull InventoryView |
getOpenInventory()
Gets the inventory view the player is currently viewing.
|
@Nullable Location |
getPotentialBedLocation()
Gets the Location of the player's bed, null if they have not slept
in one.
|
int |
getSaturatedRegenRate()
Get the regeneration rate (1 health per x ticks) of
the HumanEntity when they have saturation and
their food level is >= 20.
|
float |
getSaturation()
Gets the players current saturation level.
|
@Nullable Entity |
getShoulderEntityLeft()
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
@Nullable Entity |
getShoulderEntityRight()
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
int |
getSleepTicks()
Get the sleep ticks of the player.
|
int |
getStarvationRate()
Get the starvation rate (1 health per x ticks) of
the HumanEntity.
|
int |
getUnsaturatedRegenRate()
Get the regeneration rate (1 health per x ticks) of
the HumanEntity when they have no saturation and
their food level is >= 18.
|
boolean |
hasCooldown(@NotNull Material material)
Check whether a cooldown is active on the specified material.
|
boolean |
hasDiscoveredRecipe(@NotNull NamespacedKey recipe)
Check whether or not this entity has discovered the specified recipe.
|
boolean |
isBlocking()
Check if the player is currently blocking (ie with a shield).
|
boolean |
isDeeplySleeping()
If the player has slept enough to count towards passing the night.
|
boolean |
isHandRaised()
Check if the player currently has their hand raised (ie about to begin
blocking).
|
@Nullable InventoryView |
openAnvil(@Nullable Location location,
boolean force)
Opens an empty anvil inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openCartographyTable(@Nullable Location location,
boolean force)
Opens an empty cartography table inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openEnchanting(@Nullable Location location,
boolean force)
Opens an empty enchanting inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openGrindstone(@Nullable Location location,
boolean force)
Opens an empty grindstone inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openInventory(@NotNull Inventory inventory)
Opens an inventory window with the specified inventory on the top and
the player's inventory on the bottom.
|
void |
openInventory(@NotNull InventoryView inventory)
Opens an inventory window to the specified inventory view.
|
@Nullable InventoryView |
openLoom(@Nullable Location location,
boolean force)
Opens an empty loom inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openMerchant(@NotNull Merchant merchant,
boolean force)
Starts a trade between the player and the merchant.
|
@Nullable InventoryView |
openMerchant(@NotNull Villager trader,
boolean force)
Starts a trade between the player and the villager.
|
void |
openSign(Sign sign)
Opens an editor window for the specified sign
|
@Nullable InventoryView |
openSmithingTable(@Nullable Location location,
boolean force)
Opens an empty smithing table inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openStonecutter(@Nullable Location location,
boolean force)
Opens an empty stonecutter inventory window with the player's inventory
on the bottom.
|
@Nullable InventoryView |
openWorkbench(@Nullable Location location,
boolean force)
Opens an empty workbench inventory window with the player's inventory
on the bottom.
|
@Nullable Entity |
releaseLeftShoulderEntity()
If there is an Entity on this entities left shoulder, it will be released to the world and returned.
|
@Nullable Entity |
releaseRightShoulderEntity()
If there is an Entity on this entities left shoulder, it will be released to the world and returned.
|
void |
setCooldown(@NotNull Material material,
int ticks)
Set a cooldown on the specified material for a certain amount of ticks.
|
void |
setExhaustion(float value)
Sets the players current exhaustion level
|
void |
setFoodLevel(int value)
Sets the players current food level
|
void |
setGameMode(@NotNull GameMode mode)
Sets this human's current
GameMode |
void |
setItemInHand(@Nullable ItemStack item)
Deprecated.
Humans may now dual wield in their off hand, use explicit
methods in
PlayerInventory . |
void |
setItemOnCursor(@Nullable ItemStack item)
Sets the item to the given ItemStack, this will replace whatever the
user was moving.
|
void |
setSaturatedRegenRate(int ticks)
Set the regeneration rate (1 health per x ticks) of
the HumanEntity when they have saturation and
their food level is >= 20.
|
void |
setSaturation(float value)
Sets the players current saturation level
|
void |
setShoulderEntityLeft(@Nullable Entity entity)
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
void |
setShoulderEntityRight(@Nullable Entity entity)
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
void |
setStarvationRate(int ticks)
Get the starvation rate (1 health per x ticks) of
the HumanEntity.
|
void |
setUnsaturatedRegenRate(int ticks)
Get the regeneration rate (1 health per x ticks) of
the HumanEntity when they have no saturation and
their food level is >= 18.
|
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.
|
boolean |
sleep(@NotNull Location location,
boolean force)
Attempts to make the entity sleep at the given location.
|
boolean |
undiscoverRecipe(@NotNull NamespacedKey recipe)
Undiscover a recipe for this player such that it has already been
discovered.
|
int |
undiscoverRecipes(@NotNull Collection<NamespacedKey> recipes)
Undiscover a collection of recipes for this player such that they have
already been discovered.
|
void |
wakeup(boolean setSpawnLocation)
Causes the player to wakeup if they are currently sleeping.
|
addPotionEffect, addPotionEffect, addPotionEffects, attack, clearActiveItem, getActiveItem, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getArrowsStuck, getCanPickupItems, getCategory, getCollidableExemptions, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getHandRaisedTime, getHurtDirection, getItemUseRemainingTime, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getShieldBlockingDelay, getTargetBlock, getTargetBlock, getTargetBlock, getTargetBlockExact, getTargetBlockExact, getTargetBlockFace, getTargetBlockFace, getTargetBlockInfo, getTargetBlockInfo, getTargetEntity, getTargetEntity, getTargetEntityInfo, getTargetEntityInfo, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isInvisible, isJumping, isLeashed, isRiptiding, isSleeping, isSwimming, playAnimation, playPickupItemAnimation, playPickupItemAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setArrowsStuck, setCanPickupItems, setCollidable, setGliding, setHurtDirection, setInvisible, setJumping, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setShieldBlockingDelay, setSwimming, swingMainHand, swingOffHand
getAttribute, registerAttribute
damage, damage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
addPassenger, addScoreboardTag, asHoverEvent, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInBubbleColumn, isInLava, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isOnGround, isPersistent, isSilent, isTicking, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, spigot, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync
getMetadata, hasMetadata, removeMetadata, setMetadata
sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage
audience, audience, clearTitle, empty, hideBossBar, openBook, openBook, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound, toAudience
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
customName, customName, getCustomName, setCustomName
getPersistentDataContainer
asHoverEvent, unbox
launchProjectile, launchProjectile
getUniqueId
@NotNull @NotNull String getName()
getName
in interface AnimalTamer
getName
in interface CommandSender
@NotNull @NotNull PlayerInventory getInventory()
getInventory
in interface InventoryHolder
@NotNull @NotNull Inventory getEnderChest()
@NotNull @NotNull MainHand getMainHand()
boolean setWindowProperty(@NotNull InventoryView.Property prop, int value)
prop
- The property.value
- The value to set the property to.@NotNull @NotNull InventoryView getOpenInventory()
@Nullable @Nullable InventoryView openInventory(@NotNull @NotNull Inventory inventory)
inventory
- The inventory to open@Nullable @Nullable InventoryView openWorkbench(@Nullable @Nullable Location location, boolean force)
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.@Nullable @Nullable InventoryView openEnchanting(@Nullable @Nullable Location location, boolean force)
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.void openInventory(@NotNull @NotNull InventoryView inventory)
inventory
- The view to open@Nullable @Nullable InventoryView openMerchant(@NotNull @NotNull Villager trader, boolean force)
trader
- The merchant to trade with. Cannot be null.force
- whether to force the trade even if another player is trading@Nullable @Nullable InventoryView openMerchant(@NotNull @NotNull Merchant merchant, boolean force)
merchant
- The merchant to trade with. Cannot be null.force
- whether to force the trade even if another player is trading@Nullable @Nullable InventoryView openAnvil(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no anvil block at the location,
no inventory will be opened and null will be returned.@Nullable @Nullable InventoryView openCartographyTable(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no cartography table block at the location,
no inventory will be opened and null will be returned.@Nullable @Nullable InventoryView openGrindstone(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no grindstone block at the location,
no inventory will be opened and null will be returned.@Nullable @Nullable InventoryView openLoom(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no loom block at the location,
no inventory will be opened and null will be returned.@Nullable @Nullable InventoryView openSmithingTable(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no smithing table block at the location,
no inventory will be opened and null will be returned.@Nullable @Nullable InventoryView openStonecutter(@Nullable @Nullable Location location, boolean force)
location
- The location to attach it to. If null, the player's
location is used.force
- If false, and there is no stonecutter block at the location,
no inventory will be opened and null will be returned.void closeInventory()
void closeInventory(@NotNull InventoryCloseEvent.Reason reason)
reason
- why the inventory is closing@Deprecated @NotNull @NotNull ItemStack getItemInHand()
PlayerInventory
.@Deprecated void setItemInHand(@Nullable @Nullable ItemStack item)
PlayerInventory
.item
- The ItemStack which will end up in the hand@NotNull @NotNull ItemStack getItemOnCursor()
void setItemOnCursor(@Nullable @Nullable ItemStack item)
item
- The ItemStack which will end up in the handboolean hasCooldown(@NotNull @NotNull Material material)
material
- the material to checkint getCooldown(@NotNull @NotNull Material material)
material
- the material to checkvoid setCooldown(@NotNull @NotNull Material material, int ticks)
Cooldowns are used by the server for items such as ender pearls and shields to prevent them from being used repeatedly.
Note that cooldowns will not by themselves stop an item from being used for attacking.
material
- the material to set the cooldown forticks
- the amount of ticks to set or 0 to removeboolean isDeeplySleeping()
int getSleepTicks()
@Nullable @Nullable Location getPotentialBedLocation()
boolean sleep(@NotNull @NotNull Location location, boolean force)
location
- the location of the bedforce
- whether to try and sleep at the location even if not
normally possiblevoid wakeup(boolean setSpawnLocation)
setSpawnLocation
- whether to set their spawn location to the bed
they are currently sleeping inIllegalStateException
- if not sleeping@NotNull @NotNull Location getBedLocation()
IllegalStateException
- if not sleeping@NotNull @NotNull GameMode getGameMode()
GameMode
void setGameMode(@NotNull @NotNull GameMode mode)
GameMode
mode
- New game modeboolean isBlocking()
boolean isHandRaised()
isHandRaised
in interface LivingEntity
int getExpToLevel()
@Nullable @Nullable Entity releaseLeftShoulderEntity()
@Nullable @Nullable Entity releaseRightShoulderEntity()
float getAttackCooldown()
boolean discoverRecipe(@NotNull @NotNull NamespacedKey recipe)
recipe
- the key of the recipe to discoverint discoverRecipes(@NotNull @NotNull Collection<NamespacedKey> recipes)
recipes
- the keys of the recipes to discoverrecipes.size()
indicates that all were newboolean undiscoverRecipe(@NotNull @NotNull NamespacedKey recipe)
recipe
- the key of the recipe to undiscoverint undiscoverRecipes(@NotNull @NotNull Collection<NamespacedKey> recipes)
recipes
- the keys of the recipes to undiscoverrecipes.size()
indicates
that all were undiscoveredboolean hasDiscoveredRecipe(@NotNull @NotNull NamespacedKey recipe)
recipe
- the key of the recipe to check@NotNull @NotNull Set<NamespacedKey> getDiscoveredRecipes()
@Deprecated @Nullable @Nullable Entity getShoulderEntityLeft()
@Deprecated void setShoulderEntityLeft(@Nullable @Nullable Entity entity)
Parrot
entities.entity
- left shoulder entity@Deprecated @Nullable @Nullable Entity getShoulderEntityRight()
@Deprecated void setShoulderEntityRight(@Nullable @Nullable Entity entity)
Parrot
entities.entity
- right shoulder entityvoid openSign(@NotNull Sign sign)
sign
- The sign to openboolean dropItem(boolean dropAll)
ItemStack
or just 1 of the items.dropAll
- True to drop entire stack, false to drop 1 of the stackfloat getExhaustion()
Exhaustion controls how fast the food level drops. While you have a certain amount of exhaustion, your saturation will drop to zero, and then your food will drop to zero.
void setExhaustion(float value)
value
- Exhaustion levelfloat getSaturation()
Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.
void setSaturation(float value)
value
- Saturation levelint getFoodLevel()
void setFoodLevel(int value)
value
- New food levelint getSaturatedRegenRate()
void setSaturatedRegenRate(int ticks)
ticks
- the amount of ticks to gain 1 health.int getUnsaturatedRegenRate()
void setUnsaturatedRegenRate(int ticks)
ticks
- the amount of ticks to gain 1 health.int getStarvationRate()
void setStarvationRate(int ticks)
ticks
- the amount of ticks to lose 1 healthCopyright © 2021. All rights reserved.