Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Also sort servers for /glist all
Dieser Commit ist enthalten in:
Ursprung
08173c50ef
Commit
63dcc56735
@ -0,0 +1,21 @@
|
||||
package com.velocitypowered.proxy.command;
|
||||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
class BuiltinCommandUtil {
|
||||
|
||||
private BuiltinCommandUtil() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
static List<RegisteredServer> sortedServerList(ProxyServer proxy) {
|
||||
List<RegisteredServer> servers = new ArrayList<>(proxy.getAllServers());
|
||||
servers.sort(Comparator.comparing(RegisteredServer::getServerInfo));
|
||||
return Collections.unmodifiableList(servers);
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ public class GlistCommand implements Command {
|
||||
} else if (args.length == 1) {
|
||||
String arg = args[0];
|
||||
if (arg.equalsIgnoreCase("all")) {
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
for (RegisteredServer server : BuiltinCommandUtil.sortedServerList(server)) {
|
||||
sendServerPlayers(source, server, true);
|
||||
}
|
||||
sendTotalProxyCount(source);
|
||||
|
@ -63,8 +63,7 @@ public class ServerCommand implements Command {
|
||||
// Assemble the list of servers as components
|
||||
TextComponent.Builder serverListBuilder = TextComponent.builder("Available servers: ")
|
||||
.color(TextColor.YELLOW);
|
||||
List<RegisteredServer> servers = new ArrayList<>(server.getAllServers());
|
||||
servers.sort(Comparator.comparing(RegisteredServer::getServerInfo));
|
||||
List<RegisteredServer> servers = BuiltinCommandUtil.sortedServerList(server);
|
||||
for (int i = 0; i < servers.size(); i++) {
|
||||
RegisteredServer rs = servers.get(i);
|
||||
serverListBuilder.append(formatServerComponent(currentServer, rs));
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren