Interface Player

All Superinterfaces:
AnimalTamer, Attributable, Audience, CommandSender, ConfigurationSerializable, Conversable, Damageable, Entity, HoverEventSource<HoverEvent.ShowEntity>, HumanEntity, Identified, InventoryHolder, LivingEntity, Metadatable, Nameable, NetworkClient, OfflinePlayer, Permissible, PersistentDataHolder, PluginMessageRecipient, ProjectileSource, ServerOperator

Represents a player, connected or not
  • Method Details

    • identity

      @NotNull default Identity identity()
      Specified by:
      identity in interface Identified
    • displayName

      @NotNull Component displayName()
      Gets the "friendly" name to display of this player.
      Returns:
      the display name
    • displayName

      void displayName(@Nullable Component displayName)
      Sets the "friendly" name to display of this player.
      Parameters:
      displayName - the display name to set
    • getDisplayName

      Deprecated.
      in favour of displayName()
      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.

      Returns:
      the friendly name
    • setDisplayName

      @Deprecated 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.

      Parameters:
      name - The new display name.
    • playerListName

      void playerListName(@Nullable Component name)
      Sets the name that is shown on the in-game player list.

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

      Parameters:
      name - new player list name
    • playerListName

      @Nullable Component playerListName()
      Gets the name that is shown on the in-game player list.
      Returns:
      the player list name
    • playerListHeader

      @Nullable Component playerListHeader()
      Gets the currently displayed player list header for this player.
      Returns:
      player list header or null
    • playerListFooter

      @Nullable Component playerListFooter()
      Gets the currently displayed player list footer for this player.
      Returns:
      player list footer or null
    • getPlayerListName

      @NotNull @Deprecated @NotNull String getPlayerListName()
      Deprecated.
      in favour of playerListName()
      Gets the name that is shown on the player list.
      Returns:
      the player list name
    • setPlayerListName

      @Deprecated void setPlayerListName(@Nullable @Nullable String name)
      Sets the name that is shown on the in-game player list.

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

      Parameters:
      name - new player list name
    • getPlayerListHeader

      @Deprecated @Nullable @Nullable String getPlayerListHeader()
      Deprecated.
      in favour of playerListHeader()
      Gets the currently displayed player list header for this player.
      Returns:
      player list header or null
    • getPlayerListFooter

      @Deprecated @Nullable @Nullable String getPlayerListFooter()
      Deprecated.
      in favour of playerListFooter()
      Gets the currently displayed player list footer for this player.
      Returns:
      player list header or null
    • setPlayerListHeader

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

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

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

      void setCompassTarget(@NotNull @NotNull Location loc)
      Set the target of the player's compass.
      Parameters:
      loc - Location to point to
    • getCompassTarget

      @NotNull @NotNull Location getCompassTarget()
      Get the previously set compass target.
      Returns:
      location of the target
    • getAddress

      Gets the socket address of this player
      Specified by:
      getAddress in interface NetworkClient
      Returns:
      the player's address
    • sendRawMessage

      void sendRawMessage(@NotNull @NotNull String message)
      Sends this sender a message raw
      Specified by:
      sendRawMessage in interface Conversable
      Parameters:
      message - Message to be displayed
    • kickPlayer

      @Deprecated void kickPlayer(@Nullable @Nullable String message)
      Kicks player with custom kick message.
      Parameters:
      message - kick message
    • kick

      void kick(@Nullable Component message)
      Kicks player with custom kick message.
      Parameters:
      message - kick message
    • kick

      Kicks player with custom kick message and cause.
      Parameters:
      message - kick message
      cause - kick cause
    • chat

      void chat(@NotNull @NotNull String msg)
      Says a message (or runs a command).
      Parameters:
      msg - message to print
    • performCommand

      boolean performCommand(@NotNull @NotNull String command)
      Makes the player perform the given command
      Parameters:
      command - Command to perform
      Returns:
      true if the command was successful, otherwise false
    • isOnGround

      @Deprecated boolean isOnGround()
      Deprecated.
      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.
      Specified by:
      isOnGround in interface Entity
      Returns:
      True if entity is on ground.
      See Also:
      isOnGround()
    • isSneaking

      boolean isSneaking()
      Returns if the player is in sneak mode
      Returns:
      true if player is in sneak mode
    • setSneaking

      void setSneaking(boolean sneak)
      Sets the sneak mode the player
      Parameters:
      sneak - true if player should appear sneaking
    • isSprinting

      boolean isSprinting()
      Gets whether the player is sprinting or not.
      Returns:
      true if player is sprinting.
    • setSprinting

      void setSprinting(boolean sprinting)
      Sets whether the player is sprinting or not.
      Parameters:
      sprinting - true if the player should be sprinting
    • saveData

      void saveData()
      Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder
    • loadData

      void loadData()
      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)
      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.
      Parameters:
      isSleeping - Whether to ignore.
    • isSleepingIgnored

      boolean isSleepingIgnored()
      Returns whether the player is sleeping ignored.
      Returns:
      Whether player is ignoring sleep.
    • 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.
      Specified by:
      getBedSpawnLocation in interface OfflinePlayer
      Returns:
      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.
      Parameters:
      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.
      Parameters:
      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)
      Deprecated.
      Magic value
      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.
      Parameters:
      loc - The location of a note block.
      instrument - The instrument ID.
      note - The 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.
      Parameters:
      loc - The location of a note block
      instrument - The instrument
      note - The note
    • playSound

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

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

      Parameters:
      location - The location 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 Location location, @NotNull @NotNull String sound, float volume, float pitch)
      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.

      Parameters:
      location - the location to play the sound
      sound - the internal sound name to play
      volume - the volume of the sound
      pitch - the pitch of the sound
    • playSound

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

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

      Parameters:
      location - The location 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 Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      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.

      Parameters:
      location - the location to play the sound
      sound - the internal sound name 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.
      Parameters:
      sound - the sound to stop
    • stopSound

      void stopSound(@NotNull @NotNull String sound)
      Stop the specified sound from playing.
      Parameters:
      sound - the sound to stop
    • stopSound

      void stopSound(@NotNull @NotNull Sound sound, @Nullable @Nullable SoundCategory category)
      Stop the specified sound from playing.
      Parameters:
      sound - the sound to stop
      category - the category of the sound
    • stopSound

      void stopSound(@NotNull @NotNull String sound, @Nullable @Nullable SoundCategory category)
      Stop the specified sound from playing.
      Parameters:
      sound - the sound to stop
      category - the category of the sound
    • playEffect

      @Deprecated void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, int data)
      Deprecated.
      Magic value
      Plays an effect to just this player.
      Parameters:
      loc - the location to play the effect at
      effect - the Effect
      data - a data bit needed for some effects
    • playEffect

      <T> void playEffect(@NotNull @NotNull Location loc, @NotNull @NotNull Effect effect, @Nullable T data)
      Plays an effect to just this player.
      Type Parameters:
      T - the data based based on the type of the effect
      Parameters:
      loc - the location to play the effect at
      effect - the Effect
      data - a data bit needed for some effects
    • sendBlockChange

      @Deprecated void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull Material material, byte data)
      Deprecated.
      Magic value
      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.
      Parameters:
      loc - The location of the changed block
      material - The new block
      data - The block data
    • sendBlockChange

      void sendBlockChange(@NotNull @NotNull Location loc, @NotNull @NotNull BlockData 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.
      Parameters:
      loc - The location of the changed block
      block - The new block
    • sendBlockDamage

      void sendBlockDamage(@NotNull @NotNull Location loc, float progress)
      Send block damage. This fakes block break progress for a user at a certain location. This will not actually change the block's break progress in any way.
      Parameters:
      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
    • sendChunkChange

      @Deprecated boolean sendChunkChange(@NotNull @NotNull Location loc, int sx, int sy, int sz, @NotNull @org.jetbrains.annotations.NotNull byte[] data)
      Deprecated.
      Magic value
      Send a chunk change. This fakes a chunk change packet for a user at a certain location. The updated cuboid must be entirely within a single chunk. This will not actually change the world in any way.

      At least one of the dimensions of the cuboid must be even. The size of the data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 format.

      Parameters:
      loc - The location of the cuboid
      sx - The x size of the cuboid
      sy - The y size of the cuboid
      sz - The z size of the cuboid
      data - The data to be sent
      Returns:
      true if the chunk change packet was sent
    • sendSignChange

      void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<Component> lines) throws IllegalArgumentException
      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.

      Parameters:
      loc - the location of the sign
      lines - the new text on the sign or null to clear it
      Throws:
      IllegalArgumentException - if location is null
      IllegalArgumentException - if lines is non-null and has a length less than 4
    • sendSignChange

      void sendSignChange(@NotNull @NotNull Location loc, @Nullable List<Component> lines, @NotNull @NotNull DyeColor dyeColor) throws IllegalArgumentException
      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.

      Parameters:
      loc - the location of the sign
      lines - the new text on the sign or null to clear it
      dyeColor - the color of the sign
      Throws:
      IllegalArgumentException - if location is null
      IllegalArgumentException - if dyeColor is null
      IllegalArgumentException - if lines is non-null and has a length less than 4
    • sendSignChange

      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.

      Parameters:
      loc - the location of the sign
      lines - the new text on the sign or null to clear it
      Throws:
      IllegalArgumentException - if location is null
      IllegalArgumentException - if lines is non-null and has a length less than 4
    • sendSignChange

      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.

      Parameters:
      loc - the location of the sign
      lines - the new text on the sign or null to clear it
      dyeColor - the color of the sign
      Throws:
      IllegalArgumentException - if location is null
      IllegalArgumentException - if dyeColor is null
      IllegalArgumentException - if lines is non-null and has a length less than 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.
      Parameters:
      map - The map to be sent
    • banPlayerFull

      @Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason)
      Permanently Bans the Profile and IP address currently used by the player.
      Parameters:
      reason - Reason for ban
      Returns:
      Ban Entry
    • banPlayerFull

      @Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable String source)
      Permanently Bans the Profile and IP address currently used by the player.
      Parameters:
      reason - Reason for ban
      source - Source of ban, or null for default
      Returns:
      Ban Entry
    • banPlayerFull

      @Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable Date expires)
      Bans the Profile and IP address currently used by the player.
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      Returns:
      Ban Entry
    • banPlayerFull

      @Nullable default @Nullable BanEntry banPlayerFull(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source)
      Bans the Profile and IP address currently used by the player.
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      source - Source of the ban, or null for default
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, boolean kickPlayer)
      Permanently Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for ban
      kickPlayer - Whether or not to kick the player afterwards
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source, boolean kickPlayer)
      Permanently Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for ban
      source - Source of ban, or null for default
      kickPlayer - Whether or not to kick the player afterwards
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, boolean kickPlayer)
      Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      kickPlayer - Whether or not to kick the player afterwards
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason)
      Permanently Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for ban
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable String source)
      Permanently Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for ban
      source - Source of ban, or null for default
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires)
      Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source)
      Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      source - Source of the banm or null for default
      Returns:
      Ban Entry
    • banPlayerIP

      @Nullable default @Nullable BanEntry banPlayerIP(@Nullable @Nullable String reason, @Nullable @Nullable Date expires, @Nullable @Nullable String source, boolean kickPlayer)
      Bans the IP address currently used by the player. Does not ban the Profile, use banPlayerFull(String, Date, String)
      Parameters:
      reason - Reason for Ban
      expires - When to expire the ban
      source - Source of the banm or null for default
      kickPlayer - if the targeted player should be kicked
      Returns:
      Ban Entry
    • sendActionBar

      @Deprecated void sendActionBar(@NotNull @NotNull String message)
      Sends an Action Bar message to the client. Use Section symbols for legacy color codes to send formatting.
      Parameters:
      message - The message to send
    • sendActionBar

      @Deprecated void sendActionBar(char alternateChar, @NotNull @NotNull String message)
      Sends an Action Bar message to the client. Use supplied alternative character to the section symbol to represent legacy color codes.
      Parameters:
      alternateChar - Alternate symbol such as '&'
      message - The message to send
    • sendActionBar

      @Deprecated void sendActionBar(@NotNull @NotNull BaseComponent... message)
      Sends an Action Bar message to the client.
      Parameters:
      message - The components to send
    • sendMessage

      @Deprecated default void sendMessage(@NotNull BaseComponent component)
      Deprecated.
      use sendMessage methods that accept Component
      Sends the component to the player
      Specified by:
      sendMessage in interface CommandSender
      Parameters:
      component - the components to send
    • sendMessage

      @Deprecated default void sendMessage(@NotNull @NotNull BaseComponent... components)
      Deprecated.
      use sendMessage methods that accept Component
      Sends an array of components as a single message to the player
      Specified by:
      sendMessage in interface CommandSender
      Parameters:
      components - the components to send
    • sendMessage

      @Deprecated default void sendMessage(ChatMessageType position, BaseComponent... components)
      Deprecated.
      This is unlikely the API you want to use. See sendActionBar(String) for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
      Sends an array of components as a single message to the specified screen position of this player
      Parameters:
      position - the screen position
      components - the components to send
    • setPlayerListHeaderFooter

      @Deprecated void setPlayerListHeaderFooter(@Nullable @Nullable BaseComponent[] header, @Nullable @Nullable BaseComponent[] footer)
      Set the text displayed in the player list header and footer for this player
      Parameters:
      header - content for the top of the player list
      footer - content for the bottom of the player list
    • setPlayerListHeaderFooter

      @Deprecated void setPlayerListHeaderFooter(@Nullable BaseComponent header, @Nullable BaseComponent footer)
      Set the text displayed in the player list header and footer for this player
      Parameters:
      header - content for the top of the player list
      footer - content for the bottom of the player list
    • setTitleTimes

      @Deprecated void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks)
      Update the times for titles displayed to the player
      Parameters:
      fadeInTicks - ticks to fade-in
      stayTicks - ticks to stay visible
      fadeOutTicks - ticks to fade-out
    • setSubtitle

      @Deprecated void setSubtitle(BaseComponent[] subtitle)
      Update the subtitle of titles displayed to the player
      Parameters:
      subtitle - Subtitle to set
    • setSubtitle

      @Deprecated void setSubtitle(BaseComponent subtitle)
      Update the subtitle of titles displayed to the player
      Parameters:
      subtitle - Subtitle to set
    • showTitle

      @Deprecated void showTitle(@Nullable @Nullable BaseComponent[] title)
      Show the given title to the player, along with the last subtitle set, using the last set times
      Parameters:
      title - Title to set
    • showTitle

      @Deprecated void showTitle(@Nullable BaseComponent title)
      Show the given title to the player, along with the last subtitle set, using the last set times
      Parameters:
      title - Title to set
    • showTitle

      @Deprecated void showTitle(@Nullable @Nullable BaseComponent[] title, @Nullable @Nullable BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks)
      Show the given title and subtitle to the player using the given times
      Parameters:
      title - big text
      subtitle - little text under it
      fadeInTicks - ticks to fade-in
      stayTicks - ticks to stay visible
      fadeOutTicks - ticks to fade-out
    • showTitle

      @Deprecated void showTitle(@Nullable BaseComponent title, @Nullable BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks)
      Show the given title and subtitle to the player using the given times
      Parameters:
      title - big text
      subtitle - little text under it
      fadeInTicks - ticks to fade-in
      stayTicks - ticks to stay visible
      fadeOutTicks - ticks to fade-out
    • sendTitle

      @Deprecated void sendTitle(@NotNull @NotNull Title title)
      Show the title to the player, overriding any previously displayed title.

      This method overrides any previous title, use updateTitle(Title) to change the existing one.

      Parameters:
      title - the title to send
      Throws:
      NullPointerException - if the title is null
    • updateTitle

      @Deprecated void updateTitle(@NotNull @NotNull Title title)
      Show the title to the player, overriding any previously displayed title.

      This method doesn't override previous titles, but changes their values.

      Parameters:
      title - the title to send
      Throws:
      NullPointerException - if title is null
    • hideTitle

      @Deprecated void hideTitle()
      Deprecated.
      Hide any title that is currently visible to the player
    • updateInventory

      void updateInventory()
      Forces an update of the player's entire inventory.
    • setPlayerTime

      void setPlayerTime(long time, boolean relative)
      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().

      Parameters:
      time - The current player's perceived time or the player's time offset from the server time.
      relative - When true the player time is kept relative to its world time.
    • getPlayerTime

      long getPlayerTime()
      Returns the player's current timestamp.
      Returns:
      The player's time
    • 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.
      Returns:
      The player's time
    • isPlayerTimeRelative

      boolean isPlayerTimeRelative()
      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().
      Returns:
      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)
      Sets the type of weather the player will see. When used, the weather status of the player is locked until resetPlayerWeather() is used.
      Parameters:
      type - The WeatherType enum type the player should experience
    • getPlayerWeather

      @Nullable @Nullable WeatherType getPlayerWeather()
      Returns the type of weather the player is currently experiencing.
      Returns:
      The WeatherType that the player is currently experiencing or null if player is seeing server weather.
    • resetPlayerWeather

      void resetPlayerWeather()
      Restores the normal condition where the player's weather is controlled by server conditions.
    • giveExp

      default void giveExp(int amount)
      Gives the player the amount of experience specified.
      Parameters:
      amount - Exp amount to give
    • giveExp

      void giveExp(int amount, boolean applyMending)
      Gives the player the amount of experience specified.
      Parameters:
      amount - Exp amount to give
      applyMending - Mend players items with mending, with same behavior as picking up orbs. calls applyMending(int)
    • applyMending

      int applyMending(int amount)
      Applies the mending effect to any items just as picking up an orb would. Can also be called with giveExp(int, boolean) by passing true to applyMending
      Parameters:
      amount - Exp to apply
      Returns:
      the remaining experience
    • giveExpLevels

      void giveExpLevels(int amount)
      Gives the player the amount of experience levels specified. Levels can be taken by specifying a negative amount.
      Parameters:
      amount - amount of experience levels to give or take
    • getExp

      float getExp()
      Gets the players current experience points towards the next level.

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

      Returns:
      Current experience points
    • setExp

      void setExp(float exp)
      Sets the players current experience points towards the next level

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

      Parameters:
      exp - New experience points
    • getLevel

      int getLevel()
      Gets the players current experience level
      Returns:
      Current experience level
    • setLevel

      void setLevel(int level)
      Sets the players current experience level
      Parameters:
      level - New experience 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.
      Returns:
      Current total experience points
    • 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.
      Parameters:
      exp - New total experience points
    • 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.
      Parameters:
      progress - Experience progress percentage (between 0.0 and 1.0)
      See Also:
      setExp(float)
    • 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.
      Parameters:
      progress - New experience progress percentage (between 0.0 and 1.0)
      level - New experience level
      See Also:
      setExp(float), setLevel(int)
    • getAllowFlight

      boolean getAllowFlight()
      Determines if the Player is allowed to fly via jump key double-tap like in creative mode.
      Returns:
      True if the player is allowed to fly.
    • setAllowFlight

      void setAllowFlight(boolean flight)
      Sets if the Player is allowed to fly via jump key double-tap like in creative mode.
      Parameters:
      flight - If flight should be allowed.
    • hidePlayer

      @Deprecated void hidePlayer(@NotNull @NotNull Player player)
      Hides a player from this player
      Parameters:
      player - Player to hide
    • hidePlayer

      void hidePlayer(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Player player)
      Hides a player from this player
      Parameters:
      plugin - Plugin that wants to hide the player
      player - Player to hide
    • showPlayer

      @Deprecated void showPlayer(@NotNull @NotNull Player player)
      Allows this player to see a player that was previously hidden
      Parameters:
      player - Player to show
    • 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.
      Parameters:
      plugin - Plugin that wants to show the player
      player - Player to show
    • canSee

      boolean canSee(@NotNull @NotNull Player player)
      Checks to see if a player has been hidden from this player
      Parameters:
      player - Player to check
      Returns:
      True if the provided player is not being hidden from this player
    • isFlying

      boolean isFlying()
      Checks to see if this player is currently flying or not.
      Returns:
      True if the player is flying, else false.
    • setFlying

      void setFlying(boolean value)
      Makes this player start or stop flying.
      Parameters:
      value - True to fly.
    • setFlySpeed

      void setFlySpeed(float value) throws IllegalArgumentException
      Sets the speed at which a client will fly. Negative values indicate reverse directions.
      Parameters:
      value - The new speed, from -1 to 1.
      Throws:
      IllegalArgumentException - If new speed is less than -1 or greater than 1
    • setWalkSpeed

      void setWalkSpeed(float value) throws IllegalArgumentException
      Sets the speed at which a client will walk. Negative values indicate reverse directions.
      Parameters:
      value - The new speed, from -1 to 1.
      Throws:
      IllegalArgumentException - If new speed is less than -1 or greater than 1
    • getFlySpeed

      float getFlySpeed()
      Gets the current allowed speed that a client can fly.
      Returns:
      The current allowed speed, from -1 to 1
    • getWalkSpeed

      float getWalkSpeed()
      Gets the current allowed speed that a client can walk.
      Returns:
      The current allowed speed, from -1 to 1
    • setTexturePack

      @Deprecated void setTexturePack(@NotNull @NotNull String url)
      Deprecated.
      Minecraft no longer uses textures packs. Instead you should use setResourcePack(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.
      Parameters:
      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.
      Throws:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long.
    • setResourcePack

      @Deprecated void setResourcePack(@NotNull @NotNull String url)
      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 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 send with "null" as the hash. This might result in newer versions not loading the pack correctly.
      Parameters:
      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.
      Throws:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @NotNull @org.jetbrains.annotations.NotNull byte[] hash)
      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. 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.
      Parameters:
      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!
      Throws:
      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 null.
      IllegalArgumentException - Thrown if the hash is not 20 bytes long.
    • getScoreboard

      @NotNull @NotNull Scoreboard getScoreboard()
      Gets the Scoreboard displayed to this player
      Returns:
      The current scoreboard seen by this player
    • setScoreboard

      void setScoreboard(@NotNull @NotNull Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException
      Sets the player's visible Scoreboard.
      Parameters:
      scoreboard - New Scoreboard for the player
      Throws:
      IllegalArgumentException - if scoreboard is null
      IllegalArgumentException - if scoreboard was not created by the scoreboard manager
      IllegalStateException - if this is a player that is not logged yet or has logged out
    • isHealthScaled

      boolean isHealthScaled()
      Gets if the client is displayed a 'scaled' health, that is, health on a scale from 0-getHealthScale().
      Returns:
      if client health display is scaled
      See Also:
      setHealthScaled(boolean)
    • setHealthScaled

      void setHealthScaled(boolean scale)
      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().

      Parameters:
      scale - if the client health display is scaled
    • setHealthScale

      void setHealthScale(double scale) throws IllegalArgumentException
      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().

      Parameters:
      scale - the number to scale health to
      Throws:
      IllegalArgumentException - if scale is <0
      IllegalArgumentException - if scale is Double.NaN
      IllegalArgumentException - if scale is too high
    • getHealthScale

      double getHealthScale()
      Gets the number that health is scaled to for the client.
      Returns:
      the number that health would be scaled to for the client if HealthScaling is set to true
      See Also:
      setHealthScale(double), setHealthScaled(boolean)
    • getSpectatorTarget

      @Nullable @Nullable Entity getSpectatorTarget()
      Gets the entity which is followed by the camera when in GameMode.SPECTATOR.
      Returns:
      the followed entity, or null if not in spectator mode or not following a specific entity.
    • setSpectatorTarget

      void setSpectatorTarget(@Nullable @Nullable Entity entity)
      Sets the entity which is followed by the camera when in GameMode.SPECTATOR.
      Parameters:
      entity - the entity to follow or null to reset
      Throws:
      IllegalStateException - if the player is not in GameMode.SPECTATOR
    • sendTitle

      @Deprecated void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle)
      Deprecated.
      API behavior subject to change
      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. The titles will be displayed with the client's default timings.
      Parameters:
      title - Title text
      subtitle - Subtitle text
    • sendTitle

      void sendTitle(@Nullable @Nullable String title, @Nullable @Nullable String subtitle, int fadeIn, int stay, int fadeOut)
      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).
      Parameters:
      title - Title text
      subtitle - Subtitle text
      fadeIn - time in ticks for titles to fade in. Defaults to 10.
      stay - time in ticks for titles to stay. Defaults to 70.
      fadeOut - time in ticks for titles to fade out. Defaults to 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.
      Specified by:
      resetTitle in interface Audience
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)
      Spawns the particle (the number of times specified by count) at the target location.
      Parameters:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count)
      Spawns the particle (the number of times specified by count) at the target location.
      Parameters:
      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
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      data - the data to use for the particle or null, the type of this depends on 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.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      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 - the data to use for the particle or null, the type of this depends on 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.
      Parameters:
      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.
      Parameters:
      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.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      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 - the data to use for the particle or null, the type of this depends on 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.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      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 - the data to use for the particle or null, the type of this depends on 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.
      Parameters:
      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.
      Parameters:
      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.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      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 - the data to use for the particle or null, the type of this depends on 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.
      Type Parameters:
      T - type of particle data (see Particle.getDataType()
      Parameters:
      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 - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • getAdvancementProgress

      @NotNull @NotNull AdvancementProgress getAdvancementProgress(@NotNull @NotNull Advancement advancement)
      Return the player's progression on the specified advancement.
      Parameters:
      advancement - advancement
      Returns:
      object detailing the player's progress
    • 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,
      Returns:
      client view distance as above
    • locale

      @NotNull Locale locale()
      Gets the player's current locale.
      Returns:
      the player's locale
    • getPing

      int getPing()
      Gets the player's estimated ping in milliseconds. In Vanilla this value represents the average of the response time to the last four 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).
      Returns:
      player ping
    • getLocale

      Deprecated.
      in favour of locale()
      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.
      Returns:
      the player's locale
    • getAffectsSpawning

      boolean getAffectsSpawning()
      Get whether the player can affect mob spawning
      Returns:
      if the player can affect mob spawning
    • setAffectsSpawning

      void setAffectsSpawning(boolean affects)
      Set whether the player can affect mob spawning
      Parameters:
      affects - Whether the player can affect mob spawning
    • getViewDistance

      @Deprecated int getViewDistance()
      Deprecated.
      This is unimplemented and will throw an exception at runtime. The World-based methods still work.
      Gets the view distance for this player
      Returns:
      the player's view distance
      See Also:
      World.getViewDistance(), World.getNoTickViewDistance()
    • setViewDistance

      @Deprecated void setViewDistance(int viewDistance)
      Deprecated.
      This is unimplemented and will throw an exception at runtime. The World-based methods still work.
      Sets the view distance for this player
      Parameters:
      viewDistance - the player's view distance
      See Also:
      World.setViewDistance(int), World.setNoTickViewDistance(int)
    • 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
      Parameters:
      book - The book to open for this player
    • asHoverEvent

      Specified by:
      asHoverEvent in interface Entity
      Specified by:
      asHoverEvent in interface HoverEventSource<HoverEvent.ShowEntity>
    • setResourcePack

      void setResourcePack(@NotNull @NotNull String url, @NotNull @NotNull String hash)
      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 the same resource pack in the past, it will perform a quick timestamp check over the network 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.
      • There is no concept of resetting resource packs back to default within Minecraft, so players will have to relog to do so.
      Parameters:
      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 - A 40 character hexadecimal and lowercase SHA-1 digest of the resource pack file.
      Throws:
      IllegalArgumentException - Thrown if the URL is null.
      IllegalArgumentException - Thrown if the URL is too long. The length restriction is an implementation specific arbitrary value.
    • getResourcePackStatus

      Returns:
      the most recent resource pack status received from the player, or null if no status has ever been received from this player.
    • getResourcePackHash

      @Nullable @Deprecated @Nullable String getResourcePackHash()
      Deprecated.
      This is no longer sent from the client and will always be null
      Returns:
      the most recent resource pack hash received from the player, or null if no hash has ever been received from this player.
    • hasResourcePack

      boolean hasResourcePack()
      Returns:
      true if the last resource pack status received from this player was PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED
    • getPlayerProfile

      @NotNull @NotNull PlayerProfile getPlayerProfile()
      Gets a copy of this players profile
      Returns:
      The players profile object
    • setPlayerProfile

      void setPlayerProfile(@NotNull @NotNull PlayerProfile profile)
      Changes the PlayerProfile for this player. This will cause this player to be reregistered to all clients that can currently see this player
      Parameters:
      profile - The new profile to use
    • getCooldownPeriod

      float getCooldownPeriod()
      Returns the amount of ticks the current cooldown lasts
      Returns:
      Amount of ticks cooldown will last
    • getCooledAttackStrength

      float getCooledAttackStrength(float adjustTicks)
      Returns the percentage of attack power available based on the cooldown (zero to one).
      Parameters:
      adjustTicks - Amount of ticks to add to cooldown counter for this calculation
      Returns:
      Percentage of attack power available
    • resetCooldown

      void resetCooldown()
      Reset the cooldown counter to 0, effectively starting the cooldown period.
    • getClientOption

      @NotNull <T> T getClientOption(@NotNull @NotNull ClientOption<T> option)
      Returns:
      the client option value of the player
    • boostElytra

      Boost a Player that's LivingEntity.isGliding() using a Firework. If the creation of the entity is cancelled, no boosting is done. This method does not fire PlayerElytraBoostEvent.
      Parameters:
      firework - The Material.FIREWORK_ROCKET to boost the player with
      Returns:
      The Firework boosting the Player or null if the spawning of the entity was cancelled
      Throws:
      IllegalArgumentException - if LivingEntity.isGliding() is false or if the firework isn't a Material.FIREWORK_ROCKET
    • sendOpLevel

      void sendOpLevel(byte level)
      Send a packet to the player indicating its operator status level.

      Note: This will not persist across more than the current connection, and setting the player's operator status as a later point will override the effects of this.

      Parameters:
      level - The level to send to the player. Must be in [0, 4].
      Throws:
      IllegalArgumentException - If the level is negative or greater than 4 (i.e. not within [0, 4]).
    • getTrackedPlayers

      @NotNull @NotNull Set<Player> getTrackedPlayers()
      Returns:
      Returns a set of Players within this player's tracking range (that the player's client can "see")
    • getClientBrandName

      @Nullable @Nullable String getClientBrandName()
      Returns player's client brand name. If the client didn't send this information, the brand name will be null.
      For the Notchian client this name defaults to vanilla. Some modified clients report other names such as forge.
      Returns:
      client brand name
    • spigot

      Specified by:
      spigot in interface CommandSender
      Specified by:
      spigot in interface Entity