geforkt von SteamWar/BungeeCore
Update Heap size of ListCommand
Dieser Commit ist enthalten in:
Ursprung
1a8365e5c1
Commit
ac2a952017
@ -32,10 +32,10 @@ public class ListCommand extends BasicDiscordCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(SlashCommandEvent event) {
|
public void run(SlashCommandEvent event) {
|
||||||
de.steamwar.bungeecore.commands.ListCommand.updateCustomTablist();
|
de.steamwar.bungeecore.commands.ListCommand.getCustomTablist();
|
||||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
embedBuilder.setTitle("List");
|
embedBuilder.setTitle("List");
|
||||||
de.steamwar.bungeecore.commands.ListCommand.getPlayerMap().forEach((s, proxiedPlayers) -> {
|
de.steamwar.bungeecore.commands.ListCommand.getCustomTablist().forEach((s, proxiedPlayers) -> {
|
||||||
embedBuilder.addField(s, proxiedPlayers.stream().map(player -> "`" + player.getName() + "`").collect(Collectors.joining(", ")), true);
|
embedBuilder.addField(s, proxiedPlayers.stream().map(player -> "`" + player.getName() + "`").collect(Collectors.joining(", ")), true);
|
||||||
});
|
});
|
||||||
event.replyEmbeds(embedBuilder.build()).setEphemeral(true).queue();
|
event.replyEmbeds(embedBuilder.build()).setEphemeral(true).queue();
|
||||||
|
@ -22,7 +22,6 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.Servertype;
|
import de.steamwar.bungeecore.Servertype;
|
||||||
import de.steamwar.bungeecore.Subserver;
|
import de.steamwar.bungeecore.Subserver;
|
||||||
import lombok.Getter;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
@ -40,12 +39,8 @@ public class ListCommand extends BasicCommand {
|
|||||||
super("list", "");
|
super("list", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
public static synchronized TreeMap<String, List<ProxiedPlayer>> getCustomTablist(){
|
||||||
private static final TreeMap<String, List<ProxiedPlayer>> playerMap = new TreeMap<>();
|
TreeMap<String, List<ProxiedPlayer>> playerMap = new TreeMap<>();
|
||||||
|
|
||||||
public static synchronized void updateCustomTablist(){
|
|
||||||
//Calculate server-player-map
|
|
||||||
playerMap.clear();
|
|
||||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||||
Server pserver = player.getServer();
|
Server pserver = player.getServer();
|
||||||
if (pserver == null) //Happens temporarily
|
if (pserver == null) //Happens temporarily
|
||||||
@ -62,11 +57,12 @@ public class ListCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
playerMap.forEach((server, players) -> players.sort((proxiedPlayer, t1) -> proxiedPlayer.getName().compareToIgnoreCase(t1.getName())));
|
playerMap.forEach((server, players) -> players.sort((proxiedPlayer, t1) -> proxiedPlayer.getName().compareToIgnoreCase(t1.getName())));
|
||||||
|
return playerMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender commandSender, String[] strings) {
|
public void execute(CommandSender commandSender, String[] strings) {
|
||||||
updateCustomTablist();
|
TreeMap<String, List<ProxiedPlayer>> playerMap = getCustomTablist();
|
||||||
for (String server : playerMap.navigableKeySet()) {
|
for (String server : playerMap.navigableKeySet()) {
|
||||||
if (server.equals("Bau")) {
|
if (server.equals("Bau")) {
|
||||||
server = Message.parse("TABLIST_BAU", commandSender);
|
server = Message.parse("TABLIST_BAU", commandSender);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren