diff --git a/pom.xml b/pom.xml
index cd9bacf9..397dd835 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,5 +62,11 @@
1.0
provided
+
+ steamwar
+ BungeeTabListPlus
+ 1.0
+ provided
+
\ No newline at end of file
diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java
index c44cc0c1..bef12ed3 100644
--- a/src/de/steamwar/bungeecore/BungeeCore.java
+++ b/src/de/steamwar/bungeecore/BungeeCore.java
@@ -96,6 +96,8 @@ public class BungeeCore extends Plugin {
new Broadcaster();
new SessionManager();
+ new Tablist();
+
getProxy().getScheduler().schedule(this, () -> {
SteamwarUser.clearCache();
Team.clearCache();
diff --git a/src/de/steamwar/bungeecore/listeners/Tablist.java b/src/de/steamwar/bungeecore/listeners/Tablist.java
new file mode 100644
index 00000000..d39f48b6
--- /dev/null
+++ b/src/de/steamwar/bungeecore/listeners/Tablist.java
@@ -0,0 +1,120 @@
+package de.steamwar.bungeecore.listeners;
+
+import codecrafter47.bungeetablistplus.BungeeTabListPlus;
+import codecrafter47.bungeetablistplus.api.bungee.BungeeTabListPlusAPI;
+import codecrafter47.bungeetablistplus.api.bungee.CustomTablist;
+import codecrafter47.bungeetablistplus.api.bungee.Icon;
+import de.steamwar.bungeecore.BungeeCore;
+import de.steamwar.bungeecore.Servertype;
+import de.steamwar.bungeecore.Subserver;
+import net.md_5.bungee.api.ProxyServer;
+import net.md_5.bungee.api.config.ServerInfo;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
+import net.md_5.bungee.api.event.PostLoginEvent;
+import net.md_5.bungee.event.EventHandler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+public class Tablist extends BasicListener {
+
+ private final CustomTablist tablist;
+ private int seconds = 0;
+ private final Icon darkGray;
+ private final Icon gray;
+
+
+ public Tablist(){
+ tablist = BungeeTabListPlusAPI.createCustomTablist();
+ ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::updateCustomTablist, 1, 1, TimeUnit.SECONDS);
+ tablist.setFooter("§8Ping: ${viewer_colored_ping}ms §8Server: §e${viewer server}"); //TODO: Set to tablist per player
+ //Preload due to bug
+ BungeeTabListPlus.getInstance().getSkinManager().getIcon("colors/dark_gray.png");
+ BungeeTabListPlus.getInstance().getSkinManager().getIcon("colors/gray.png");
+ darkGray = BungeeTabListPlus.getInstance().getSkinManager().getIcon("colors/dark_gray.png");
+ gray = BungeeTabListPlus.getInstance().getSkinManager().getIcon("colors/gray.png");
+ //TODO: Fix icons
+ }
+
+ private void setHeader(){
+ if(seconds % 4 == 0){
+ int phase = (seconds % 16) / 4;
+ switch(phase){
+ case 0:
+ tablist.setHeader("§8Spieler online: §e" + ProxyServer.getInstance().getPlayers().size());
+ break;
+ case 1:
+ tablist.setHeader("§8Teamspeak: §eSteam§8War.de");
+ break;
+ case 2:
+ tablist.setHeader("§8Discord: §8https://discord.gg/J4NtQmM");
+ break;
+ case 3:
+ tablist.setHeader("§8Website: https://§eSteam§8War.de");
+ break;
+ }
+ }
+ }
+
+ private void updateCustomTablist(){
+ setHeader();
+
+ //Calculate server-player-map
+ Map> playerMap = new HashMap<>();
+ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
+ ServerInfo server = player.getServer().getInfo();
+ String serverName = server.getName();
+ if(serverName.equals("Developer"))
+ continue;
+
+ Subserver subserver = Subserver.getSubserver(server);
+ List players;
+ if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
+ players = playerMap.getOrDefault("Bau", new ArrayList<>());
+ }else{
+ players = playerMap.getOrDefault(serverName, new ArrayList<>());
+ }
+
+ players.add(player);
+ playerMap.putIfAbsent(serverName, players);
+ }
+
+ //Set size
+ int size = -1;
+ for(Map.Entry> server : playerMap.entrySet())
+ size += 2 + server.getValue().size();
+ if(size < 0)
+ return;
+
+ size = size/20+20;
+
+ if(size > 80){
+ size = 80;
+ //TODO: Handle Oversize
+ }
+ tablist.setSize(size);
+
+ int i = 0;
+ //TODO: Set sorting
+ for(Map.Entry> server : playerMap.entrySet()){
+ if(i > 0)
+ tablist.setSlot(i++, 0, darkGray, "", 1000);
+ tablist.setSlot(i++, 0, gray,"§7§l" + server.getKey(), 1000);
+ for(ProxiedPlayer player : server.getValue())
+ tablist.setSlot(i++, 0, BungeeTabListPlusAPI.getIconFromPlayer(player), player.getDisplayName(), 1);
+ }
+
+ while(i < size)
+ tablist.setSlot(i++, 0, darkGray, "", 1000);
+
+ seconds++;
+ }
+
+ @EventHandler
+ public void onJoin(PostLoginEvent e){
+ BungeeTabListPlusAPI.setCustomTabList(e.getPlayer(), tablist);
+ }
+}
diff --git a/src/plugin.yml b/src/plugin.yml
index da71fb52..85fafe1f 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -2,4 +2,4 @@ name: BungeeCore
main: de.steamwar.bungeecore.BungeeCore
version: 1.0
author: Lixfel
-depends: [PersistentBungeeCore]
\ No newline at end of file
+depends: [PersistentBungeeCore, BungeeTabListPlus]
\ No newline at end of file