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.
|
boolean |
discoverRecipe(NamespacedKey recipe)
Discover a recipe for this player such that it has not already been
discovered.
|
int |
discoverRecipes(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.
|
Location |
getBedLocation()
Gets the location of the bed the player is currently sleeping in
|
int |
getCooldown(Material material)
Get the cooldown time in ticks remaining for the specified material.
|
Set<NamespacedKey> |
getDiscoveredRecipes()
Get an immutable set of recipes this entity has discovered.
|
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
|
GameMode |
getGameMode()
Gets this human's current
GameMode |
PlayerInventory |
getInventory()
Get the player's inventory.
|
ItemStack |
getItemInHand()
Deprecated.
Humans may now dual wield in their off hand, use explicit
methods in
PlayerInventory . |
ItemStack |
getItemOnCursor()
Returns the ItemStack currently on your cursor, can be empty.
|
MainHand |
getMainHand()
Gets the player's selected main hand
|
String |
getName()
Returns the name of this player
|
InventoryView |
getOpenInventory()
Gets the inventory view the player is currently viewing.
|
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.
|
Entity |
getShoulderEntityLeft()
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
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(Material material)
Check whether a cooldown is active on the specified material.
|
boolean |
hasDiscoveredRecipe(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 |
isHandRaised()
Check if the player currently has their hand raised (ie about to begin
blocking).
|
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 |
openMerchant(Merchant merchant,
boolean force)
Starts a trade between the player and the merchant.
|
InventoryView |
openMerchant(Villager trader,
boolean force)
Starts a trade between the player and the villager.
|
InventoryView |
openWorkbench(Location location,
boolean force)
Opens an empty workbench inventory window with the player's inventory
on the bottom.
|
void |
setCooldown(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(GameMode mode)
Sets this human's current
GameMode |
void |
setItemInHand(ItemStack item)
Deprecated.
Humans may now dual wield in their off hand, use explicit
methods in
PlayerInventory . |
void |
setItemOnCursor(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(Entity entity)
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit. Use with care.
|
void |
setShoulderEntityRight(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(Location location,
boolean force)
Attempts to make the entity sleep at the given location.
|
boolean |
undiscoverRecipe(NamespacedKey recipe)
Undiscover a recipe for this player such that it has already been
discovered.
|
int |
undiscoverRecipes(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, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getCanPickupItems, getCategory, getCollidableExemptions, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isInvisible, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setCanPickupItems, setCollidable, setGliding, setInvisible, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming, swingMainHand, swingOffHand
getAttribute
damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
addPassenger, addScoreboardTag, eject, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isOnGround, isPersistent, isSilent, 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
getMetadata, hasMetadata, removeMetadata, setMetadata
sendMessage, sendMessage, sendMessage, sendMessage
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
getCustomName, setCustomName
getPersistentDataContainer
launchProjectile, launchProjectile
getUniqueId
@NotNull String getName()
getName
in interface AnimalTamer
getName
in interface CommandSender
@NotNull PlayerInventory getInventory()
getInventory
in interface InventoryHolder
@NotNull Inventory getEnderChest()
@NotNull MainHand getMainHand()
boolean setWindowProperty(@NotNull InventoryView.Property prop, int value)
prop
- The property.value
- The value to set the property to.@NotNull InventoryView getOpenInventory()
@Nullable InventoryView openInventory(@NotNull Inventory inventory)
inventory
- The inventory to open@Nullable InventoryView openWorkbench(@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 InventoryView openEnchanting(@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 InventoryView inventory)
inventory
- The view to open@Nullable InventoryView openMerchant(@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 InventoryView openMerchant(@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 tradingvoid closeInventory()
@Deprecated @NotNull ItemStack getItemInHand()
PlayerInventory
.@Deprecated void setItemInHand(@Nullable ItemStack item)
PlayerInventory
.item
- The ItemStack which will end up in the hand@NotNull ItemStack getItemOnCursor()
void setItemOnCursor(@Nullable ItemStack item)
item
- The ItemStack which will end up in the handboolean hasCooldown(@NotNull Material material)
material
- the material to checkint getCooldown(@NotNull Material material)
material
- the material to checkvoid setCooldown(@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 removeint getSleepTicks()
boolean sleep(@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 Location getBedLocation()
IllegalStateException
- if not sleeping@NotNull GameMode getGameMode()
GameMode
void setGameMode(@NotNull GameMode mode)
GameMode
mode
- New game modeboolean isBlocking()
boolean isHandRaised()
int getExpToLevel()
float getAttackCooldown()
boolean discoverRecipe(@NotNull NamespacedKey recipe)
recipe
- the key of the recipe to discoverint discoverRecipes(@NotNull Collection<NamespacedKey> recipes)
recipes
- the keys of the recipes to discoverrecipes.size()
indicates that all were newboolean undiscoverRecipe(@NotNull NamespacedKey recipe)
recipe
- the key of the recipe to undiscoverint undiscoverRecipes(@NotNull Collection<NamespacedKey> recipes)
recipes
- the keys of the recipes to undiscoverrecipes.size()
indicates
that all were undiscoveredboolean hasDiscoveredRecipe(@NotNull NamespacedKey recipe)
recipe
- the key of the recipe to check@NotNull Set<NamespacedKey> getDiscoveredRecipes()
@Deprecated @Nullable Entity getShoulderEntityLeft()
@Deprecated void setShoulderEntityLeft(@Nullable Entity entity)
Parrot
entities.entity
- left shoulder entity@Deprecated @Nullable Entity getShoulderEntityRight()
@Deprecated void setShoulderEntityRight(@Nullable Entity entity)
Parrot
entities.entity
- right shoulder entityboolean 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.