From df029e3a7e3ae79625221ea014c4f76555b27ed9 Mon Sep 17 00:00:00 2001 From: ME1312 Date: Thu, 25 Apr 2019 23:40:02 -0400 Subject: [PATCH] Add proper 1.14 support --- .../Host/External/ExternalSubLogger.java | 2 +- .../Host/Internal/InternalSubLogger.java | 2 +- .../Bukkit/Graphic/DefaultUIHandler.java | 41 ++++++++++--------- 3 files changed, 23 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 eaf44fe5..9a31b593 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 @@ -141,7 +141,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 1fb05913..7ddc01ff 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 @@ -158,7 +158,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 13e7625c..c64fb40d 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 @@ -58,12 +58,13 @@ 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(); @@ -90,9 +91,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"))) { @@ -169,9 +170,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"))) { @@ -195,9 +196,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"))) { @@ -231,7 +232,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(); @@ -249,13 +250,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(); @@ -282,9 +283,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(); @@ -304,9 +305,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(); @@ -387,9 +388,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"))) {