diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java
index 11a4ac6e..6f9bae3c 100644
--- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java
+++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java
@@ -112,6 +112,7 @@ public class SteamwarDiscordBot {
addCommand(commands, new BanCommand());
addCommand(commands, new WhoisCommand());
addCommand(commands, new TeamCommand());
+ addCommand(commands, new ListCommand());
commands.complete();
}
diff --git a/src/de/steamwar/bungeecore/bot/commands/ListCommand.java b/src/de/steamwar/bungeecore/bot/commands/ListCommand.java
new file mode 100644
index 00000000..20501808
--- /dev/null
+++ b/src/de/steamwar/bungeecore/bot/commands/ListCommand.java
@@ -0,0 +1,43 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2020 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.bungeecore.bot.commands;
+
+import net.dv8tion.jda.api.EmbedBuilder;
+import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
+
+import java.util.stream.Collectors;
+
+public class ListCommand extends BasicDiscordCommand {
+
+ public ListCommand() {
+ super("list", "Gebe eine Liste aller online Spieler");
+ }
+
+ @Override
+ public void run(SlashCommandEvent event) {
+ de.steamwar.bungeecore.commands.ListCommand.updateCustomTablist();
+ EmbedBuilder embedBuilder = new EmbedBuilder();
+ embedBuilder.setTitle("List");
+ de.steamwar.bungeecore.commands.ListCommand.getPlayerMap().forEach((s, proxiedPlayers) -> {
+ embedBuilder.addField(s, proxiedPlayers.stream().map(player -> "`" + player.getName() + "`").collect(Collectors.joining(", ")), true);
+ });
+ event.replyEmbeds(embedBuilder.build()).setEphemeral(true).complete();
+ }
+}
diff --git a/src/de/steamwar/bungeecore/commands/ListCommand.java b/src/de/steamwar/bungeecore/commands/ListCommand.java
index b5d2f2d8..b7a4a63d 100644
--- a/src/de/steamwar/bungeecore/commands/ListCommand.java
+++ b/src/de/steamwar/bungeecore/commands/ListCommand.java
@@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
+import lombok.Getter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
@@ -39,9 +40,10 @@ public class ListCommand extends BasicCommand {
super("list", "");
}
- private final TreeMap> playerMap = new TreeMap<>();
+ @Getter
+ private static final TreeMap> playerMap = new TreeMap<>();
- private synchronized void updateCustomTablist(){
+ public static synchronized void updateCustomTablist(){
//Calculate server-player-map
playerMap.clear();
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {