接口 Player

所有超级接口:
AnimalTamer, Attributable, CommandSender, ConfigurationSerializable, Conversable, Damageable, Entity, HumanEntity, InventoryHolder, LivingEntity, Metadatable, Nameable, OfflinePlayer, Permissible, PersistentDataHolder, PluginMessageRecipient, ProjectileSource, ServerOperator

public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient
玩家对象
  • 方法详细资料

    • getName

      返回该玩家的玩家名.

      原文:Returns the name of this player

      指定者:
      getName 在接口中 AnimalTamer
      指定者:
      getName 在接口中 CommandSender
      指定者:
      getName 在接口中 HumanEntity
      指定者:
      getName 在接口中 OfflinePlayer
      返回:
      玩家名
    • getDisplayName

      @NotNull @NotNull String getDisplayName()
      获得玩家在聊天信息中的昵称.

      这个昵称只显示在聊天信息中,能以颜色加以修饰.

      原文:Gets the "friendly" name to display of this player. This may include color.

      Note that this name will not be displayed in game, only in chat and places defined by plugins.

      返回:
      显示的名称.
    • setDisplayName

      void setDisplayName(@Nullable @Nullable String name)
      设置玩家在聊天信息中的昵称.

      这个名字只显示在聊天信息中,能以颜色加以修饰.

      原文Sets the "friendly" name to display of this player. This may include color.

      Note that this name will not be displayed in game, only in chat and places defined by plugins.

      参数:
      name - 显示的名称.
    • getPlayerListName

      @NotNull @NotNull String getPlayerListName()
      得到玩家显示在tab列表中的名称.

      原文:Gets the name that is shown on the player list.

      返回:
      玩家名(显示于tab列表)
    • setPlayerListName

      void setPlayerListName(@Nullable @Nullable String name)
      设置玩家显示在Tab列表中的名称.

      如果设置为null则此名字与getName()相同.

      原文:Sets the name that is shown on the in-game player list.

      If the value is null, the name will be identical to getName().

      参数:
      name - 新的显示在玩家列表中的名字
    • getPlayerListHeader

      @Nullable @Nullable String getPlayerListHeader()
      Gets the currently displayed player list header for this player.
      返回:
      player list header or null
    • getPlayerListFooter

      @Nullable @Nullable String getPlayerListFooter()
      Gets the currently displayed player list footer for this player.
      返回:
      player list header or null
    • setPlayerListHeader

      void setPlayerListHeader(@Nullable @Nullable String header)
      Sets the currently displayed player list header for this player.
      参数:
      header - player list header, null for empty
    • setPlayerListFooter

      void setPlayerListFooter(@Nullable @Nullable String footer)
      Sets the currently displayed player list footer for this player.
      参数:
      footer - player list footer, null for empty
    • setPlayerListHeaderFooter

      void setPlayerListHeaderFooter(@Nullable @Nullable String header, @Nullable @Nullable String footer)
      Sets the currently displayed player list header and footer for this player.
      参数:
      header - player list header, null for empty
      footer - player list footer, null for empty
    • setCompassTarget

      void setCompassTarget(@NotNull @NotNull Location loc)
      设置玩家指南针的指向的位置(Location).

      原文:Set the target of the player's compass.

      参数:
      loc - 指向
    • getCompassTarget

      @NotNull @NotNull Location getCompassTarget()
      得到玩家指南针的指向的位置(Location).

      译注:默认为出生点.

      原文: Get the previously set compass target.

      返回:
      指向
    • getAddress

      得到一个Address对象,包括这个玩家的IP以及登入端口.

      原文:Gets the socket address of this player

      返回:
      玩家的Address对象
    • sendRawMessage

      void sendRawMessage(@NotNull @NotNull String message)
      发送一条不含颜色代码的消息.

      译注:就是会把颜色代码过滤掉然后CommandSender.sendMessage(java.lang.String)

      原文:Sends this sender a message raw

      指定者:
      sendRawMessage 在接口中 Conversable
      参数:
      message - 要发送的消息
    • kickPlayer

      void kickPlayer(@Nullable @Nullable String message)
      踢出玩家,并且发送一条自定义的踢出消息.

      原文:Kicks player with custom kick message.

      参数:
      message - 踢出消息
    • chat

      void chat(@NotNull @NotNull String msg)
      强制玩家发送一个聊天消息,或强制使用命令(需要在内容前加 "/").

      原文:Says a message (or runs a command).

      参数:
      msg - 要发送的聊天消息
    • performCommand

      boolean performCommand(@NotNull @NotNull String command)
      强制玩家执行某个命令.

      原文:Makes the player perform the given command

      参数:
      command - 要执行的命令(不带'/')
      返回:
      JavaPlugin内的onCommand()方法的返回值
    • isOnGround

      @Deprecated boolean isOnGround()
      已过时。
      This value is controlled only by the client and is therefore unreliable and vulnerable to spoofing and/or desync depending on the context/time which it is accessed
      Returns true if the entity is supported by a block. This value is a state updated by the client after each movement.
      指定者:
      isOnGround 在接口中 Entity
      返回:
      True if entity is on ground.
      另请参阅:
    • isSneaking

      boolean isSneaking()
      判断玩家是否在潜行中.

      原文:Returns if the player is in sneak mode

      返回:
      如果在潜行模式返回true
    • setSneaking

      void setSneaking(boolean sneak)
      设置玩家潜行模式开启/取消.

      原文:Sets the sneak mode the player

      参数:
      sneak - true表示在潜行,false反之
    • isSprinting

      boolean isSprinting()
      判断玩家是否在疾跑.

      原文:Gets whether the player is sprinting or not.

      返回:
      true表示玩家在疾跑,false反之
    • setSprinting

      void setSprinting(boolean sprinting)
      设置玩家疾跑状态开启/取消.

      原文:Sets whether the player is sprinting or not.

      参数:
      sprinting - true表示在疾跑,false反之
    • saveData

      void saveData()
      保存玩家数据(位置,血量,背包,移动方向 及其他信息至在world/player文件夹中的"玩家名.dat"文件).

      原文:Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder

    • loadData

      void loadData()
      加载上一次保存的数据(从在world/player文件夹中的玩家名.dat文件中加载 位置,血量,背包,移动方向及其他信息).

      这将会覆盖当前内存中的数据.

      原文:Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder.

      Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file.

    • setSleepingIgnored

      void setSleepingIgnored(boolean isSleeping)
      是否忽略该玩家.如果设置为true,不需要该玩家睡觉,只需其他人睡觉,时间也能改变.

      如果所有玩家都把这个项设置为true但是没有人睡觉,则什么事也不会发生.

      原文:Sets whether the player is ignored as not sleeping. If everyone is either sleeping or has this flag set, then time will advance to the next day. If everyone has this flag set but no one is actually in bed, then nothing will happen.

      参数:
      isSleeping - 是否忽略该玩家
    • isSleepingIgnored

      boolean isSleepingIgnored()
      查看setSleepingIgnored(boolean)方法所设置的值.

      默认为false.

      原文:Returns whether the player is sleeping ignored.

      返回:
      判断是否全部睡觉时是否忽略该玩家
    • getBedSpawnLocation

      @Nullable @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.
      指定者:
      getBedSpawnLocation 在接口中 OfflinePlayer
      返回:
      Bed Spawn Location if bed exists, otherwise null.
    • setBedSpawnLocation

      void setBedSpawnLocation(@Nullable @Nullable Location location)
      Sets the Location where the player will spawn at their bed.
      参数:
      location - where to set the respawn location
    • setBedSpawnLocation

      void setBedSpawnLocation(@Nullable @Nullable Location location, boolean force)
      Sets the Location where the player will spawn at their bed.
      参数:
      location - where to set the respawn location
      force - whether to forcefully set the respawn location even if a valid bed is not present
    • playNote

      @Deprecated void playNote(@NotNull @NotNull Location loc, byte instrument, byte note)
      已过时。
      不安全的参数
      Play a note for a player at a location. This requires a note block at the particular location (as far as the client is concerned). This will not work without a note block. This will not work with cake.

      译注:貌似就是让一个音符盒播放指定乐器的指定声音..没试过...

      参数:
      loc - 音符盒的位置.
      instrument - 乐器ID
      note - 音符ID.
    • playNote

      void playNote(@NotNull @NotNull Location loc, @NotNull @NotNull Instrument instrument, @NotNull @NotNull Note note)
      Play a note for a player at a location. This requires a note block at the particular location (as far as the client is concerned). This will not work without a note block. This will not work with cake.

      译注:貌似就是让一个音符盒播放指定乐器的指定声音..没试过...

      参数:
      loc - 音符盒的位置
      instrument - 乐器ID
      note - 音符
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch)
      向玩家在某个位置播放一个声音.

      当位置或声音为null或玩家的客户端没开启声音时,这个方法无效.

      原文:Play a sound for a player at the location.

      This function will fail silently if Location or Sound are null.

      参数:
      location - 要播放声音的位置
      sound - 要播放的声音
      volume - 音量 默认 1F
      pitch - 音高 默认 0F
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch)
      向玩家在某个位置播放一个声音.

      当位置或声音为null或玩家的客户端没开启声音时,这个方法无效. 玩家客户端不存在指定声音本操作也将无效.

      原文:Play a sound for a player at the location.

      This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.

      参数:
      location - 要播放声音的位置
      sound - 要播放的声音
      volume - 音量 默认 1F
      pitch - 音高 默认 0F
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      向玩家在指定位置播放声音.

      当位置或声音为null或玩家的客户端没开启声音时,这个方法无效.

      原文:Play a sound for a player at the location.

      This function will fail silently if Location or Sound are null.

      参数:
      location - 声音播放位置
      sound - 要播放的声音
      category - 声音的分类
      volume - 音量
      pitch - 音调
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      向玩家在指定位置播放声音.

      当位置或声音为null或玩家的客户端没开启声音时,这个方法无效. 玩家客户端不存在指定声音本操作也将无效.

      原文:Play a sound for a player at the location.

      This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.

      参数:
      location - 声音播放位置
      sound - 要播放的声音
      category - 声音的分类
      volume - 音量
      pitch - 音调
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, float volume, float pitch)
      Play a sound for a player at the location of the entity.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, float volume, float pitch)
      Play a sound for a player at the location of the entity.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a sound for a player at the location of the entity.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a sound for a player at the location of the entity.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • stopSound

      void stopSound(@NotNull @NotNull Sound sound)
      停止播放指定的声音.

      原文:Stop the specified sound from playing.

      参数:
      sound - 指定声音
    • stopSound

      void stopSound(@NotNull @NotNull String sound)
      停止播放指定的声音.

      原文:Stop the specified sound from playing.

      参数:
      sound - 指定声音
    • stopSound

      void stopSound(@NotNull @NotNull Sound sound, @Nullable @Nullable SoundCategory category)
      停止播放指定的声音.

      原文:Stop the specified sound from playing.

      参数:
      sound - 指定声音
      category - 声音类别
    • stopSound

      void stopSound(@NotNull @NotNull String sound, @Nullable @Nullable SoundCategory category)
      停止播放指定的声音.

      原文:Stop the specified sound from playing.

      参数:
      sound - 指定声音
      category - 声音类别
    • stopSound

      void stopSound(@NotNull @NotNull SoundCategory category)
      Stop the specified sound category from playing.
      参数:
      category - the sound category to stop
    • stopAllSounds

      void stopAllSounds()
      停止播放所有声音.

      原文:Stop all sounds from playing.

    • playEffect

      @Deprecated void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, int data)
      已过时。
      不安全的参数
      在某个位置(Location)向玩家播放一个粒子效果(Effect).

      原文:Plays an effect to just this player.

      参数:
      loc - 要播放粒子效果的位置
      effect - 要播放的粒子效果
      data - 某些效果需要的附加值.
    • playEffect

      <T> void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, @Nullable T data)
      在某个位置(Location)向玩家播放一个粒子效果(Effect).

      原文:Plays an effect to just this player.

      译注1:data参数一般为0就行,但是如果要播放的效果为

      Effect.StepSound(方块被打破时的粒子效果),data就为Material类型.

      例:playEffect(loc, Effect.StepSound, Material.REDSTONE_BLOCK)将 在loc的位置播放一个红石块(REDSTONE_BLOCK)被打破的粒子效果.

      译注2:Material只能表示主ID,不能表示副ID,所以播放绿色羊毛的打破效果貌似是不可能的, 但是由于data是泛型,我们猜测会不会data也可以是能表示任何方块类型?由于时间关系不能测试,请谅解.

      类型参数:
      T - Material
      参数:
      loc - 要播放粒子效果的位置
      effect - 要播放的粒子效果
      data - Effect.StepSound所需的附加值,一般为Material
    • breakBlock

      boolean breakBlock(@NotNull @NotNull Block block)
      Force this player to break a Block using the item in their main hand. This method will respect enchantments, handle item durability (if applicable) and drop experience and the correct items according to the tool/item in the player's hand.

      Note that this method will call a BlockBreakEvent, meaning that this method may not be successful in breaking the block if the event was cancelled by a third party plugin. Care should be taken if running this method in a BlockBreakEvent listener as recursion may be possible if it is invoked on the same Block being broken in the event.

      Additionally, a BlockDropItemEvent is called for the items dropped by this method (if successful).

      The block must be in the same world as the player.

      参数:
      block - the block to break
      返回:
      true if the block was broken, false if the break failed
    • sendBlockChange

      @Deprecated void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull Material material, byte data)
      已过时。
      不安全的参数
      向该玩家发送一个伪造的指定位置的方块(Block)更改数据包.这不会改变世界中的方块.

      原文:Send a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.

      译注:意思就是,向玩家发送一个伪造的,更新方块的数据包,那个位置本来是石头的,这个玩家看起来那里就变成了钻石矿.

      但是这并没有真的在世界中放置一个钻石矿.其他玩家看到的还是石头.挖掉后也不会真的掉钻石.(我想还是举例说明比较好..)

      例1:sendBlockChange(loc,Material.DIAMOND_ORE,(byte)0)将让玩家的客户端认为loc的位置是一个钻石矿石(DIAMOND_ORE) 但其实并没有改变.

      例2:sendBlockChange(loc,Material.WOOL,(byte)14)将让玩家的客户端认为loc的位置是一个红色羊毛(附加值为14的WOOL).

      参数:
      loc - 要改变的方块的位置
      material - 要改变成的方块的类型
      data - 要改变成的方块的副ID
    • sendBlockChange

      void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull BlockData block)
      向该玩家发送一个伪造的指定位置的方块(Block)更改数据包.这不会改变世界中的方块.

      原文:Send a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.

      参数:
      loc - 要改变的方块的位置
      block - 新方块
    • sendBlockChanges

      void sendBlockChanges(@NotNull @NotNull Collection<BlockState> blocks)
      Send a multi-block change. This fakes a block change packet for a user at multiple locations. This will not actually change the world in any way.

      This method may send multiple packets to the client depending on the blocks in the collection. A packet must be sent for each chunk section modified, meaning one packet for each 16x16x16 block area. Even if only one block is changed in two different chunk sections, two packets will be sent.

      Additionally, this method cannot guarantee the functionality of changes being sent to the player in chunks not loaded by the client. It is the responsibility of the caller to ensure that the client is within range of the changed blocks or to handle any side effects caused as a result.

      参数:
      blocks - the block states to send to the player
    • sendBlockChanges

      @Deprecated void sendBlockChanges(@NotNull @NotNull Collection<BlockState> blocks, boolean suppressLightUpdates)
      已过时。
      suppressLightUpdates is not functional in versions greater than 1.19.4
      Send a multi-block change. This fakes a block change packet for a user at multiple locations. This will not actually change the world in any way.

      This method may send multiple packets to the client depending on the blocks in the collection. A packet must be sent for each chunk section modified, meaning one packet for each 16x16x16 block area. Even if only one block is changed in two different chunk sections, two packets will be sent.

      Additionally, this method cannot guarantee the functionality of changes being sent to the player in chunks not loaded by the client. It is the responsibility of the caller to ensure that the client is within range of the changed blocks or to handle any side effects caused as a result.

      参数:
      blocks - the block states to send to the player
      suppressLightUpdates - whether or not light updates should be suppressed when updating the blocks on the client
    • sendBlockDamage

      void sendBlockDamage(@NotNull @NotNull Location loc, float progress)
      Send block damage. This fakes block break progress at a certain location sourced by this player. This will not actually change the block's break progress in any way.
      参数:
      loc - the location of the damaged block
      progress - the progress from 0.0 - 1.0 where 0 is no damage and 1.0 is the most damaged
    • sendBlockDamage

      void sendBlockDamage(@NotNull @NotNull Location loc, float progress, @NotNull @NotNull Entity source)
      Send block damage. This fakes block break progress at a certain location sourced by the provided entity. This will not actually change the block's break progress in any way.

      At the same location for each unique damage source sent to the player, a separate damage overlay will be displayed with the given progress. This allows for block damage at different progress from multiple entities at once.

      参数:
      loc - the location of the damaged block
      progress - the progress from 0.0 - 1.0 where 0 is no damage and 1.0 is the most damaged
      source - the entity to which the damage belongs
    • sendBlockDamage

      void sendBlockDamage(@NotNull @NotNull Location loc, float progress, int sourceId)
      Send block damage. This fakes block break progress at a certain location sourced by the provided entity id. This will not actually change the block's break progress in any way.

      At the same location for each unique damage source sent to the player, a separate damage overlay will be displayed with the given progress. This allows for block damage at different progress from multiple entities at once.

      参数:
      loc - the location of the damaged block
      progress - the progress from 0.0 - 1.0 where 0 is no damage and 1.0 is the most damaged
      sourceId - the entity id of the entity to which the damage belongs. Can be an id that does not associate directly with an existing or loaded entity.
    • sendEquipmentChange

      void sendEquipmentChange(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull EquipmentSlot slot, @Nullable @Nullable ItemStack item)
      向玩家发送某个实体的盔甲槽变化数据包. 本方法可针对指定玩家伪造某个实体的盔甲, 且不会实际改变指定实体的盔甲槽内容.

      原文:Send the equipment change of an entity. This fakes the equipment change of an entity for a user. This will not actually change the inventory of the specified entity in any way.

      参数:
      entity - 玩家会看到哪个实体的变化
      slot - 要伪造哪一盔甲槽的变化
      item - 玩家将看到的盔甲物品
    • sendEquipmentChange

      void sendEquipmentChange(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull Map<EquipmentSlot,ItemStack> items)
      Send multiple equipment changes for the target entity. This will not actually change the entity's equipment in any way.
      参数:
      entity - the entity whose equipment to change
      items - the slots to change, where the values are the items to which the slot should be changed. null values will set the slot to air
    • sendSignChange

      void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines) throws IllegalArgumentException
      向该玩家发送一个伪造的牌子(Sign)上的字的更改数据包.这不会改变世界中的任何方块.

      如果那个位置没有牌子,这个方法将用sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte) 方法在那个位置伪造一个牌子然后更改它.

      如果客户端认为在指定的位置没有牌子,则会显示一个错误给玩家.

      原文:Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent via sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte).

      If the client does not have a sign at the given location it will display an error message to the user.

      译注:该方法类似于sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte), 只不过sendBlockChange是伪装一个方块成其他方块,而它只是伪装牌子上的字.

      参数:
      loc - 要让玩家看起来改变了的牌子的位置
      lines - null或大小等于4的String数组;数组中每个元素都代表一行
      抛出:
      IllegalArgumentException - 如果location参数为null
      IllegalArgumentException - 如果lines数组的长度小于4
    • sendSignChange

      void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException
      向该玩家发送一个伪造的牌子(Sign)上的字的更改数据包.这不会改变世界中的任何方块.

      如果那个位置没有牌子,这个方法将用sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte) 方法在那个位置伪造一个牌子然后更改它.

      如果客户端认为在指定的位置没有牌子,则会显示一个错误给玩家.

      原文:Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent via sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte).

      If the client does not have a sign at the given location it will display an error message to the user.

      参数:
      loc - 要让玩家看起来改变了的牌子的位置
      lines - null或大小等于4的String数组;数组中每个元素都代表一行
      dyeColor - 告示牌的颜色(文字的颜色)
      抛出:
      IllegalArgumentException - 如果location参数为null
      IllegalArgumentException - 如果dyeColor参数为null
      IllegalArgumentException - 如果lines数组的长度小于4
    • sendSignChange

      void sendSignChange(@NotNull @NotNull Location loc, @Nullable @Nullable String[] lines, @NotNull @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException
      向该玩家发送一个伪造的牌子(Sign)上的字的更改数据包.这不会改变世界中的任何方块.

      如果那个位置没有牌子,这个方法将用sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte) 方法在那个位置伪造一个牌子然后更改它.

      如果客户端认为在指定的位置没有牌子,则会显示一个错误给玩家.

      原文:Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way. This method will use a sign at the location's block or a faked sign sent via sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte).

      If the client does not have a sign at the given location it will display an error message to the user.

      参数:
      loc - 要让玩家看起来改变了的牌子的位置
      lines - null或大小等于4的String数组;数组中每个元素都代表一行
      dyeColor - 告示牌的颜色(文字的颜色)
      hasGlowingText - 文字是否发光
      抛出:
      IllegalArgumentException - 如果location参数为null
      IllegalArgumentException - 如果dyeColor参数为null
      IllegalArgumentException - 如果lines数组的长度小于4
    • sendMap

      void sendMap(@NotNull @NotNull MapView map)
      Render a map and send it to the player in its entirety. This may be used when streaming the map in the normal manner is not desirable.
      参数:
      map - The map to be sent
    • sendHurtAnimation

      void sendHurtAnimation(float yaw)
      Send a hurt animation. This fakes incoming damage towards the player from the given yaw relative to the player's direction.
      参数:
      yaw - the yaw in degrees relative to the player's direction where 0 is in front of the player, 90 is to the right, 180 is behind, and 270 is to the left
    • addCustomChatCompletions

      void addCustomChatCompletions(@NotNull @NotNull Collection<String> completions)
      Add custom chat completion suggestions shown to the player while typing a message.
      参数:
      completions - the completions to send
    • removeCustomChatCompletions

      void removeCustomChatCompletions(@NotNull @NotNull Collection<String> completions)
      Remove custom chat completion suggestions shown to the player while typing a message. Online player names cannot be removed with this method. This will affect only custom completions added by addCustomChatCompletions(Collection) or setCustomChatCompletions(Collection).
      参数:
      completions - the completions to remove
    • setCustomChatCompletions

      void setCustomChatCompletions(@NotNull @NotNull Collection<String> completions)
      Set the list of chat completion suggestions shown to the player while typing a message.

      If completions were set previously, this method will remove them all and replace them with the provided completions.

      参数:
      completions - the completions to set
    • updateInventory

      @Internal void updateInventory()
      刷新玩家的背包.确保玩家的背包和服务器内存中玩家的背包一致.

      译注:在以前的版本(好吧我也不知道是什么版本)中假如不调用该方法当更改背包时会出现莫名其妙的事情,比如 背包看起来是空的,点一下空的格突然出现了东西之类的....

      原文:Forces an update of the player's entire inventory.

    • getPreviousGameMode

      @Nullable @Nullable GameMode getPreviousGameMode()
      Gets this player's previous GameMode
      返回:
      Previous game mode or null
    • setPlayerTime

      void setPlayerTime(long time, boolean relative)
      设置该玩家客户端的时间,单位为tick.

      假如relative为true则玩家时间会随着世界时间变动而变动,并且保持一个差值,反之客户端时间固定不动.

      注意!如果relative为true,那么time表示的就是客户端的时间与世界的时间之差(相对于世界的时间),而如果为false 那么time表示的就是一个绝对的时间.

      原文:Sets the current time on the player's client. When relative is true the player's time will be kept synchronized to its world time with the specified offset.

      When using non relative time the player's time will stay fixed at the specified time parameter. It's up to the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime().

      参数:
      time - 绝对时间或与世界的时间之差,单位为tick
      relative - 是否让玩家的时间和世界的时间保持一个差值
    • getPlayerTime

      long getPlayerTime()
      得到玩家的客户端的当前时间,单位为tick.

      原文:Returns the player's current timestamp.

      返回:
      玩家客户端的时间,单位为tick
    • getPlayerTimeOffset

      long getPlayerTimeOffset()
      返回玩家的客户端的当前时间与玩家当前世界时间的差值.

      如玩家时间是固定的,则返回玩家时间. 原文:Returns the player's current time offset relative to server time, or the current player's fixed time if the player's time is absolute.

      返回:
      玩家当前时间与当前世界时间的差或玩家当前时间.单位为tick
    • isPlayerTimeRelative

      boolean isPlayerTimeRelative()
      如果玩家时间于当前世界时间保持了一定的差值则返回true.

      原文:Returns true if the player's time is relative to the server time, otherwise the player's time is absolute and will not change its current time unless done so with setPlayerTime().

      返回:
      true if the player's time is relative to the server time.
    • resetPlayerTime

      void resetPlayerTime()
      将玩家时间变为当前世界时间并与世界时间保持同步.

      原文 Restores the normal condition where the player's time is synchronized with the server time.

      Equivalent to calling setPlayerTime(0, true).

    • setPlayerWeather

      void setPlayerWeather(@NotNull @NotNull WeatherType type)
      设置玩家的客户端的天气.

      使用resetPlayerWeather()来恢复正常.

      原文:Sets the type of weather the player will see. When used, the weather status of the player is locked until resetPlayerWeather() is used.

      参数:
      type - 要让玩家看到的天气
    • getPlayerWeather

      @Nullable @Nullable WeatherType getPlayerWeather()
      得到玩家所看到的天气.如果返回null,玩家的天气跟世界的天气一致.

      原文:Returns the type of weather the player is currently experiencing.

      返回:
      玩家所看到的天气或null
    • resetPlayerWeather

      void resetPlayerWeather()
      恢复玩家所看到的天气为世界的天气.

      原文:Restores the normal condition where the player's weather is controlled by server conditions.

    • getExpCooldown

      int getExpCooldown()
      Gets the player's cooldown between picking up experience orbs.
      返回:
      The cooldown in ticks
    • setExpCooldown

      void setExpCooldown(int ticks)
      Sets the player's cooldown between picking up experience orbs.. Note: Setting this to 0 allows the player to pick up instantly, but setting this to a negative value will cause the player to be unable to pick up xp-orbs. Calling this Method will result in PlayerExpCooldownChangeEvent being called.
      参数:
      ticks - The cooldown in ticks
    • giveExp

      void giveExp(int amount)
      给玩家指定经验.

      原文:Gives the player the amount of experience specified.

      参数:
      amount - 要给的经验
    • giveExpLevels

      void giveExpLevels(int amount)
      增加玩家的等级.

      支持负数(减少等级).

      原文:Gives the player the amount of experience levels specified. Levels can be taken by specifying a negative amount.

      参数:
      amount - 要增加的等级(正数)或要减少的等级(负数)
    • getExp

      float getExp()
      得到当前级别升到下一级别经验进度的百分比.

      0表示毫无进展(0%), 0.99表示差一点点(99%), 1表示要升级了(100%).

      原文:Gets the players current experience points towards the next level.

      This is a percentage value. 0 is "no progress" and 1 is "next level".

      返回:
      离下一级的小数形式百分比
    • setExp

      void setExp(float exp)
      设置当前级别升到下一级别经验进度的百分比.

      0表示毫无进展(0%), 0.99表示差一点点(99%), 1表示要升级了(100%).

      Sets the players current experience points towards the next level

      This is a percentage value. 0 is "no progress" and 1 is "next level".

      参数:
      exp - 新的离下一级的小数形式百分比
    • getLevel

      int getLevel()
      得到玩家的等级.

      原文:Gets the players current experience level

      返回:
      玩家的经验等级
    • setLevel

      void setLevel(int level)
      设置玩家的等级

      . 原文:Sets the players current experience level

      参数:
      level - 新的等级
    • getTotalExperience

      int getTotalExperience()
      得到玩家总共获得了多少经验(等级和经验).
      这个数值指玩家随着时间的推移收集的全部经验, 并且此值目前不会在客户端上显示.

      原文:Gets the players total experience points.
      This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.

      返回:
      玩家总共有多少经验
    • setTotalExperience

      void setTotalExperience(int exp)
      设置玩家的总经验值(等级和经验).
      这个数值指玩家随着时间的推移收集的全部经验, 并且此值目前不会在客户端上显示.

      原文: Sets the players current experience points.
      This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.

      参数:
      exp - 总经验值
    • sendExperienceChange

      void sendExperienceChange(float progress)
      Send an experience change. This fakes an experience change packet for a user. This will not actually change the experience points in any way.
      参数:
      progress - Experience progress percentage (between 0.0 and 1.0)
      另请参阅:
    • sendExperienceChange

      void sendExperienceChange(float progress, int level)
      Send an experience change. This fakes an experience change packet for a user. This will not actually change the experience points in any way.
      参数:
      progress - New experience progress percentage (between 0.0 and 1.0)
      level - New experience level
      另请参阅:
    • getAllowFlight

      boolean getAllowFlight()
      判断玩家是否能飞起来.

      译注:如果玩家确实在创造模式,那么一般返回true,除非被setAllowFlight(false).

      原文:Determines if the Player is allowed to fly via jump key double-tap like in creative mode.

      返回:
      玩家能不能飞起来
    • setAllowFlight

      void setAllowFlight(boolean flight)
      设置玩家是否能够飞起来(就像创造模式).

      译注:如果被设置为false,即便是创造模式也不能飞.

      原文:Sets if the Player is allowed to fly via jump key double-tap like in creative mode.

      参数:
      flight - 是否允许该玩家飞行.
    • hidePlayer

      @Deprecated void hidePlayer(@NotNull @NotNull Player player)
      已过时。
      让该玩家看不见某玩家.

      原文:Hides a player from this player

      参数:
      player - 要让该玩家看不见的玩家.
    • hidePlayer

      void hidePlayer(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Player player)
      让该玩家看不见某玩家.

      原文:Hides a player from this player

      参数:
      plugin - Plugin 要隐藏该玩家的插件
      player - Player 要让该玩家看不见的玩家.
    • showPlayer

      @Deprecated void showPlayer(@NotNull @NotNull Player player)
      已过时。
      让该玩家能看到某玩家.

      原文:Allows this player to see a player that was previously hidden

      参数:
      player - 要让该玩家看得见的玩家.
    • showPlayer

      void showPlayer(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Player player)
      让该玩家能看到之前被隐藏的玩家. 如果另一个插件也隐藏了这个玩家, 那么玩家将继续处于隐藏状态直至其他插件也调用了此方法.

      原文:Allows this player to see a player that was previously hidden. If another another plugin had hidden the player too, then the player will remain hidden until the other plugin calls this method too.

      参数:
      plugin - Plugin 要使某玩家现身的插件
      player - Player 使某玩家现身
    • canSee

      boolean canSee(@NotNull @NotNull Player player)
      检查该玩家是否能看到某玩家.

      原文:Checks to see if a player has been hidden from this player

      参数:
      player - 要检查该玩家是否能看到的玩家
      返回:
      true表示能看到,false反之.
    • hideEntity

      @Experimental void hideEntity(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Entity entity)
      从视觉上隐藏一个实体.

      原文:Visually hides an entity from this player.

      参数:
      plugin - 要隐藏此实体的插件实例
      entity - 要隐藏的实体
    • showEntity

      @Experimental void showEntity(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Entity entity)
      Allows this player to see an entity that was previously hidden. If another another plugin had hidden the entity too, then the entity will remain hidden until the other plugin calls this method too.
      参数:
      plugin - Plugin that wants to show the entity
      entity - Entity to show
    • canSee

      @Experimental boolean canSee(@NotNull @NotNull Entity entity)
      Checks to see if an entity has been visually hidden from this player.
      参数:
      entity - Entity to check
      返回:
      True if the provided entity is not being hidden from this player
    • isFlying

      boolean isFlying()
      检查玩家是否在飞.

      原文:Checks to see if this player is currently flying or not.

      返回:
      true表示该玩家在飞,false反之.
    • setFlying

      void setFlying(boolean value)
      设置该玩家飞行状态.

      原文:Makes this player start or stop flying.

      参数:
      value - true表示正在飞
    • setFlySpeed

      void setFlySpeed(float value) throws IllegalArgumentException
      设置该玩家飞行速度.

      速度为-1~1之间,负数代表玩家会反着飞...

      译注:不代表行走的速度!.

      原文:Sets the speed at which a client will fly. Negative values indicate reverse directions.

      参数:
      value - 新的飞行速度,在-1~1之间.
      抛出:
      IllegalArgumentException - 如果速度不在-1~1之间则抛出.
    • setWalkSpeed

      void setWalkSpeed(float value) throws IllegalArgumentException
      设置该玩家行走速度.

      速度在-1~1之间,负数代表玩家会倒着走(整人专用233~)...

      译注:不代表飞行的速度! 原文:Sets the speed at which a client will walk. Negative values indicate reverse directions.

      参数:
      value - 新的行走速度.
      抛出:
      IllegalArgumentException - 当速度不在-1~1时间则抛出
    • getFlySpeed

      float getFlySpeed()
      得到该玩家飞行速度.

      译注:不代表行走速度! 原文:Gets the current allowed speed that a client can fly.

      返回:
      飞行速度.取值-1~1.
    • getWalkSpeed

      float getWalkSpeed()
      得到行走速度.

      译注:不代表飞行速度! 原文:Gets the current allowed speed that a client can walk.

      返回:
      行走速度,取值-1~1
    • setTexturePack

      @Deprecated void setTexturePack(@NotNull @NotNull String url)
      已过时。
      Minecraft已经不使用材质包了,应该用setResourcePack(String)设置资源包(额这不是一个意思么..).
      设置服务器材质包.(因为已过时所以不详解了).

      介绍同setResourcePack(java.lang.String) Request that the player's client download and switch texture packs.

      The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server textures on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting texture packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      • The request is send with "null" as the hash. This might result in newer versions not loading the pack correctly.
      参数:
      url - The URL from which the client will download the texture pack. The string must contain only US-ASCII characters and should be encoded as per RFC 1738.
      抛出:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long.
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url)
      请求玩家的客户端下载并且使用指定资源包.

      玩家的客户端将在后台异步下载新的资源包,并且下载完成后会自动使用那个资源包.如果 这个资源包已经下载好了,客户端先会检查给定URL的资源包跟已经下载的资源包是否一样. 如果不一样就会重新下载,一样就直接使用.

      在开始下载之前,客户端会显示一个GUI确定界面,提示要不要下载资源包.如果玩家选择不要, 就不能下载.

      注意:

      • 如果玩家的客户端没有开启"使用服务器资源包"这个方法将失效. 使用 PlayerResourcePackStatusEvent 方法以推断玩家是否加载了你设置的资源包!
      • 在Minecraft中没有将资源包重置为默认的概念,所以玩家必须重新登陆才能这么做,或者你必须发送一个空白的资源包.
      • 请求以空字符串作hash发送. 这可能导致较新版本的客户端不能正确加载资源包.

      原文:Request that the player's client download and switch texture packs.

      The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server textures on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting texture packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      • The request is send with empty string as the hash. This might result in newer versions not loading the pack correctly.
      参数:
      url - 资源包的URL地址.只能包含US-ASCII字符并且使用RFC 1738编码.
      抛出:
      IllegalArgumentException - 当URL为null时抛出
      IllegalArgumentException - 当URL太长或者不符合规范时抛出
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash)
      请求玩家的客户端下载并且使用指定资源包.

      玩家的客户端将在后台异步下载新的资源包,并且下载完成后会自动使用那个资源包.如果 这个资源包已经下载好了,客户端先会检查给定URL的资源包跟已经下载的资源包是否一样. 如果不一样就会重新下载,一样就直接使用.

      在开始下载之前,客户端会显示一个GUI确定界面,提示要不要下载资源包.如果玩家选择不要, 就不能下载.

      注意:

      • 如果玩家的客户端没有开启"使用服务器资源包"这个方法将失效. 使用 PlayerResourcePackStatusEvent 方法以推断玩家是否加载了你设置的资源包!
      • 在Minecraft中没有将资源包重置为默认的概念,所以玩家必须重新登陆才能这么做,或者你必须发送一个空白的资源包.

      原文:Request that the player's client download and switch resource packs.

      The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server resources on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      参数:
      url - 资源包的URL地址.只能包含US-ASCII字符并且使用RFC 1738编码.
      hash - 资源包文件的sha1哈希值,被用于正确地应用缓存版本的资源包而不需再重新下载(如果之前下载过).必须是20字节长!
      抛出:
      IllegalArgumentException - 当URL为null时抛出
      IllegalArgumentException - 当URL太长或者不符合规范时抛出
      IllegalArgumentException - 当hash为null时抛出Thrown if the hash is null.
      IllegalArgumentException - 当hash不是20字节长时抛出
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt)
      Request that the player's client download and switch resource packs.

      The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server resources on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      • The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
      参数:
      url - The URL from which the client will download the resource pack. The string must contain only US-ASCII characters and should be encoded as per RFC 1738.
      hash - The sha1 hash sum of the resource pack file which is used to apply a cached version of the pack directly without downloading if it is available. Hast to be 20 bytes long!
      prompt - The optional custom prompt message to be shown to client.
      抛出:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
      IllegalArgumentException - Thrown if the hash is not 20 bytes long.
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, boolean force)
      Request that the player's client download and switch resource packs.

      The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server resources on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      • The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
      参数:
      url - The URL from which the client will download the resource pack. The string must contain only US-ASCII characters and should be encoded as per RFC 1738.
      hash - The sha1 hash sum of the resource pack file which is used to apply a cached version of the pack directly without downloading if it is available. Hast to be 20 bytes long!
      force - If true, the client will be disconnected from the server when it declines to use the resource pack.
      抛出:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
      IllegalArgumentException - Thrown if the hash is not 20 bytes long.
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @Nullable @org.jetbrains.annotations.Nullable byte[] hash, @Nullable @Nullable String prompt, boolean force)
      Request that the player's client download and switch resource packs.

      The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.

      Notes:

      • Players can disable server resources on their client, in which case this method will have no affect on them. Use the PlayerResourcePackStatusEvent to figure out whether or not the player loaded the pack!
      • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so or you have to send an empty pack.
      • The request is sent with empty string as the hash when the hash is not provided. This might result in newer versions not loading the pack correctly.
      参数:
      url - The URL from which the client will download the resource pack. The string must contain only US-ASCII characters and should be encoded as per RFC 1738.
      hash - The sha1 hash sum of the resource pack file which is used to apply a cached version of the pack directly without downloading if it is available. Hast to be 20 bytes long!
      prompt - The optional custom prompt message to be shown to client.
      force - If true, the client will be disconnected from the server when it declines to use the resource pack.
      抛出:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
      IllegalArgumentException - Thrown if the hash is not 20 bytes long.
    • getScoreboard

      @NotNull @NotNull Scoreboard getScoreboard()
      获取玩家的计分板.

      原文:Gets the Scoreboard displayed to this player

      返回:
      The current scoreboard seen by this player
    • setScoreboard

      设置玩家的计分板.

      原文:Sets the player's visible Scoreboard.

      参数:
      scoreboard - 要设置成的计分板
      抛出:
      IllegalArgumentException - 如果计分板为null则抛出
      IllegalArgumentException - 如果计分板不是由 scoreboard manager创建的 则抛出.
      IllegalStateException - 如果没有该玩家的数据,即该玩家没有进入过服务器则抛出.
    • getWorldBorder

      @Nullable @Nullable WorldBorder getWorldBorder()
      Gets the WorldBorder visible to this Player, or null if viewing the world's world border.
      返回:
      the player's world border
    • setWorldBorder

      void setWorldBorder(@Nullable @Nullable WorldBorder border)
      Sets the WorldBorder visible to this Player.
      参数:
      border - the border to set, or null to set to the world border of the player's current world
      抛出:
      UnsupportedOperationException - if setting the border to that of a world in which the player is not currently present.
      另请参阅:
    • isHealthScaled

      boolean isHealthScaled()
      获取客户端显示的玩家血量是否被"压缩"了.

      译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)),每一排血量将会被 挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是判断血量是否被压缩了.(完全没用的说..).

      原文:Gets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale().

      返回:
      客户端显示的血量是否被压缩了
      另请参阅:
    • setHealthScaled

      void setHealthScaled(boolean scale)
      设置客户端是否要显示一个"压缩"了的血量.

      显示的血量遵循一个规则: 显示的血量 = getHealth() / getMaxHealth() * getHealthScale().

      译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)),每一排血量将会被 挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是设置血量是否要被"压缩".(完全没用的说..).

      原文:Sets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale().

      Displayed health follows a simple formula displayedHealth = getHealth() / getMaxHealth() * getHealthScale().

      参数:
      scale - 血量是否要被压缩
    • setHealthScale

      void setHealthScale(double scale) throws IllegalArgumentException
      设置客户端显示的血量的"压缩率".

      显示的血量遵循一个规则: 显示的血量 = getHealth() / getMaxHealth() * getHealthScale().

      译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)),每一排血量将会被 挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是设置血量的"压缩率".(完全没用的说..).

      原文:Sets the number to scale health to for the client; this will also setHealthScaled(true).

      Displayed health follows a simple formula displayedHealth = getHealth() / getMaxHealth() * getHealthScale().

      参数:
      scale - 血量的"压缩率"
      抛出:
      IllegalArgumentException - 如果scale <0
      IllegalArgumentException - 如果scale为Double.NaN
      IllegalArgumentException - 如果scale太大了
    • getHealthScale

      double getHealthScale()
      获取客户端显示的血量的"压缩率".

      详见setHealthScale(double) 原文:Gets the number that health is scaled to for the client.

      返回:
      客户端显示的血量条的"压缩率"
      另请参阅:
    • getSpectatorTarget

      @Nullable @Nullable Entity getSpectatorTarget()
      获取旁观者模式下镜头跟随的实体.

      原文:Gets the entity which is followed by the camera when in GameMode.SPECTATOR.

      返回:
      正在跟随的实体, 如果未跟随实体或不处于旁观者模式返回null
    • setSpectatorTarget

      void setSpectatorTarget(@Nullable @Nullable Entity entity)
      设置模式下镜头跟随的实体.

      原文:Sets the entity which is followed by the camera when in GameMode.SPECTATOR.

      参数:
      entity - 要跟随的实体, 设为null重置
      抛出:
      IllegalStateException - 若玩家不处于 旁观者模式
    • sendTitle

      @Deprecated void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle)
      已过时。
      API行为有所改变
      向玩家发送屏幕标题.如果标题和副标题内容都为null, 那么标题将不会被发送出去, 玩家的屏幕也不会有变化. 如果这些参数是空字符串(注意空字符串与null有区别), 那么玩家的屏幕将会被更新(本质上讲, 虽然看起来没啥变化) 如果字符串包含多行文本, 那么只有第一行文本才会被发送出去. 标题将以玩家客户端默认的淡入淡出时间显示.

      原文:Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. be displayed with the client's default timings.

      参数:
      title - 标题文本
      subtitle - 副标题文本
    • sendTitle

      void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle, int fadeIn, int stay, int fadeOut)
      向玩家发送屏幕标题.如果标题和副标题内容都为null, 那么标题将不会被发送出去, 玩家的屏幕也不会有变化. 如果这些参数是空字符串(注意空字符串与null有区别), 那么玩家的屏幕将会被更新(本质上讲, 虽然看起来没啥变化) 如果字符串包含多行文本, 那么只有第一行文本才会被发送出去. 所有时间值都可以取-1来表示最后一次(或者上一次)发送标题所用的值(如果尚无任何标题曾被显示过则取默认值).

      原文:Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. All timings values may take a value of -1 to indicate that they will use the last value sent (or the defaults if no title has been displayed).

      参数:
      title - 标题文本
      subtitle - 副标题文本
      fadeIn - 标题淡入时间,以tick为单位.默认值取10.
      stay - 标题停留/展示时长,以tick为单位.默认值取70.
      fadeOut - 标题淡出时间,以tick为单位.默认值取20.
    • resetTitle

      void resetTitle()
      重置想转玩家显示的屏幕标题. 这将清除已显示的标题/副标题并重置标题显示计时器至默认值.

      原文:Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values.

    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)
      在指定位置产生粒子效果 (the number of times specified by count).

      原文:Sawns the particle (the number of times specified by count) at the target location.

      参数:
      particle - 要产生的粒子效果
      location - 粒子效果产生位置
      count - the number of particles
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count)
      在指定位置产生粒子效果 (the number of times specified by count).

      原文:Sawns the particle (the number of times specified by count) at the target location.

      参数:
      particle - 要产生的粒子效果
      x - 粒子效果产生位置x轴
      y - 粒子效果产生位置y轴
      z - 粒子效果产生位置z轴
      count - the number of particles
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)
      在指定位置产生粒子效果 (the number of times specified by count).

      原文:Sawns the particle (the number of times specified by count) at the target location.

      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - 要产生的粒子效果
      location - 粒子效果产生位置
      count - 粒子数目
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location.
      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - 粒子效果数据类型 (请参阅 Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - 粒子效果的数据或null, 其数据类型取决于Particle.getDataType()
    • getAdvancementProgress

      @NotNull @NotNull AdvancementProgress getAdvancementProgress(@NotNull @NotNull Advancement advancement)
      返回玩家指定进度的完成进度. 原文:Return the player's progression on the specified advancement.
      参数:
      advancement - 进度
      返回:
      有关玩家进度的详细信息
    • getClientViewDistance

      int getClientViewDistance()
      Get the player's current client side view distance.
      Will default to the server view distance if the client has not yet communicated this information,
      返回:
      client view distance as above
    • getPing

      int getPing()
      Gets the player's estimated ping in milliseconds. In Vanilla this value represents a weighted average of the response time to application layer ping packets sent. This value does not represent the network round trip time and as such may have less granularity and be impacted by other sources. For these reasons it should not be used for anti-cheat purposes. Its recommended use is only as a qualitative indicator of connection quality (Vanilla uses it for this purpose in the tab list).
      返回:
      player ping
    • getLocale

      @NotNull @NotNull String getLocale()
      返回玩家本地语言环境. 语言环境值的格式尚未被适当地定义.
      原生 Minecraft 客户端将使用全小写 语言/国家, 用短下划线分隔. 但自定义资源包可能会使用他们想要的任意格式.

      原文:Gets the player's current locale. The value of the locale String is not defined properly.
      The vanilla Minecraft client will use lowercase language / country pairs separated by an underscore, but custom resource packs may use any format they wish.

      返回:
      玩家语言环境
    • updateCommands

      void updateCommands()
      Update the list of commands sent to the client.
      Generally useful to ensure the client has a complete list of commands after permission changes are done.
    • openBook

      void openBook(@NotNull @NotNull ItemStack book)
      为玩家打开一本成书.

      原文:Open a Material.WRITTEN_BOOK for a Player

      参数:
      book - 要为玩家打开的书
    • openSign

      void openSign(@NotNull @NotNull Sign sign)
      Open a Sign for editing by the Player. The Sign must be placed in the same world as the player.
      参数:
      sign - The sign to edit
    • openSign

      void openSign(@NotNull @NotNull Sign sign, @NotNull @NotNull Side side)
      Open a Sign for editing by the Player. The Sign must be placed in the same world as the player.
      参数:
      sign - The sign to edit
      side - The side to edit
    • showDemoScreen

      void showDemoScreen()
      Shows the demo screen to the player, this screen is normally only seen in the demo version of the game.
      Servers can modify the text on this screen using a resource pack.
    • isAllowingServerListings

      boolean isAllowingServerListings()
      Gets whether the player has the "Allow Server Listings" setting enabled.
      返回:
      whether the player allows server listings
    • spigot

      指定者:
      spigot 在接口中 CommandSender
      指定者:
      spigot 在接口中 Entity