crwdns119761:0crwdne119761:0
crwdns119763:0crwdne119763:0
crwdns119765:0:javadoc:crwdnd119765:0:javadoc:crwdne119765:0
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.tab.TabList;
TabList tablist = player.getTabList();
crwdns119767:0crwdne119767:0
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;
tablist.setHeader(Text.of(TextColors.GOLD, "The tab list header"));
tablist.setFooter(Text.of(TextColors.RED, "The tab list footer"));
crwdns119769:0:javadoc:crwdne119769:0
tablist.setHeaderAndFooter(Text.of("header"), Text.of("footer"));
Note
crwdns119771:0:javadoc:crwdnd119771:0:javadoc:crwdne119771:0
crwdns119773:0crwdne119773:0
crwdns119775:0crwdne119775:0
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.entity.living.player.tab.TabListEntry;
import org.spongepowered.api.profile.GameProfile;
TabListEntry entry = TabListEntry.builder()
.list(tablist)
.gameMode(GameModes.SURVIVAL)
.profile(gameProfile)
.build();
tablist.addEntry(entry);
crwdns119777:0:javadoc:crwdnd119777:0:javadoc:crwdnd119777:0:javadoc:crwdnd119777:0:doc:crwdnd119777:0:javadoc:crwdne119777:0
crwdns119779:0crwdne119779:0
TabListEntry entry = TabListEntry.builder()
.list(tablist)
.displayName(Text.of("Spongie"))
.latency(0)
.profile(gameProfile)
.build();
tablist.addEntry(entry);
crwdns119781:0:javadoc:crwdnd119781:0:javadoc:crwdne119781:0
crwdns119783:0crwdne119783:0
crwdns119785:0:javadoc:crwdne119785:0
import java.util.Optional;
Optional<TabListEntry> optional = tablist.getEntry(uuid);
if (optional.isPresent()) {
TabListEntry entry = optional.get();
}
crwdns119787:0crwdne119787:0
entry.setDisplayName(Text.of("Pretender Spongie"));
entry.setLatency(1000);
entry.setGameMode(GameModes.SPECTATOR);
crwdns119789:0:javadoc:crwdne119789:0
crwdns119791:0:javadoc:crwdne119791:0