Interface TabList
-
public interface TabListRepresents aPlayer's tab list.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TabListaddEntry(TabListEntry entry)Adds an entry to the list.java.util.Collection<TabListEntry>entries()Gets the entries on the list.java.util.Optional<TabListEntry>entry(java.util.UUID uniqueId)Gets aTabListEntrymatching the specified unique id.java.util.Optional<Component>footer()Gets this list's footer.java.util.Optional<Component>header()Gets this list's header.ServerPlayerplayer()java.util.Optional<TabListEntry>removeEntry(java.util.UUID uniqueId)Removes an entry from the list.TabListsetFooter(@Nullable Component footer)Sets this list's footer.TabListsetHeader(@Nullable Component header)Sets this list's header.default TabListsetHeaderAndFooter(@Nullable Component header, @Nullable Component footer)Sets this list's header and footer.
-
-
-
Method Detail
-
player
ServerPlayer player()
- Returns:
- The associated player
-
header
java.util.Optional<Component> header()
Gets this list's header.- Returns:
- The current header
-
setHeader
TabList setHeader(@Nullable Component header)
Sets this list's header.When
nullis passed, an emptyComponentwill be sent.- Parameters:
header- The new header- Returns:
- This tab list, for chaining
-
footer
java.util.Optional<Component> footer()
Gets this list's footer.- Returns:
- The current footer
-
setFooter
TabList setFooter(@Nullable Component footer)
Sets this list's footer.When
nullis passed, an emptyComponentwill be sent.- Parameters:
footer- The new footer- Returns:
- This tab list, for chaining
-
setHeaderAndFooter
default TabList setHeaderAndFooter(@Nullable Component header, @Nullable Component footer)
Sets this list's header and footer.When
nullis passed, an emptyComponentwill be sent.- Parameters:
header- The new headerfooter- The new footer- Returns:
- This tab list, for chaining
-
entries
java.util.Collection<TabListEntry> entries()
Gets the entries on the list.The returned collection should be immutable.
- Returns:
- The entries on the list
-
entry
java.util.Optional<TabListEntry> entry(java.util.UUID uniqueId)
Gets aTabListEntrymatching the specified unique id.- Parameters:
uniqueId- The unique id to search for- Returns:
- The entry if present, otherwise
Optional.empty()
-
addEntry
TabList addEntry(TabListEntry entry) throws java.lang.IllegalArgumentException
Adds an entry to the list.- Parameters:
entry- The entry to add- Returns:
- This tab list, for chaining
- Throws:
java.lang.IllegalArgumentException- if an entry already with the same unique id exists on the listjava.lang.IllegalStateException- if the provided entry was not
-
removeEntry
java.util.Optional<TabListEntry> removeEntry(java.util.UUID uniqueId)
Removes an entry from the list.Note that if this is used on a player, but they remain visible in-game, their skin will not work.
- Parameters:
uniqueId- The unique id of the entry to remove- Returns:
- The entry that was associated with the unique id
-
-