mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
fix glist command when UUID to name translation fails by returning the uuid
This commit is contained in:
parent
d806bc2d41
commit
f722b8c9d3
@ -60,7 +60,9 @@ public class RedisBungeeCommands {
|
||||
Multimap<String, UUID> serverToPlayers = plugin.getApi().getServerToPlayers();
|
||||
Multimap<String, String> human = HashMultimap.create();
|
||||
for (Map.Entry<String, UUID> entry : serverToPlayers.entries()) {
|
||||
human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false));
|
||||
// if for any reason UUID translation fails just return the uuid as name, to make command finish executing.
|
||||
String playerName = plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false);
|
||||
human.put(entry.getKey(), playerName != null ? playerName : entry.getValue().toString());
|
||||
}
|
||||
for (String server : new TreeSet<>(serverToPlayers.keySet())) {
|
||||
TextComponent serverName = new TextComponent();
|
||||
|
@ -58,7 +58,11 @@ public class RedisBungeeCommands {
|
||||
if (invocation.arguments().length > 0 && invocation.arguments()[0].equals("showall")) {
|
||||
Multimap<String, UUID> serverToPlayers = plugin.getApi().getServerToPlayers();
|
||||
Multimap<String, String> human = HashMultimap.create();
|
||||
serverToPlayers.forEach((key, value) -> human.put(key, plugin.getUuidTranslator().getNameFromUuid(value, false)));
|
||||
serverToPlayers.forEach((key, value) -> {
|
||||
// if for any reason UUID translation fails just return the uuid as name, to make command finish executing.
|
||||
String playerName = plugin.getUuidTranslator().getNameFromUuid(value, false);
|
||||
human.put(key, playerName != null ? playerName : value.toString());
|
||||
});
|
||||
for (String server : new TreeSet<>(serverToPlayers.keySet())) {
|
||||
Component serverName = Component.text("[" + server + "] ", NamedTextColor.GREEN);
|
||||
Component serverCount = Component.text("(" + serverToPlayers.get(server).size() + "): ", NamedTextColor.YELLOW);
|
||||
@ -281,6 +285,7 @@ public class RedisBungeeCommands {
|
||||
|
||||
public static class ServerIds implements SimpleCommand {
|
||||
private final RedisBungeeVelocityPlugin plugin;
|
||||
|
||||
public ServerIds(RedisBungeeVelocityPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user