Add proper 1.14 support

This commit is contained in:
ME1312 2019-04-25 23:40:02 -04:00
parent 2c41c40213
commit df029e3a7e
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
3 changed files with 23 additions and 22 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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"))) {