Interface TabListEntry

All Superinterfaces:
KeyIdentifiable

public interface TabListEntry extends KeyIdentifiable
Represents a single entry in a TabList.
  • Method Details

    • getChatSession

      @Nullable ChatSession getChatSession()
      Returns the ChatSession associated with this entry.
      Returns:
      the chat session
    • getIdentifiedKey

      default IdentifiedKey getIdentifiedKey()
      Description copied from interface: KeyIdentifiable
      Returns the timed identified key of the object context. This is only available if the client is running Minecraft 1.19 or newer.
      Specified by:
      getIdentifiedKey in interface KeyIdentifiable
      Returns:
      the key or null if not available
    • getTabList

      TabList getTabList()
      Returns the parent TabList of this this TabListEntry.
      Returns:
      parent TabList
    • getProfile

      GameProfile getProfile()
      Returns the GameProfile of the entry, which uniquely identifies the entry with the containing UUID, as well as deciding what is shown as the player head in the tab list.
      Returns:
      GameProfile of the entry
    • getDisplayNameComponent

      Optional<Component> getDisplayNameComponent()
      Returns Optional text Component, which if present is the text displayed for this entry in the TabList, otherwise GameProfile.getName() is shown.
      Returns:
      Optional text Component of name displayed in the tab list
    • setDisplayName

      TabListEntry setDisplayName(@Nullable Component displayName)
      Sets the text Component to be displayed for this TabListEntry. If null, GameProfile.getName() will be shown.
      Parameters:
      displayName - to show in the TabList for this entry
      Returns:
      this, for chaining
    • getLatency

      int getLatency()
      Returns the latency for this entry.

      The icon shown in the tab list is calculated by the latency as follows:

      • A negative latency will display the no connection icon
      • 0-150 will display 5 bars
      • 150-300 will display 4 bars
      • 300-600 will display 3 bars
      • 600-1000 will display 2 bars
      • A latency move than 1 second will display 1 bar
      Returns:
      latency set for this entry
    • setLatency

      TabListEntry setLatency(int latency)
      Sets the latency for this entry to the specified value.
      Parameters:
      latency - to changed to
      Returns:
      this, for chaining
      See Also:
    • getGameMode

      int getGameMode()
      Gets the game mode this entry has been set to.

      The number corresponds to the game mode in the following way:

      1. Survival
      2. Creative
      3. Adventure
      4. Spectator
      Returns:
      the game mode
    • setGameMode

      TabListEntry setGameMode(int gameMode)
      Sets the game mode for this entry to the specified value.
      Parameters:
      gameMode - to change to
      Returns:
      this, for chaining
      See Also:
    • isListed

      default boolean isListed()
      Returns whether or not this player will be visible to other players in the tab list.
      Returns:
      Whether this entry is listed; only changeable in 1.19.3 and above
    • setListed

      default TabListEntry setListed(boolean listed)
      Sets whether this entry is listed.
      Parameters:
      listed - whether this entry is listed
      Returns:
      this, for chaining
    • builder

      static TabListEntry.Builder builder()
      Returns a TabListEntry.Builder to create a TabListEntry.
      Returns:
      TabListEntry builder