mirror of
https://github.com/ME1312/SubServers-2.git
synced 2025-01-23 16:11:21 +01:00
Hide menu buttons when their linked menu is unused
This commit is contained in:
parent
54c61207a5
commit
2e3525a31a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -463,7 +463,6 @@ public class InternalSubServer extends SubServerContainer {
|
||||
c += forward.edit(player, pending);
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -426,8 +426,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
legServers.clear();
|
||||
|
||||
int plugins = 0;
|
||||
if (api.listeners.size() > 0) {
|
||||
System.out.println("SubServers > "+((posted)?"Rel":"L")+"oading SubAPI Plugins...");
|
||||
if (!status && api.listeners.size() > 0) {
|
||||
System.out.println("SubServers > Loading SubAPI Plugins...");
|
||||
for (NamedContainer<Runnable, Runnable> listener : api.listeners) {
|
||||
try {
|
||||
if (listener.name() != null) {
|
||||
@ -440,7 +440,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("SubServers > " + ((plugins > 0)?plugins+" Plugin"+((plugins == 1)?"":"s")+", ":"") + hosts + " Host"+((hosts == 1)?"":"s")+", " + servers + " Server"+((servers == 1)?"":"s")+", and " + subservers + " SubServer"+((subservers == 1)?"":"s")+" "+((posted)?"re":"")+"loaded in " + new DecimalFormat("0.000").format((Calendar.getInstance().getTime().getTime() - begin) / 1000D) + "s");
|
||||
System.out.println("SubServers > " + ((plugins > 0)?plugins+" Plugin"+((plugins == 1)?"":"s")+", ":"") + hosts + " Host"+((hosts == 1)?"":"s")+", " + servers + " Server"+((servers == 1)?"":"s")+", and " + subservers + " SubServer"+((subservers == 1)?"":"s")+" "+((status)?"re":"")+"loaded in " + new DecimalFormat("0.000").format((Calendar.getInstance().getTime().getTime() - begin) / 1000D) + "s");
|
||||
}
|
||||
|
||||
private void post() {
|
||||
|
Binary file not shown.
@ -74,6 +74,9 @@ public class InternalUIHandler implements UIHandler, Listener {
|
||||
} else if (item.equals(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Group-Menu", '&'))) {
|
||||
player.closeInventory();
|
||||
gui.groupMenu(1);
|
||||
} else if (item.equals(plugin.lang.getSection("Lang").getColoredString("Interface.Group-Menu.Server-Menu", '&'))) {
|
||||
player.closeInventory();
|
||||
gui.serverMenu(1, null, null);
|
||||
} else if (!item.equals(ChatColor.RESET.toString()) && !item.equals(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.No-Hosts", '&'))) {
|
||||
player.closeInventory();
|
||||
String obj;
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.ME1312.SubServers.Client.Bukkit.Graphic;
|
||||
|
||||
import net.ME1312.SubServers.Client.Bukkit.Library.Container;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Library.NamedContainer;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Library.Util;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadHostInfo;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadServerInfo;
|
||||
@ -17,8 +15,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Internal GUI Renderer Class
|
||||
@ -182,9 +178,15 @@ public class InternalUIRenderer extends UIRenderer {
|
||||
inv.setItem(i++, block);
|
||||
} else i += 2;
|
||||
i++;
|
||||
block = createItem("STAINED_GLASS_PANE", "ORANGE_STAINED_GLASS_PANE", (short) 1);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Group-Menu", '&'));
|
||||
if (json.getJSONObject("groups").length() <= 0) {
|
||||
block = createItem("STAINED_GLASS_PANE", "LIME_STAINED_GLASS_PANE", (short) 5);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Group-Menu.Server-Menu", '&'));
|
||||
} else {
|
||||
block = createItem("STAINED_GLASS_PANE", "ORANGE_STAINED_GLASS_PANE", (short) 1);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Group-Menu", '&'));
|
||||
}
|
||||
block.setItemMeta(blockMeta);
|
||||
inv.setItem(i++, block);
|
||||
inv.setItem(i++, block);
|
||||
@ -262,16 +264,14 @@ public class InternalUIRenderer extends UIRenderer {
|
||||
inv.setItem(15, block);
|
||||
inv.setItem(16, block);
|
||||
|
||||
if (!json.getJSONObject("host").getBoolean("enabled")) {
|
||||
block = createItem("STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE", (short) 7);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(ChatColor.GRAY+ChatColor.stripColor(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Admin.Plugins", '&')));
|
||||
if (!json.getJSONObject("host").getBoolean("enabled") || hostPlugins.size() <= 0) {
|
||||
block = div;
|
||||
} else {
|
||||
block = createItem("STAINED_GLASS_PANE", "BLUE_STAINED_GLASS_PANE", (short) 11);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Admin.Plugins", '&'));
|
||||
block.setItemMeta(blockMeta);
|
||||
}
|
||||
block.setItemMeta(blockMeta);
|
||||
inv.setItem(27, block);
|
||||
inv.setItem(28, block);
|
||||
|
||||
@ -577,7 +577,7 @@ public class InternalUIRenderer extends UIRenderer {
|
||||
lastPage = page;
|
||||
List<String> renderers = new ArrayList<String>();
|
||||
for (String renderer : renderers) {
|
||||
if (subserverPlugins.get(renderer).isEnabled(json.getJSONObject("host"))) renderers.add(renderer);
|
||||
if (hostPlugins.get(renderer).isEnabled(json.getJSONObject("host"))) renderers.add(renderer);
|
||||
}
|
||||
Collections.sort(renderers);
|
||||
|
||||
@ -1076,16 +1076,14 @@ public class InternalUIRenderer extends UIRenderer {
|
||||
inv.setItem(14, block);
|
||||
}
|
||||
|
||||
if (!json.getJSONObject("server").getBoolean("enabled")) {
|
||||
block = createItem("STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE", (short) 7);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(ChatColor.GRAY+ChatColor.stripColor(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Admin.Plugins", '&')));
|
||||
if (!json.getJSONObject("server").getBoolean("enabled") || subserverPlugins.size() <= 0) {
|
||||
block = div;
|
||||
} else {
|
||||
block = createItem("STAINED_GLASS_PANE", "BLUE_STAINED_GLASS_PANE", (short) 11);
|
||||
blockMeta = block.getItemMeta();
|
||||
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Admin.Plugins", '&'));
|
||||
block.setItemMeta(blockMeta);
|
||||
}
|
||||
block.setItemMeta(blockMeta);
|
||||
inv.setItem(27, block);
|
||||
inv.setItem(28, block);
|
||||
|
||||
|
Binary file not shown.
@ -103,10 +103,10 @@ public class SubLogger {
|
||||
}
|
||||
|
||||
// Log to NETWORK
|
||||
if (log.get()) SubAPI.getInstance().getSubDataNetwork().sendPacket(new PacketOutExLogMessage(address, line));
|
||||
if (log.get() && SubAPI.getInstance().getInternals().config.get().getSection("Settings").getBoolean("Network-Log", true)) SubAPI.getInstance().getSubDataNetwork().sendPacket(new PacketOutExLogMessage(address, line));
|
||||
|
||||
// Log to CONSOLE
|
||||
if (log.get() && SubAPI.getInstance().getInternals().config.get().getSection("Settings").getBoolean("Log")) level.println(msg);
|
||||
if (log.get() && SubAPI.getInstance().getInternals().config.get().getSection("Settings").getBoolean("Console-Log", true)) level.println(msg);
|
||||
|
||||
// Log to FILE
|
||||
if (writer != null) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
Settings:
|
||||
Version: '2.11.2a+'
|
||||
Log: true
|
||||
Console-Log: true
|
||||
Network-Log: true
|
||||
Server-Bind: '127.0.0.1'
|
||||
SubData:
|
||||
Name: 'undefined'
|
||||
|
Loading…
Reference in New Issue
Block a user