Archiviert
1
0

Add TablistManager MultiLang

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-19 17:39:51 +01:00
Ursprung 1b69057eea
Commit 6bd9cd6fdd
2 geänderte Dateien mit 32 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import codecrafter47.bungeetablistplus.api.bungee.BungeeTabListPlusAPI;
import codecrafter47.bungeetablistplus.api.bungee.Icon;
import codecrafter47.bungeetablistplus.tablist.DefaultCustomTablist;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.sql.SteamwarUser;
@ -49,7 +50,6 @@ public class TablistManager extends BasicListener {
private Icon darkGray;
private Icon gray;
private String header;
private int size;
private TreeMap<String, List<ProxiedPlayer>> playerMap = new TreeMap<>();
@ -67,25 +67,25 @@ public class TablistManager extends BasicListener {
}
}
private void calcHeader(){
if(seconds % 4 == 0){
int phase = (seconds % 16) / 4;
switch(phase){
case 0:
header = "§8Spieler online: §e" + ProxyServer.getInstance().getPlayers().size();
break;
case 1:
header = "§8Teamspeak: §eSteam§8War.de";
break;
case 2:
header = "§8Discord: §8https://discord.gg/J4NtQmM";
break;
case 3:
default:
header = "§8Website: https://§eSteam§8War.de";
break;
}
private String calcHeader(ProxiedPlayer player){
String header;
int phase = (seconds % 16) / 4;
switch(phase){
case 0:
header = Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size());
break;
case 1:
header = Message.parse("TABLIST_PHASE_1", player);
break;
case 2:
header = Message.parse("TABLIST_PHASE_2", player);
break;
case 3:
default:
header = Message.parse("TABLIST_PHASE_DEFAULT", player);
break;
}
return header;
}
private void calculateSize(){
@ -100,8 +100,6 @@ public class TablistManager extends BasicListener {
}
private synchronized void updateCustomTablist(){
calcHeader();
//Calculate server-player-map
playerMap.clear();
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
@ -115,9 +113,9 @@ public class TablistManager extends BasicListener {
Subserver subserver = Subserver.getSubserver(server);
List<ProxiedPlayer> players;
if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
players = playerMap.getOrDefault("Bau", new ArrayList<>());
players = playerMap.getOrDefault("%bauserverplaceholder%", new ArrayList<>());
players.add(player);
playerMap.putIfAbsent("Bau", players);
playerMap.putIfAbsent("%bauserverplaceholder%", players);
}else{
players = playerMap.getOrDefault(serverName, new ArrayList<>());
players.add(player);
@ -168,7 +166,7 @@ public class TablistManager extends BasicListener {
try {
ServerInfo currentServer = player.getServer().getInfo();
setHeader(header);
setHeader(calcHeader(player));
setFooter("§e" + currentServer.getName() + " " + getPing() + "§8ms");
setSize(size, 20);
@ -178,6 +176,8 @@ public class TablistManager extends BasicListener {
setSlot(i%20, i/20, darkGray, "", 1000);
i++;
}
if(server.equals("%bauserverplaceholder%"))
server = Message.parse("TABLIST_BAU", player);
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
i++;
for (ProxiedPlayer p : playerMap.get(server)){

Datei anzeigen

@ -449,4 +449,11 @@ POLL_HEADER=§e§lUmfrage
POLL_HEADER2=§7Klicke die Antwort an, die dir gefällt!
POLL_QUESTION=§e{0}
POLL_ANWSER=§7{0}
POLL_ANWSER_HOVER=§e{0} §ewählen
POLL_ANWSER_HOVER=§e{0} §ewählen
#TablistManager
TABLIST_PHASE_0=§8Spieler online: §e{0}
TABLIST_PHASE_1=§8Teamspeak: §eSteam§8War.de
TABLIST_PHASE_2=§8Discord: §8https://§eSteam§8War.de/discord
TABLIST_PHASE_DEFAULT=§8Website: https://§eSteam§8War.de
TABLIST_BAU=Bau