mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-27 13:15:29 +01:00
Fixed errors with the section management command
This commit is contained in:
parent
330ed1c96a
commit
66f31500d8
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.jaimemartz</groupId>
|
<groupId>me.jaimemartz</groupId>
|
||||||
<artifactId>lobbybalancer</artifactId>
|
<artifactId>lobbybalancer</artifactId>
|
||||||
<version>2.0.9.1</version>
|
<version>2.0.9.2</version>
|
||||||
<name>LobbyBalancer</name>
|
<name>LobbyBalancer</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -73,7 +73,7 @@ public class ManageCommand extends Command {
|
|||||||
new Replacement("{name}", ChatColor.RED + section.getName()));
|
new Replacement("{name}", ChatColor.RED + section.getName()));
|
||||||
|
|
||||||
msgr.send("&7Principal: &b{status}",
|
msgr.send("&7Principal: &b{status}",
|
||||||
new Replacement("{status}", format(section.isPrincipal())));
|
new Replacement("{status}", section.isPrincipal() ? ChatColor.GREEN + "yes" : ChatColor.RED + "no"));
|
||||||
|
|
||||||
if (section.hasParent()) {
|
if (section.hasParent()) {
|
||||||
TextComponent message = new TextComponent("Parent: ");
|
TextComponent message = new TextComponent("Parent: ");
|
||||||
@ -92,24 +92,26 @@ public class ManageCommand extends Command {
|
|||||||
|
|
||||||
msgr.send("&7Provider: &b{name} &7({relation}&7)",
|
msgr.send("&7Provider: &b{name} &7({relation}&7)",
|
||||||
new Replacement("{name}", section.getProvider().name()),
|
new Replacement("{name}", section.getProvider().name()),
|
||||||
new Replacement("{relation}", section.isProviderInherited() ? "Inherited" : "Specified"));
|
new Replacement("{relation}", section.hasInheritedProvider() ? "Inherited" : "Specified"));
|
||||||
|
|
||||||
msgr.send("&7Dummy: &b{status}", new Replacement("{status}", format(section.isDummy())));
|
msgr.send("&7Dummy: &b{status}", new Replacement("{status}", section.isDummy() ? ChatColor.GREEN + "yes" : ChatColor.RED + "no"));
|
||||||
|
|
||||||
msgr.send("&7Section Server: &b{name}", new Replacement("{name}", section.hasServer() ? section.getServer().getName() : "None"));
|
msgr.send("&7Section Server: &b{name}", new Replacement("{name}", section.hasServer() ? section.getServer().getName() : "None"));
|
||||||
|
|
||||||
if (section.hasCommand()) {
|
if (section.hasCommand()) {
|
||||||
msgr.send("&7Section Command: &b{name}&7, Permission: &b{permission}&7, Aliases: &b{aliases}",
|
msgr.send("&7Section Command: &b{name}&7, Permission: &b{permission}&7, Aliases: &b{aliases}",
|
||||||
new Replacement("{name}", section.getCommand().getName()),
|
new Replacement("{name}", section.getCommand().getName()),
|
||||||
new Replacement("{permission}", section.getCommand().getPermission().equals("") ? "none" : section.getCommand().getPermission()),
|
new Replacement("{permission}", section.getCommand().getPermission().equals("") ? "None" : section.getCommand().getPermission()),
|
||||||
new Replacement("{aliases}", StringCombiner.combine(section.getCommand().getAliases(), ", ")));
|
new Replacement("{aliases}", section.getCommand().getAliases().length == 0 ? "None" : StringCombiner.combine(section.getCommand().getAliases(), ", ")));
|
||||||
} else {
|
} else {
|
||||||
msgr.send("&7Section Command: &bNone");
|
msgr.send("&7Section Command: &bNone");
|
||||||
}
|
}
|
||||||
|
|
||||||
msgr.send("&7Valid: &b{status}",
|
msgr.send("&7Valid: &b{status}",
|
||||||
new Replacement("{status}", format(section.isValid())));
|
new Replacement("{status}", section.isValid() ? ChatColor.GREEN + "yes" : ChatColor.RED + "no"));
|
||||||
|
|
||||||
|
|
||||||
|
if (!section.getServers().isEmpty()) {
|
||||||
msgr.send("&7Section Servers: ");
|
msgr.send("&7Section Servers: ");
|
||||||
section.getServers().forEach(server -> {
|
section.getServers().forEach(server -> {
|
||||||
ServerStatus status = plugin.getPingManager().getStatus(server);
|
ServerStatus status = plugin.getPingManager().getStatus(server);
|
||||||
@ -120,6 +122,10 @@ public class ManageCommand extends Command {
|
|||||||
new Replacement("{status}", status.isAccessible() ? ChatColor.GREEN + "Accessible" : ChatColor.RED + "Inaccessible")
|
new Replacement("{status}", status.isAccessible() ? ChatColor.GREEN + "Accessible" : ChatColor.RED + "Inaccessible")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
msgr.send("&7Section Servers: &bNone");
|
||||||
|
}
|
||||||
|
|
||||||
msgr.send("&7&m-----------------------------------------------------");
|
msgr.send("&7&m-----------------------------------------------------");
|
||||||
} else {
|
} else {
|
||||||
msgr.send(ConfigEntries.UNKNOWN_SECTION_MESSAGE.get());
|
msgr.send(ConfigEntries.UNKNOWN_SECTION_MESSAGE.get());
|
||||||
@ -136,6 +142,7 @@ public class ManageCommand extends Command {
|
|||||||
TextComponent message = new TextComponent(String.format("There are %s configured sections:\n", keys.size()));
|
TextComponent message = new TextComponent(String.format("There are %s configured sections:\n", keys.size()));
|
||||||
message.setColor(ChatColor.GRAY);
|
message.setColor(ChatColor.GRAY);
|
||||||
|
|
||||||
|
if (iterator.hasNext()) {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
String name = iterator.next();
|
String name = iterator.next();
|
||||||
TextComponent extra = new TextComponent(name);
|
TextComponent extra = new TextComponent(name);
|
||||||
@ -151,6 +158,12 @@ public class ManageCommand extends Command {
|
|||||||
|
|
||||||
message.addExtra(extra);
|
message.addExtra(extra);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
TextComponent extra = new TextComponent("There are no sections to list");
|
||||||
|
extra.setColor(ChatColor.RED);
|
||||||
|
message.addExtra(extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
break;
|
break;
|
||||||
@ -179,8 +192,4 @@ public class ManageCommand extends Command {
|
|||||||
"&7&m-----------------------------------------------------"
|
"&7&m-----------------------------------------------------"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String format(boolean reference) {
|
|
||||||
return reference ? ChatColor.GREEN + "yes" : ChatColor.RED + "no";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class ServerSection {
|
|||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProviderInherited() {
|
public boolean hasInheritedProvider() {
|
||||||
return inherited;
|
return inherited;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ settings:
|
|||||||
# Comment a message to disable it
|
# Comment a message to disable it
|
||||||
messages:
|
messages:
|
||||||
connecting: '&aConnecting to {server}'
|
connecting: '&aConnecting to {server}'
|
||||||
failure: '&cCould not find a server to connect to'
|
failure: '&cCould not find a server to get connected'
|
||||||
unavailable: '&cThis command cannot be executed on this server'
|
unavailable: '&cThis command cannot be executed on this server'
|
||||||
unknown: '&cCould not find a section with that name'
|
unknown: '&cCould not find a section with that name'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user