mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 18:26:06 +01:00
Add proper 1.14 support
This commit is contained in:
parent
7f23668623
commit
472c83f975
@ -140,7 +140,7 @@ public class ExternalSubLogger extends SubLogger {
|
|||||||
@Override
|
@Override
|
||||||
public void unregisterFilter(SubLogFilter filter) {
|
public void unregisterFilter(SubLogFilter filter) {
|
||||||
if (Util.isNull(filter)) throw new NullPointerException();
|
if (Util.isNull(filter)) throw new NullPointerException();
|
||||||
filters.remove(filter);
|
Util.isException(() -> filters.remove(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -156,7 +156,7 @@ public class InternalSubLogger extends SubLogger {
|
|||||||
@Override
|
@Override
|
||||||
public void unregisterFilter(SubLogFilter filter) {
|
public void unregisterFilter(SubLogFilter filter) {
|
||||||
if (Util.isNull(filter)) throw new NullPointerException();
|
if (Util.isNull(filter)) throw new NullPointerException();
|
||||||
filters.remove(filter);
|
Util.isException(() -> filters.remove(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroy() {
|
private void destroy() {
|
||||||
|
@ -59,12 +59,14 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
if (!event.isCancelled() && enabled && gui.keySet().contains(player.getUniqueId())) {
|
if (!event.isCancelled() && enabled && gui.keySet().contains(player.getUniqueId())) {
|
||||||
DefaultUIRenderer gui = this.gui.get(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) {
|
if (plugin.subdata == null) {
|
||||||
new IllegalStateException("SubData is not connected").printStackTrace();
|
new IllegalStateException("SubData is not connected").printStackTrace();
|
||||||
} else if (Util.isException(() -> plugin.api.getLangChannels())) {
|
} else if (Util.isException(() -> plugin.api.getLangChannels())) {
|
||||||
new IllegalStateException("There are no lang options available at this time").printStackTrace();
|
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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
|
|
||||||
@ -91,9 +93,9 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
gui.hostAdmin(obj);
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back"))) {
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) {
|
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]);
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) {
|
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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
|
|
||||||
@ -250,13 +252,13 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
gui.serverMenu(1, null, ChatColor.stripColor(item));
|
gui.serverMenu(1, null, ChatColor.stripColor(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.getClickedInventory().getTitle().equals(plugin.api.getLang("SubServers", "Interface.Server-Menu.Title")) || // SubServer Menu
|
} else if (title.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]) &&
|
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 ||
|
(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])) ||
|
title.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.startsWith(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$")[0]) &&
|
||||||
(plugin.api.getLang("SubServers", "Interface.Group-SubServer.Title").split("\\$str\\$").length == 1 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
|
|
||||||
@ -283,9 +285,9 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
gui.subserverAdmin(obj);
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
|
|
||||||
@ -305,9 +307,9 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
gui.hostPlugin(1, (String) gui.lastVisitedObjects[0]);
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
|
|
||||||
@ -388,9 +390,9 @@ public class DefaultUIHandler implements UIHandler, Listener {
|
|||||||
gui.subserverPlugin(1, (String) gui.lastVisitedObjects[0]);
|
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 ||
|
(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()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
|
||||||
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
String item = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) {
|
if (item.equals(plugin.api.getLang("SubServers", "Interface.Generic.Back-Arrow"))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user