From 472c83f975bf5062be8d559878e814b414f48cce Mon Sep 17 00:00:00 2001 From: ME1312 Date: Fri, 26 Apr 2019 14:03:00 -0400 Subject: [PATCH] Add proper 1.14 support --- .../Host/External/ExternalSubLogger.java | 2 +- .../Host/Internal/InternalSubLogger.java | 2 +- .../Bukkit/Graphic/DefaultUIHandler.java | 42 ++++++++++--------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/External/ExternalSubLogger.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/External/ExternalSubLogger.java index 0d7826e0..fa8812d9 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/External/ExternalSubLogger.java +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/External/ExternalSubLogger.java @@ -140,7 +140,7 @@ public class ExternalSubLogger extends SubLogger { @Override public void unregisterFilter(SubLogFilter filter) { if (Util.isNull(filter)) throw new NullPointerException(); - filters.remove(filter); + Util.isException(() -> filters.remove(filter)); } @Override diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubLogger.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubLogger.java index f7c95383..5aa9757f 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubLogger.java +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubLogger.java @@ -156,7 +156,7 @@ public class InternalSubLogger extends SubLogger { @Override public void unregisterFilter(SubLogFilter filter) { if (Util.isNull(filter)) throw new NullPointerException(); - filters.remove(filter); + Util.isException(() -> filters.remove(filter)); } private void destroy() { diff --git a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Graphic/DefaultUIHandler.java b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Graphic/DefaultUIHandler.java index 04a18afc..d7a6f995 100644 --- a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Graphic/DefaultUIHandler.java +++ b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Graphic/DefaultUIHandler.java @@ -59,12 +59,14 @@ public class DefaultUIHandler implements UIHandler, Listener { Player player = (Player) event.getWhoClicked(); if (!event.isCancelled() && enabled && gui.keySet().contains(player.getUniqueId())) { DefaultUIRenderer gui = this.gui.get(player.getUniqueId()); - if (gui.open && event.getClickedInventory() != null && event.getClickedInventory().getTitle() != null) { + String title = event.getView().getTitle(); + + if (gui.open && event.getClickedInventory() != null && title != null) { if (plugin.subdata == null) { new IllegalStateException("SubData is not connected").printStackTrace(); } else if (Util.isException(() -> plugin.api.getLangChannels())) { new IllegalStateException("There are no lang options available at this time").printStackTrace(); - } else if (event.getClickedInventory().getTitle().equals(plugin.api.getLang("SubServers", "Interface.Host-Menu.Title"))) { // Host Menu + } else if (title.equals(plugin.api.getLang("SubServers", "Interface.Host-Menu.Title"))) { // Host Menu if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); @@ -91,9 +93,9 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.hostAdmin(obj); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Title").split("\\$str\\$")[0]) && // Host Creator + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Title").split("\\$str\\$")[0]) && // Host Creator (plugin.api.getLang("SubServers", "Interface.Host-Creator.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back"))) { @@ -170,9 +172,9 @@ public class DefaultUIHandler implements UIHandler, Listener { }); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Edit-Template.Title").split("\\$str\\$")[0]) && // Host Creator Templates + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Edit-Template.Title").split("\\$str\\$")[0]) && // Host Creator Templates (plugin.api.getLang("SubServers", "Interface.Host-Creator.Edit-Template.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Edit-Template.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.Host-Creator.Edit-Template.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) { @@ -196,9 +198,9 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.hostCreator((UIRenderer.CreatorOptions) gui.lastVisitedObjects[0]); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Host-Plugin.Title").split("\\$str\\$")[0]) && // Host Plugin + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.Host-Plugin.Title").split("\\$str\\$")[0]) && // Host Plugin (plugin.api.getLang("SubServers", "Interface.Host-Plugin.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Host-Plugin.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.Host-Plugin.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) { @@ -232,7 +234,7 @@ public class DefaultUIHandler implements UIHandler, Listener { } } - } else if (event.getClickedInventory().getTitle().equals(plugin.api.getLang("SubServers", "Interface.Group-Menu.Title"))) { // Host Menu + } else if (title.equals(plugin.api.getLang("SubServers", "Interface.Group-Menu.Title"))) { // Host Menu if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); @@ -250,13 +252,13 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.serverMenu(1, null, ChatColor.stripColor(item)); } } - } else if (event.getClickedInventory().getTitle().equals(plugin.api.getLang("SubServers", "Interface.Server-Menu.Title")) || // SubServer Menu - event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Host-SubServer.Title").split("\\$str\\$")[0]) && + } else if (title.equals(plugin.api.getLang("SubServers", "Interface.Server-Menu.Title")) || // SubServer Menu + title.startsWith(plugin.api.getLang("SubServers", "Interface.Host-SubServer.Title").split("\\$str\\$")[0]) && (plugin.api.getLang("SubServers", "Interface.Host-SubServer.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Host-SubServer.Title").split("\\$str\\$")[1])) || - event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$")[0]) && + title.endsWith(plugin.api.getLang("SubServers", "Interface.Host-SubServer.Title").split("\\$str\\$")[1])) || + title.startsWith(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$")[0]) && (plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); @@ -283,9 +285,9 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.subserverAdmin(obj); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.Host-Admin.Title").split("\\$str\\$")[0]) && // Host Admin + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.Host-Admin.Title").split("\\$str\\$")[0]) && // Host Admin (plugin.api.getLang("SubServers", "Interface.Host-Admin.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.Host-Admin.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.Host-Admin.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); @@ -305,9 +307,9 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.hostPlugin(1, (String) gui.lastVisitedObjects[0]); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Admin.Title").split("\\$str\\$")[0]) && // SubServer Admin + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Admin.Title").split("\\$str\\$")[0]) && // SubServer Admin (plugin.api.getLang("SubServers", "Interface.SubServer-Admin.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Admin.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Admin.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); @@ -388,9 +390,9 @@ public class DefaultUIHandler implements UIHandler, Listener { gui.subserverPlugin(1, (String) gui.lastVisitedObjects[0]); } } - } else if (event.getClickedInventory().getTitle().startsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Plugin.Title").split("\\$str\\$")[0]) && // SubServer Plugin + } else if (title.startsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Plugin.Title").split("\\$str\\$")[0]) && // SubServer Plugin (plugin.api.getLang("SubServers", "Interface.SubServer-Plugin.Title").split("\\$str\\$").length == 1 || - event.getClickedInventory().getTitle().endsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Plugin.Title").split("\\$str\\$")[1]))) { + title.endsWith(plugin.api.getLang("SubServers", "Interface.SubServer-Plugin.Title").split("\\$str\\$")[1]))) { if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) { String item = event.getCurrentItem().getItemMeta().getDisplayName(); if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) {