Make UI elements consistant

This commit is contained in:
ME1312 2018-08-06 22:39:29 -04:00
parent e74178e21c
commit ed1b45fccb
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
8 changed files with 40 additions and 29 deletions

View File

@ -272,11 +272,13 @@ public final class SubPlugin extends BungeeCord implements Listener {
}
int proxies = 1;
if (redis) {
System.out.println("SubServers > "+((status)?"Rel":"L")+"oading Proxies...");
try {
boolean first = true;
String master = (String) redis("getServerId");
for (String name : (List<String>) redis("getAllServers")) {
if (!ukeys.contains(name.toLowerCase()) && !master.equals(name)) try {
if (first) System.out.println("SubServers > "+((status)?"Rel":"L")+"oading Proxies...");
first = false;
Proxy proxy = this.proxies.get(name.toLowerCase());
if (proxy == null) {
proxy = new Proxy(name);
@ -395,7 +397,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
YAMLSection edits = new YAMLSection();
if (config.get().getSection("Servers").getSection(name).getBoolean("Enabled") != server.isEnabled())
edits.set("enabled", config.get().getSection("Servers").getSection(name).getBoolean("Enabled"));
if (config.get().getSection("Servers").getSection(name).getKeys().contains("Display") && ((config.get().getSection("Servers").getSection(name).getString("Display").length() == 0 && !server.getDisplayName().equals(server.getName())) || !config.get().getSection("Servers").getSection(name).getString("Display").equals(server.getDisplayName())))
if (config.get().getSection("Servers").getSection(name).getKeys().contains("Display") && ((config.get().getSection("Servers").getSection(name).getRawString("Display").length() == 0 && !server.getDisplayName().equals(server.getName())) || !config.get().getSection("Servers").getSection(name).getRawString("Display").equals(server.getDisplayName())))
edits.set("display", config.get().getSection("Servers").getSection(name).getRawString("Display"));
if (!config.get().getSection("Servers").getSection(name).getString("Host").equalsIgnoreCase(server.getHost().getName()))
edits.set("host", config.get().getSection("Servers").getSection(name).getRawString("Host"));
@ -460,8 +462,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
server.setAutoRestart(config.get().getSection("Servers").getSection(name).getBoolean("Auto-Restart"));
if (!status && config.get().getSection("Servers").getSection(name).getBoolean("Run-On-Launch"))
autorun.add(name.toLowerCase());
if (config.get().getSection("Servers").getSection(name).getKeys().contains("Display") && ((config.get().getSection("Servers").getSection(name).getString("Display").length() == 0 && !server.getDisplayName().equals(server.getName())) || !config.get().getSection("Servers").getSection(name).getString("Display").equals(server.getDisplayName())))
server.setDisplayName(config.get().getSection("Servers").getSection(name).getString("Display"));
if (config.get().getSection("Servers").getSection(name).getKeys().contains("Display") && ((config.get().getSection("Servers").getSection(name).getRawString("Display").length() == 0 && !server.getDisplayName().equals(server.getName())) || !config.get().getSection("Servers").getSection(name).getRawString("Display").equals(server.getDisplayName())))
server.setDisplayName(config.get().getSection("Servers").getSection(name).getRawString("Display"));
if (config.get().getSection("Servers").getSection(name).getKeys().contains("Group")) {
for (String group : server.getGroups()) server.removeGroup(group);
for (String group : config.get().getSection("Servers").getSection(name).getStringList("Group")) server.addGroup(group);

View File

@ -275,7 +275,7 @@ public class InternalUIHandler implements UIHandler, Listener {
} else if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back"))) {
player.closeInventory();
gui.back();
} else if (!item.equals(ChatColor.RESET.toString()) && !item.equals(plugin.api.getLang("SubServers", "Interface.Server-Menu.No-Servers"))) {
} else if (!item.equals(ChatColor.RESET.toString()) && !item.startsWith(ChatColor.WHITE.toString()) && !item.equals(plugin.api.getLang("SubServers", "Interface.Server-Menu.No-Servers"))) {
player.closeInventory();
String obj;
if (event.getCurrentItem().getItemMeta().getLore() != null && event.getCurrentItem().getItemMeta().getLore().size() > 0 && event.getCurrentItem().getItemMeta().getLore().get(0).startsWith(ChatColor.GRAY.toString())) {

View File

@ -857,12 +857,12 @@ public class InternalUIRenderer extends UIRenderer {
if (hosts.get(server) == null) {
block = createItem("STAINED_GLASS_PANE", external.name(), external.get());
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.AQUA + json.getSection("servers").getSection(server).getString("display"));
blockMeta.setDisplayName(ChatColor.WHITE + json.getSection("servers").getSection(server).getString("display"));
LinkedList<String> lore = new LinkedList<String>();
if (!server.equals(json.getSection("servers").getSection(server).getString("display")))
lore.add(ChatColor.GRAY + server);
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("servers").getSection(server).getSection("players").getKeys().size())));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External"));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("servers").getSection(server).getSection("players").getKeys().size())));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Invalid"));
lore.add(ChatColor.WHITE + ((plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false))?json.getSection("servers").getSection(server).getString("address"):json.getSection("servers").getSection(server).getString("address").split(":")[json.getSection("servers").getSection(server).getString("address").split(":").length - 1]));
blockMeta.setLore(lore);
@ -873,8 +873,8 @@ public class InternalUIRenderer extends UIRenderer {
LinkedList<String> lore = new LinkedList<String>();
if (!server.equals(json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getString("display")))
lore.add(ChatColor.GRAY + server);
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getSection("players").getKeys().size())));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getSection("players").getKeys().size())));
lore.add(ChatColor.WHITE + ((plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false))?json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getString("address"):json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getString("address").split(":")[json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getString("address").split(":").length - 1]));
blockMeta.setLore(lore);
} else if (json.getSection("hosts").getSection(hosts.get(server)).getSection("servers").getSection(server).getBoolean("running")) {
@ -1095,8 +1095,8 @@ public class InternalUIRenderer extends UIRenderer {
LinkedList<String> lore = new LinkedList<String>();
if (!subserver.equals(json.getSection("server").getString("display")))
lore.add(ChatColor.GRAY + subserver);
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("server").getSection("players").getKeys().size())));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"));
lore.add(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(json.getSection("server").getSection("players").getKeys().size())));
lore.add(ChatColor.WHITE + ((plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false))?json.getSection("server").getString("address"):json.getSection("server").getString("address").split(":")[json.getSection("server").getString("address").split(":").length - 1]));
blockMeta.setLore(lore);
} else if (json.getSection("server").getBoolean("running")) {

View File

@ -48,7 +48,7 @@ public class BungeeChat {
hoverm = new LinkedList<TextComponent>();
message = new TextComponent(data.getSection("groups").getSection(group).getSection(server).getString("display"));
hover = new TextComponent(data.getSection("groups").getSection(group).getSection(server).getString("display") + '\n');
if (data.getSection("groups").getSection(group).getSection(server).getKeys().contains("enabled")) {
if (data.getSection("groups").getSection(group).getSection(server).getKeys().contains("host")) {
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, label + " open SubServer/ " + server));
if (data.getSection("groups").getSection(group).getSection(server).getBoolean("temp")) {
message.setColor(ChatColor.AQUA);
@ -59,9 +59,9 @@ public class BungeeChat {
hover.setColor(ChatColor.GRAY);
hoverm.add(hover);
}
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())) + '\n');
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary") + '\n');
hoverm.add(hover);
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"));
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())));
} else if (data.getSection("groups").getSection(group).getSection(server).getBoolean("running")) {
message.setColor(ChatColor.GREEN);
hover.setColor(ChatColor.GREEN);
@ -119,10 +119,12 @@ public class BungeeChat {
hoverm.add(hover);
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External"));
hoverm.add(hover);
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())) + '\n');
hoverm.add(hover);
if (plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false)) {
hover = new TextComponent('\n' + data.getSection("servers").getSection(server).getString("address"));
hover = new TextComponent('\n' + data.getSection("groups").getSection(group).getSection(server).getString("address"));
} else {
hover = new TextComponent('\n' + data.getSection("servers").getSection(server).getString("address").split(":")[data.getSection("servers").getSection(server).getString("address").split(":").length - 1]);
hover = new TextComponent('\n' + data.getSection("groups").getSection(group).getSection(server).getString("address").split(":")[data.getSection("groups").getSection(group).getSection(server).getString("address").split(":").length - 1]);
}
hover.setColor(ChatColor.WHITE);
hoverm.add(hover);
@ -192,9 +194,9 @@ public class BungeeChat {
hover.setColor(ChatColor.GRAY);
hoverm.add(hover);
}
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getSection("players").getKeys().size())) + '\n');
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary") + '\n');
hoverm.add(hover);
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"));
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getSection("players").getKeys().size())));
} else if (data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getBoolean("running")) {
message.setColor(ChatColor.GREEN);
hover.setColor(ChatColor.GREEN);
@ -271,7 +273,9 @@ public class BungeeChat {
hover.setColor(ChatColor.GRAY);
hoverm.add(hover);
}
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External"));
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External") + '\n');
hoverm.add(hover);
hover = new TextComponent(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("servers").getSection(server).getSection("players").getKeys().size())));
hoverm.add(hover);
if (plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false)) {
hover = new TextComponent('\n' + data.getSection("servers").getSection(server).getString("address"));

View File

@ -87,7 +87,7 @@ public final class SubCommand implements CommandExecutor {
message += ChatColor.GOLD + group + plugin.api.getLang("SubServers", "Command.List.Header");
for (String server : data.getSection("groups").getSection(group).getKeys()) {
if (i != 0) message += div;
if (!data.getSection("groups").getSection(group).getSection(server).getKeys().contains("enabled")) {
if (!data.getSection("groups").getSection(group).getSection(server).getKeys().contains("host")) {
message += ChatColor.WHITE;
} else if (data.getSection("groups").getSection(group).getSection(server).getBoolean("temp")) {
message += ChatColor.AQUA;

View File

@ -207,7 +207,7 @@ public final class SubCommand implements CommandExecutor {
for (String server : data.getSection("groups").getSection(group).getKeys()) {
Text.Builder message = Text.builder(data.getSection("groups").getSection(group).getSection(server).getString("display"));
Text.Builder hover = Text.builder(data.getSection("groups").getSection(group).getSection(server).getString("display") + '\n');
if (data.getSection("groups").getSection(group).getSection(server).getKeys().contains("enabled")) {
if (data.getSection("groups").getSection(group).getSection(server).getKeys().contains("host")) {
message.onClick(TextActions.runCommand("/subservers open SubServer/ " + server));
if (data.getSection("groups").getSection(group).getSection(server).getBoolean("temp")) {
message.color(TextColors.AQUA);
@ -216,8 +216,8 @@ public final class SubCommand implements CommandExecutor {
hover.append(Text.builder(server + '\n').color(TextColors.GRAY).build());
}
hover.append(
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())) + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"))
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary") + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())))
);
} else if (data.getSection("groups").getSection(group).getSection(server).getBoolean("running")) {
message.color(TextColors.GREEN);
@ -264,11 +264,14 @@ public final class SubCommand implements CommandExecutor {
} else {
message.color(TextColors.WHITE);
hover.color(TextColors.WHITE);
hover.append(Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External")));
hover.append(
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External") + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("groups").getSection(group).getSection(server).getSection("players").getKeys().size())))
);
if (plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false)) {
hover.append(Text.builder('\n' + data.getSection("servers").getSection(server).getString("address")).color(TextColors.WHITE).build());
hover.append(Text.builder('\n' + data.getSection("groups").getSection(group).getSection(server).getString("address")).color(TextColors.WHITE).build());
} else {
hover.append(Text.builder('\n' + data.getSection("servers").getSection(server).getString("address").split(":")[data.getSection("servers").getSection(server).getString("address").split(":").length - 1]).color(TextColors.WHITE).build());
hover.append(Text.builder('\n' + data.getSection("groups").getSection(group).getSection(server).getString("address").split(":")[data.getSection("groups").getSection(group).getSection(server).getString("address").split(":").length - 1]).color(TextColors.WHITE).build());
}
}
message.onHover(TextActions.showText(hover.build()));
@ -321,8 +324,8 @@ public final class SubCommand implements CommandExecutor {
hover.append(Text.builder(subserver + '\n').color(TextColors.GRAY).build());
}
hover.append(
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getSection("players").getKeys().size())) + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary"))
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.SubServer-Temporary") + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getSection("players").getKeys().size())))
);
} else if (data.getSection("hosts").getSection(host).getSection("servers").getSection(subserver).getBoolean("running")) {
message.color(TextColors.GREEN);
@ -383,7 +386,9 @@ public final class SubCommand implements CommandExecutor {
if (!server.equals(data.getSection("servers").getSection(server).getString("display"))) {
hover.append(Text.builder(server + '\n').color(TextColors.GRAY).build());
}
hover.append(Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External")));
hover.append(
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-External") + '\n'),
Text.of(plugin.api.getLang("SubServers", "Interface.Server-Menu.Server-Player-Count").replace("$int$", new DecimalFormat("#,###").format(data.getSection("servers").getSection(server).getSection("players").getKeys().size()))));
if (plugin.config.get().getSection("Settings").getBoolean("Show-Addresses", false)) {
hover.append(Text.builder('\n' + data.getSection("servers").getSection(server).getString("address")).color(TextColors.WHITE).build());
} else {

View File

@ -112,7 +112,7 @@ public class SubCommand {
message += TextColor.GOLD + group + TextColor.RESET + ": ";
for (String server : data.getSection("groups").getSection(group).getKeys()) {
if (i != 0) message += div;
if (!data.getSection("groups").getSection(group).getSection(server).contains("enabled")) {
if (!data.getSection("groups").getSection(group).getSection(server).contains("host")) {
message += TextColor.WHITE;
} else if (data.getSection("groups").getSection(group).getSection(server).getBoolean("temp")) {
message += TextColor.AQUA;

View File

@ -102,7 +102,7 @@ public final class SubCommand extends CommandX {
message += ChatColor.GOLD + group + ChatColor.RESET + ": ";
for (String server : data.getSection("groups").getSection(group).getKeys()) {
if (i != 0) message += div;
if (!data.getSection("groups").getSection(group).getSection(server).contains("enabled")) {
if (!data.getSection("groups").getSection(group).getSection(server).contains("host")) {
message += ChatColor.WHITE;
} else if (data.getSection("groups").getSection(group).getSection(server).getBoolean("temp")) {
message += ChatColor.AQUA;