AnimalTamer
, Attributable
, CommandSender
, Damageable
, Entity
, InventoryHolder
, LivingEntity
, Metadatable
, Nameable
, Permissible
, PersistentDataHolder
, ProjectileSource
, ServerOperator
Player
public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
Entity.Spigot
Modifier and Type | Method | 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.
|
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
|
@Nullable 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(@NotNull Material material) |
Get the cooldown time in ticks remaining for the specified material.
|
@NotNull Inventory |
getEnderChest() |
Get the player's EnderChest inventory
|
int |
getExpToLevel() |
Get the total amount of experience required for the player to 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.
|
@Nullable Entity |
getShoulderEntityLeft() |
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit.
|
@Nullable Entity |
getShoulderEntityRight() |
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit.
|
int |
getSleepTicks() |
Get the sleep ticks of the player.
|
boolean |
hasCooldown(@NotNull 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).
|
@Nullable InventoryView |
openEnchanting(@Nullable Location location,
boolean force) |
Opens an empty enchanting 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 |
openMerchant(@NotNull Villager trader,
boolean force) |
Starts a trade between the player and the villager.
|
@Nullable InventoryView |
openMerchant(@NotNull Merchant merchant,
boolean force) |
Starts a trade between the player and the merchant.
|
void |
openSign(Sign sign) |
Opens an editor window for the specified sign
|
@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 |
setBedSpawnLocation(@Nullable Location location) |
Sets the Location where the player will spawn at their bed.
|
void |
setBedSpawnLocation(@Nullable Location location,
boolean force) |
Sets the Location where the player will spawn at their bed.
|
void |
setCooldown(@NotNull Material material,
int ticks) |
Set a cooldown on the specified material for a certain amount of ticks.
|
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 |
setShoulderEntityLeft(@Nullable Entity entity) |
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit.
|
void |
setShoulderEntityRight(@Nullable Entity entity) |
Deprecated.
There are currently no well defined semantics regarding
serialized entities in Bukkit.
|
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.
|
getUniqueId
getAttribute
sendMessage, sendMessage, sendMessage, sendMessage
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
addPotionEffect, addPotionEffect, addPotionEffects, attack, 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, isJumping, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowsStuck, setCanPickupItems, setCollidable, setGliding, setJumping, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setShieldBlockingDelay, setSwimming, swingMainHand, swingOffHand
getMetadata, hasMetadata, removeMetadata, setMetadata
getCustomName, setCustomName
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
getPersistentDataContainer
launchProjectile, launchProjectile
isOp, setOp
@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 tradingvoid 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 removeint getSleepTicks()
@Nullable @Nullable Location getBedSpawnLocation()
@Nullable @Nullable Location getPotentialBedLocation()
void setBedSpawnLocation(@Nullable @Nullable Location location)
location
- where to set the respawn locationvoid setBedSpawnLocation(@Nullable @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 @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 undiscovered@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 openCopyright © 2020. All rights reserved.