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.
|
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(Villager trader,
boolean force) |
Starts a trade between the player and the villager.
|
InventoryView |
openMerchant(Merchant merchant,
boolean force) |
Starts a trade between the player and the merchant.
|
InventoryView |
openWorkbench(Location location,
boolean force) |
Opens an empty workbench inventory window with the player's inventory
on the bottom.
|
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.
|
getUniqueId
getAttribute
sendMessage, sendMessage
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, 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
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming
getMetadata, hasMetadata, removeMetadata, setMetadata
getCustomName, setCustomName
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
getPersistentDataContainer
launchProjectile, launchProjectile
isOp, setOp
@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()
@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()
int getExpToLevel()
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 entityCopyright © 2019. All rights reserved.