Interface TabListEntry
- All Superinterfaces:
KeyIdentifiable
Represents a single entry in a
TabList.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classRepresents a builder which createsTabListEntrys. -
Method Summary
Modifier and TypeMethodDescriptionstatic TabListEntry.Builderbuilder()Returns aTabListEntry.Builderto create aTabListEntry.@Nullable ChatSessionReturns theChatSessionassociated with this entry.ReturnsOptionaltextComponent, which if present is the text displayed forthisentry in theTabList, otherwiseGameProfile.getName()is shown.intGets the game modethisentry has been set to.default IdentifiedKeyReturns the timed identified key of the object context.intReturns the latency forthisentry.default intReturns the order/priority of this entry in the tab list.Returns theGameProfileof the entry, which uniquely identifies the entry with the containingUUID, as well as deciding what is shown as the player head in the tab list.default booleanisListed()Returns whether or not this player will be visible to other players in the tab list.default booleanReturns whether this entry's hat layer is shown in the tab list.setDisplayName(@Nullable Component displayName) setGameMode(int gameMode) Sets the game mode forthisentry to the specified value.setLatency(int latency) Sets the latency forthisentry to the specified value.default TabListEntrysetListed(boolean listed) Sets whether this entry is listed.default TabListEntrysetListOrder(int order) Sets the order/priority of this entry in the tab list.default TabListEntrysetShowHat(boolean showHat) Sets whether to show this entry's hat layer in the tab list.
-
Method Details
-
getChatSession
@Nullable ChatSession getChatSession()Returns theChatSessionassociated with this entry.- Returns:
- the chat session
-
getIdentifiedKey
Description copied from interface:KeyIdentifiableReturns the timed identified key of the object context. This is only available if the client is running Minecraft 1.19 or newer.- Specified by:
getIdentifiedKeyin interfaceKeyIdentifiable- Returns:
- the key or null if not available
-
getTabList
TabList getTabList()- Returns:
- parent
TabList
-
getProfile
GameProfile getProfile()Returns theGameProfileof the entry, which uniquely identifies the entry with the containingUUID, as well as deciding what is shown as the player head in the tab list.- Returns:
GameProfileof the entry
-
getDisplayNameComponent
ReturnsOptionaltextComponent, which if present is the text displayed forthisentry in theTabList, otherwiseGameProfile.getName()is shown. -
setDisplayName
Sets the textComponentto be displayed forthisTabListEntry. Ifnull,GameProfile.getName()will be shown.- Parameters:
displayName- to show in theTabListforthisentry- Returns:
this, for chaining
-
getLatency
int getLatency()Returns the latency forthisentry.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 greater than 1 second will display 1 bar
- Returns:
- latency set for
thisentry
-
setLatency
Sets the latency forthisentry to the specified value.- Parameters:
latency- to changed to- Returns:
this, for chaining- See Also:
-
getGameMode
int getGameMode()Gets the game modethisentry has been set to.The number corresponds to the game mode in the following way:
- Survival
- Creative
- Adventure
- Spectator
- Returns:
- the game mode
-
setGameMode
Sets the game mode forthisentry 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
Sets whether this entry is listed.- Parameters:
listed- whether this entry is listed- Returns:
this, for chaining
-
getListOrder
default int getListOrder()Returns the order/priority of this entry in the tab list.- Returns:
- order of this entry
- Since Minecraft:
- 1.21.2
-
setListOrder
Sets the order/priority of this entry in the tab list.- Parameters:
order- order of this entry- Returns:
this, for chaining- Since Minecraft:
- 1.21.2
-
isShowHat
default boolean isShowHat()Returns whether this entry's hat layer is shown in the tab list.- Returns:
- whether to show this entry's hat layer
- Since Minecraft:
- 1.21.4
-
setShowHat
Sets whether to show this entry's hat layer in the tab list.- Parameters:
showHat- whether to show this entry's hat layer- Returns:
this, for chaining- Since Minecraft:
- 1.21.4
-
builder
Returns aTabListEntry.Builderto create aTabListEntry.- Returns:
TabListEntrybuilder
-