SteamWar/BungeeCore
Archiviert
13
2

Add Team showcase in tablist
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-10-24 17:16:16 +02:00
Ursprung befae2d821
Commit 70a8d8e3ed
2 geänderte Dateien mit 20 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.tablist; package de.steamwar.bungeecore.tablist;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.UserGroup;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -51,8 +52,17 @@ interface TablistPart {
} }
public Item(ProxiedPlayer player) { public Item(ProxiedPlayer player) {
this(player, false);
}
public Item(ProxiedPlayer player, boolean sameTeam) {
this.uuid = player.getUniqueId(); this.uuid = player.getUniqueId();
this.displayName = reformat(SteamwarUser.get(player.getUniqueId()).getUserGroup().getColorCode() + player.getName()); UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
if (userGroup == UserGroup.Member && sameTeam) {
this.displayName = reformat("§f" + player.getName());
} else {
this.displayName = reformat(userGroup.getColorCode() + player.getName());
}
this.properties = playerProperties(player); this.properties = playerProperties(player);
} }

Datei anzeigen

@ -19,9 +19,11 @@
package de.steamwar.bungeecore.tablist; package de.steamwar.bungeecore.tablist;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.network.packets.common.FightInfoPacket; import de.steamwar.network.packets.common.FightInfoPacket;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.protocol.Property; import net.md_5.bungee.protocol.Property;
@ -73,7 +75,13 @@ public class TablistServer implements TablistPart {
items.add(new Item(null, "§7§l" + server.getName(), LIGHT_GRAY)); items.add(new Item(null, "§7§l" + server.getName(), LIGHT_GRAY));
} }
items.addAll(players); int team = SteamwarUser.get(player).getTeam();
players.stream().map(item -> {
ProxiedPlayer p = BungeeCord.getInstance().getPlayer(item.getUuid());
if (p == null) return item;
if (SteamwarUser.get(p).getTeam() != team) return item;
return new Item(p, true);
}).forEach(items::add);
} }
private void addPlayers(String prefix, List<Integer> teamPlayers, Collection<ProxiedPlayer> onlinePlayers){ private void addPlayers(String prefix, List<Integer> teamPlayers, Collection<ProxiedPlayer> onlinePlayers){