crwdns149777:0crwdne149777:0
crwdns149779:0crwdne149779:0
crwdns149781:0:javadoc:crwdnd149781:0:javadoc:crwdne149781:0
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.tab.TabList;
TabList tablist = player.getTabList();
crwdns149783:0crwdne149783: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"));
crwdns149785:0:javadoc:crwdne149785:0
tablist.setHeaderAndFooter(Text.of("header"), Text.of("footer"));
Note
crwdns149787:0:javadoc:crwdnd149787:0:javadoc:crwdne149787:0
crwdns149789:0crwdne149789:0
crwdns149791:0crwdne149791: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);
crwdns149793:0:javadoc:crwdnd149793:0:javadoc:crwdnd149793:0:javadoc:crwdnd149793:0:doc:crwdnd149793:0:javadoc:crwdne149793:0
crwdns149795:0crwdne149795:0
TabListEntry entry = TabListEntry.builder()
.list(tablist)
.displayName(Text.of("Spongie"))
.latency(0)
.profile(gameProfile)
.build();
tablist.addEntry(entry);
crwdns149797:0:javadoc:crwdnd149797:0:javadoc:crwdne149797:0
crwdns149799:0crwdne149799:0
crwdns149801:0:javadoc:crwdne149801:0
import java.util.Optional;
Optional<TabListEntry> optional = tablist.getEntry(uuid);
if (optional.isPresent()) {
TabListEntry entry = optional.get();
}
crwdns149803:0crwdne149803:0
entry.setDisplayName(Text.of("Pretender Spongie"));
entry.setLatency(1000);
entry.setGameMode(GameModes.SPECTATOR);
crwdns149805:0:javadoc:crwdne149805:0
crwdns149807:0:javadoc:crwdne149807:0