public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, InventoryHolder
限定符和类型 | 方法和说明 |
---|---|
void |
closeInventory()
强制关闭玩家当前打开的物品栏视图.
|
int |
getCooldown(Material material)
获取指定物品的冷却时长 (以tick为单位).
|
Inventory |
getEnderChest()
获取玩家的末影箱物品栏.
|
int |
getExpToLevel()
获取玩家升级所需经验总额.
|
GameMode |
getGameMode()
获取此人类当前的
游戏模式 . |
PlayerInventory |
getInventory()
获取玩家的物品栏(俗称背包).
|
ItemStack |
getItemInHand()
已过时。
人类现能双持, 请使用
PlayerInventory 中更明确的方法 |
ItemStack |
getItemOnCursor()
返回你的鼠标正在拖动的物品, 可能为空.
|
MainHand |
getMainHand()
获取玩家设置的主手.
|
java.lang.String |
getName()
返回该玩家的玩家名.
|
InventoryView |
getOpenInventory()
获取玩家正在查看的物品栏.
|
Entity |
getShoulderEntityLeft()
已过时。
Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
|
Entity |
getShoulderEntityRight()
已过时。
Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
|
int |
getSleepTicks()
获取玩家的睡眠时间 (以tick为单位), 该值可能有上限.
|
boolean |
hasCooldown(Material material)
检查指定物品是否处于冷却状态.
|
boolean |
isBlocking()
检查玩家是否正在格挡 (换言之, 就是他们使用盾牌, 进入了格挡状态).
|
boolean |
isHandRaised()
检查玩家是否举起了他们的手 (换言之, 就是他们刚使用盾牌(这时isBlocking返回false),
数百毫秒后将进入格挡状态(这时isBlocking返回true)).
|
boolean |
isSleeping()
返回玩家是否处于睡眠状态.
|
InventoryView |
openEnchanting(Location location,
boolean force)
打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.
|
InventoryView |
openInventory(Inventory inventory)
打开一个物品栏, 窗口顶部为你指定的物品栏, 底部为玩家物品栏(背包).
|
void |
openInventory(InventoryView inventory)
打开指定的物品栏.
|
InventoryView |
openMerchant(Merchant merchant,
boolean force)
与某商人开始交易.
|
InventoryView |
openMerchant(Villager trader,
boolean force)
与某村民开始交易.
|
InventoryView |
openWorkbench(Location location,
boolean force)
打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.
|
void |
setCooldown(Material material,
int ticks)
设置指定物品的冷却时长.
|
void |
setGameMode(GameMode mode)
设置此人类的
游戏模式 . |
void |
setItemInHand(ItemStack item)
已过时。
人类现能双持, 请使用
PlayerInventory 中更明确的方法 |
void |
setItemOnCursor(ItemStack item)
设置你正在拖动的物品, 将替换你所拖动的任何物品.
|
void |
setShoulderEntityLeft(Entity entity)
已过时。
Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
|
void |
setShoulderEntityRight(Entity entity)
已过时。
Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
|
boolean |
setWindowProperty(InventoryView.Property prop,
int value)
若玩家当前打开了一个物品栏窗口, 此方法将设置窗口的属性, 比如酿造台的酿造进度.
|
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway
getAttribute
damage, damage, getHealth, getMaxHealth, resetMaxHealth, setHealth, setMaxHealth
addPassenger, addScoreboardTag, eject, getEntityId, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isOnGround, isSilent, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPortalCooldown, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
getMetadata, hasMetadata, removeMetadata, setMetadata
sendMessage, sendMessage
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
getCustomName, setCustomName
launchProjectile, launchProjectile
getUniqueId
java.lang.String getName()
原文:Returns the name of this player
getName
在接口中 AnimalTamer
getName
在接口中 CommandSender
PlayerInventory getInventory()
原文:Get the player's inventory.
getInventory
在接口中 InventoryHolder
Inventory getEnderChest()
原文:Get the player's EnderChest inventory
MainHand getMainHand()
原文:Gets the player's selected main hand
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.
prop
- 窗口属性value
- 要设置的属性值InventoryView getOpenInventory()
原文:Gets the inventory view the player is currently viewing. If they do not have an inventory window open, it returns their internal crafting view.
InventoryView openInventory(Inventory inventory)
原文:Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.
inventory
- 要打开的物品栏InventoryView openWorkbench(Location location, boolean force)
原文:Opens an empty workbench inventory window with the player's inventory on the bottom.
location
- 工作台位置. 若为null, 将使用玩家所处位置force
- 若为false, 同时指定位置不是工作台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向
玩家展示工作台界面)InventoryView openEnchanting(Location location, boolean force)
原文:Opens an empty enchanting inventory window with the player's inventory on the bottom.
location
- 附魔台位置. 若为null, 将使用玩家所处位置force
- 若为false, 同时指定位置不是附魔台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向
玩家展示附魔台界面)void openInventory(InventoryView inventory)
原文:Opens an inventory window to the specified inventory view.
inventory
- 要打开的物品栏视图InventoryView openMerchant(Villager trader, boolean force)
原文:Starts a trade between the player and the villager. Note that only one player may trade with a villager at once. You must use the force parameter for this.
trader
- 与哪位村民交易. 不能为nullforce
- 是否强制开始交易, 即使另一名玩家正在与此村民交易InventoryView openMerchant(Merchant merchant, boolean force)
原文:Starts a trade between the player and the merchant. Note that only one player may trade with a merchant at once. You must use the force parameter for this.
merchant
- 与哪个商人交易. 不能为nullforce
- 是否强制开始交易, 即使另一名玩家正在与此商人交易void closeInventory()
原文:Force-closes the currently open inventory view for this player, if any.
@Deprecated ItemStack getItemInHand()
PlayerInventory
中更明确的方法原文:Returns the ItemStack currently in your hand, can be empty.
@Deprecated void setItemInHand(ItemStack item)
PlayerInventory
中更明确的方法原文:Sets the item to the given ItemStack, this will replace whatever the user was holding.
item
- 要设置的物品堆ItemStack getItemOnCursor()
译注:这个方法是适用于物品拖动场景的, 只有鼠标指针在物品上而没有拖动它是获取不到的(AIR).
原文:Returns the ItemStack currently on your cursor, can be empty. Will always be empty if the player currently has no open window.
void setItemOnCursor(ItemStack item)
原文:Sets the item to the given ItemStack, this will replace whatever the user was moving. Will always be empty if the player currently has no open window.
item
- 要设置的物品堆boolean hasCooldown(Material material)
原文:Check whether a cooldown is active on the specified material.
material
- 要检查的物品种类int getCooldown(Material material)
原文:Get the cooldown time in ticks remaining for the specified material.
material
- 要检查的物品种类void setCooldown(Material material, int ticks)
冷却被服务器用来针对某些物品比如末影珍珠、盾牌等以防止它们被经常重复使用.
请注意: 冷却时间自身不会阻止某个物品被用来使用或攻击.
原文:Set a cooldown on the specified material for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.
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
- 为哪个物品设置冷却ticks
- 冷却时长(以tick为单位)或设为0来移除它boolean isSleeping()
原文:Returns whether this player is slumbering.
int getSleepTicks()
原文:Get the sleep ticks of the player. This value may be capped.
GameMode getGameMode()
void setGameMode(GameMode mode)
mode
- 新游戏模式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).
int getExpToLevel()
原文:Get the total amount of experience required for the player to level
@Deprecated Entity getShoulderEntityLeft()
返回的实体不会在世界内生成, 因此除非这个实体是首次生成的, 大部分对该实体的操作是无效的.
原文:Gets the entity currently perched on the left shoulder or null if no
entity.
The returned entity will not be spawned within the world, so most
operations are invalid unless the entity is first spawned in.
@Deprecated void setShoulderEntityLeft(Entity entity)
请注意: 只有实体的副本将被设置为显示在肩膀上的实体.
也请注意游戏客户端目前只会渲染鹦鹉
的坐在肩膀上的行为.
原文:Sets the entity currently perched on the left shoulder, or null to
remove. This method will remove the entity from the world.
Note that only a copy of the entity will be set to display on the
shoulder.
Also note that the client will currently only render Parrot
entities.
entity
- 坐在玩家左肩的实体@Deprecated Entity getShoulderEntityRight()
返回的实体不会在世界内生成, 因此除非这个实体是首次生成的, 大部分对该实体的操作是无效的.
原文:Gets the entity currently perched on the right shoulder or null if no
entity.
The returned entity will not be spawned within the world, so most
operations are invalid unless the entity is first spawned in.
@Deprecated void setShoulderEntityRight(Entity entity)
请注意: 只有实体的副本将被设置为显示在肩膀上的实体.
也请注意游戏客户端目前只会渲染鹦鹉
的坐在肩膀上的行为.
原文:Sets the entity currently perched on the right shoulder, or null to
remove. This method will remove the entity from the world.
Note that only a copy of the entity will be set to display on the
shoulder.
Also note that the client will currently only render Parrot
entities.
entity
- 坐在玩家右肩的实体