Interface Player

All Superinterfaces:
Audience, BossBarViewer, CommandSource, Connection, Entity, LivingEntity, PlayerInfoEntry, Pointered, Sound.Emitter, Viewable

Represents a player.
  • Field Details

    • BLOCK_BREAK_SPEED

      static final Attribute BLOCK_BREAK_SPEED
    • BLOCK_INTERACTION_RANGE

      static final Attribute BLOCK_INTERACTION_RANGE
    • ENTITY_INTERACTION_RANGE

      static final Attribute ENTITY_INTERACTION_RANGE
    • MINING_EFFICIENCY

      static final Attribute MINING_EFFICIENCY
    • SNEAKING_SPEED

      static final Attribute SNEAKING_SPEED
  • Method Details

    • name

      @NotNull @NotNull String name()
      Gets the name of the player.
      Returns:
      the player's name
      Since:
      1.0.0
    • profile

      @NotNull @NotNull GameProfile profile()
      Gets the profile of the player.
      Specified by:
      profile in interface PlayerInfoEntry
      Returns:
      the player's profile
      Since:
      1.0.0
    • settings

      @NotNull @NotNull PlayerSettings settings()
      Gets the settings of the player.
      Returns:
      the player's settings
      Since:
      1.0.0
    • gameMode

      @NotNull @NotNull GameMode gameMode()
      Gets the game mode of the player.
      Specified by:
      gameMode in interface PlayerInfoEntry
      Returns:
      the player's game mode
      Since:
      1.0.0
    • gameMode

      void gameMode(@NotNull @NotNull GameMode gameMode)
      Sets the game mode of a player.
      Parameters:
      gameMode - the game mode to set
      Since:
      1.0.0
    • displayName

      @Nullable @Nullable Component displayName()
      Gets the game mode of the player.
      Specified by:
      displayName in interface PlayerInfoEntry
      Returns:
      the player's game mode
      Since:
      1.0.0
    • displayName

      void displayName(@Nullable @Nullable Component displayName)
      Sets the display name of a player.
      Parameters:
      displayName - the display name to set
      Since:
      1.0.0
    • disconnect

      void disconnect(@NotNull @NotNull Component reason)
      Disconnects the player with the specified reason.
      Parameters:
      reason - the reason of the disconnect
      Since:
      1.0.0
    • inventory

      @NotNull @NotNull Inventory inventory()
      Gets the inventory of the player.
      Returns:
      the player's inventory
      Since:
      1.0.0
    • openedContainer

      @Nullable @Nullable Container openedContainer()
      Gets the opened container.
      Returns:
      the opened container or null if nothing is opened
      Since:
      1.0.0
    • openContainer

      void openContainer(@NotNull @NotNull Container container)
      Opens the specified container.
      Parameters:
      container - the container to open
      Since:
      1.0.0
    • heldItemSlot

      int heldItemSlot()
      Gets the slot index of the currently held item
      Returns:
      the held item slot index
      Since:
      1.0.0
    • heldItemSlot

      void heldItemSlot(int slot)
      Sets the current held item by its index.
      Parameters:
      slot - the slot
      Since:
      1.0.0
    • flying

      boolean flying()
      Gets whether the player flies or not.
      Returns:
      whether the player flies or not
      Since:
      1.0.0
    • flying

      void flying(boolean flying)
      Sets whether the player flies or not.
      Parameters:
      flying - whether the player flies or not
      Since:
      1.0.0
    • allowFlight

      boolean allowFlight()
      Gets whether the player is allowed to fly.
      Returns:
      whether the player is allowed to fly
      Since:
      1.0.0
    • allowFlight

      void allowFlight(boolean allowFight)
      Sets whether the player is allowed to fly
      Parameters:
      allowFight - whether the player is allowed to fly
      Since:
      1.0.0
    • flyingSpeed

      float flyingSpeed()
      Gets the flying speed of the player.
      Returns:
      the player's flying speed
      Since:
      1.0.0
    • flyingSpeed

      void flyingSpeed(float flyingSpeed)
      Sets the flying speed of the player
      Parameters:
      flyingSpeed - the flying speed to set
      Since:
      1.0.0
    • instantBreak

      @Experimental boolean instantBreak()
      Gets whether the player can instantly break.
      Returns:
      whether the player can instantly break
      Since:
      1.0.0
    • instantBreak

      @Experimental void instantBreak(boolean instantBreak)
      Sets whether the player can instantly break.
      Parameters:
      instantBreak - whether the player can instantly break
      Since:
      1.0.0
    • viewModifier

      float viewModifier()
      Gets the view modifier of the player.
      Returns:
      the player's view modifier
      Since:
      1.0.0
    • viewModifier

      void viewModifier(float viewModifier)
      Sets the view modifier of the player.
      Parameters:
      viewModifier - the view modifier to set
      Since:
      1.0.0
    • sendPluginMessage

      void sendPluginMessage(@NotNull @NotNull String identifier, byte @NotNull [] data)
      Sends a plugin message.
      Parameters:
      identifier - the identifier
      data - the data to send
    • onGround

      boolean onGround()
      Whether the player is on ground.
      Returns:
      whether the player is on ground
      Since:
      1.0.0
    • addChatSuggestions

      void addChatSuggestions(@NotNull @NotNull String... suggestions)
      Adds custom chat suggestions to the client.
      Parameters:
      suggestions - the suggestions to add
      Since:
      1.0.0
    • removeChatSuggestions

      void removeChatSuggestions(@NotNull @NotNull String... suggestions)
      Removes custom chat suggestions to the client.
      Parameters:
      suggestions - the suggestions to remove
      Since:
      1.0.0
    • setChatSuggestions

      void setChatSuggestions(@NotNull @NotNull String... suggestions)
      Sets the custom chat suggestions of the client.
      Parameters:
      suggestions - the suggestions to set
      Since:
      1.0.0