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(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.
|
Location |
getBedLocation()
Gets the location of the bed the player is currently sleeping in
|
Location |
getBedSpawnLocation()
Gets the Location where the player will spawn at their bed, null if
they have not slept in one or their current bed spawn is invalid.
|
int |
getCooldown(Material material)
Get the cooldown time in ticks remaining for the specified material.
|
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 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.
|
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.
|
boolean |
hasCooldown(Material material)
Check whether a cooldown is active on the specified material.
|
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.
|
void |
openSign(Sign sign)
Opens an editor window for the specified sign
|
InventoryView |
openWorkbench(Location location,
boolean force)
Opens an empty workbench inventory window with the player's inventory
on the bottom.
|
Entity |
releaseLeftShoulderEntity()
If there is an Entity on this entities left shoulder, it will be released to the world and returned.
|
Entity |
releaseRightShoulderEntity()
If there is an Entity on this entities left shoulder, it will be released to the world and returned.
|
void |
setBedSpawnLocation(Location location)
Sets the Location where the player will spawn at their bed.
|
void |
setBedSpawnLocation(Location location,
boolean force)
Sets the Location where the player will spawn at their bed.
|
void |
setCooldown(Material material,
int ticks)
Set a cooldown on the specified material for a certain amount of ticks.
|
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 |
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.
|
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, getActiveItem, getActivePotionEffects, getArrowsStuck, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getHandRaisedTime, 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, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowsStuck, setCanPickupItems, setCollidable, setGliding, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setShieldBlockingDelay, setSwimming
getAttribute
damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
addPassenger, addScoreboardTag, 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, isInsideVehicle, isInvulnerable, 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, teleportAsync, teleportAsync
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()
void closeInventory(@NotNull InventoryCloseEvent.Reason reason)
reason
- why the inventory is closing@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()
@Nullable Location getBedSpawnLocation()
void setBedSpawnLocation(@Nullable Location location)
location
- where to set the respawn locationvoid setBedSpawnLocation(@Nullable Location location, boolean force)
location
- where to set the respawn locationforce
- whether to forcefully set the respawn location even if a
valid bed is not presentboolean 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()
isHandRaised
in interface LivingEntity
int getExpToLevel()
@Nullable Entity releaseLeftShoulderEntity()
@Nullable Entity releaseRightShoulderEntity()
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 undiscovered@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 entityvoid openSign(@NotNull Sign sign)
sign
- The sign to openCopyright © 2022. All rights reserved.