From bfb121938a8d7d206ae010275621ae835b87e3c5 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Sat, 14 Aug 2021 23:22:53 +0200 Subject: [PATCH 1/3] Remove the gradient if an error occurs with sender.send Otherwise, the raw gradient text is printed to the console, which is bad. --- src/main/java/com/volmit/iris/Iris.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index fbe2762b2..e8700e0a2 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -484,7 +484,7 @@ public class Iris extends VolmitPlugin implements Listener { sender.sendMessage(string); } catch (Throwable e) { try { - System.out.println(string); + System.out.println(instance.getTag() + string.replaceAll("(<([^>]+)>)", "")); } catch (Throwable ignored1) { } From 404259242098964bf6852efa7d25cf3c5d86b086 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Sat, 14 Aug 2021 23:33:31 +0200 Subject: [PATCH 2/3] So it's the same as the biome loader :D --- .../com/volmit/iris/core/project/loader/ResourceLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/core/project/loader/ResourceLoader.java b/src/main/java/com/volmit/iris/core/project/loader/ResourceLoader.java index a3ed3dbf9..aa409c74d 100644 --- a/src/main/java/com/volmit/iris/core/project/loader/ResourceLoader.java +++ b/src/main/java/com/volmit/iris/core/project/loader/ResourceLoader.java @@ -71,7 +71,7 @@ public class ResourceLoader { this.root = root; this.folderName = folderName; loadCache = new KMap<>(); - Iris.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> created in " + C.RED + "IDM/" + manager.getId() + C.LIGHT_PURPLE + " on " + C.WHITE + manager.getDataFolder().getPath()); + Iris.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> created in " + C.RED + "IDM/" + manager.getId() + C.LIGHT_PURPLE + " on " + C.GRAY + manager.getDataFolder().getPath()); } public JSONObject buildSchema() { From cf4a77af758794740602a5f554e2befeca3d3ac8 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Sat, 14 Aug 2021 23:42:51 +0200 Subject: [PATCH 3/3] This doesnt get used yeet --- .../volmit/iris/util/plugin/VolmitPlugin.java | 93 ------------------- 1 file changed, 93 deletions(-) diff --git a/src/main/java/com/volmit/iris/util/plugin/VolmitPlugin.java b/src/main/java/com/volmit/iris/util/plugin/VolmitPlugin.java index 3a607a0bb..386a0a9d1 100644 --- a/src/main/java/com/volmit/iris/util/plugin/VolmitPlugin.java +++ b/src/main/java/com/volmit/iris/util/plugin/VolmitPlugin.java @@ -59,99 +59,6 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener { private KList cachedControllers; private KMap, IController> cachedClassControllers; - public void selfDistruct() { - HandlerList.unregisterAll((Plugin) this); - getServer().getScheduler().cancelTasks(this); - File me = getFile(); - Plugin plugin = this; - String name = plugin.getName(); - SimpleCommandMap commandMap = null; - List plugins = null; - Map names = null; - Map commands = null; - Map> listeners = null; - - try { - - Field pluginsField = Bukkit.getPluginManager().getClass().getDeclaredField("plugins"); - pluginsField.setAccessible(true); - //noinspection unchecked - plugins = (List) pluginsField.get(getServer().getPluginManager()); - Field lookupNamesField = Bukkit.getPluginManager().getClass().getDeclaredField("lookupNames"); - lookupNamesField.setAccessible(true); - //noinspection unchecked - names = (Map) lookupNamesField.get(getServer().getPluginManager()); - - try { - Field listenersField = Bukkit.getPluginManager().getClass().getDeclaredField("listeners"); - listenersField.setAccessible(true); - //noinspection unchecked - listeners = (Map>) listenersField.get(getServer().getPluginManager()); - } catch (Throwable e) { - Iris.reportError(e); - - } - - Field commandMapField = Bukkit.getPluginManager().getClass().getDeclaredField("commandMap"); - commandMapField.setAccessible(true); - commandMap = (SimpleCommandMap) commandMapField.get(getServer().getPluginManager()); - Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands"); - knownCommandsField.setAccessible(true); - //noinspection unchecked - commands = (Map) knownCommandsField.get(commandMap); - - } catch (Throwable e) { - Iris.reportError(e); - - } - - getServer().getPluginManager().disablePlugin(plugin); - plugins.remove(plugin); - names.remove(name); - - if (listeners != null) { - for (SortedSet set : listeners.values()) { - set.removeIf(value -> value.getPlugin().equals(plugin)); - } - } - - for (Iterator> it = commands.entrySet().iterator(); it.hasNext(); ) { - Map.Entry entry = it.next(); - if (entry.getValue() instanceof PluginCommand c) { - if (c.getPlugin() == plugin) { - c.unregister(commandMap); - it.remove(); - } - } - } - - new Thread(() -> { - // Attempt to close the classloader to unlock any handles on the - // plugin's - // jar file. - ClassLoader cl = plugin.getClass().getClassLoader(); - - if (cl instanceof URLClassLoader) { - try { - ((URLClassLoader) cl).close(); - } catch (IOException e) { - Iris.reportError(e); - - } - } - - // Will not work on processes started with the -XX:+DisableExplicitGC - // flag, - // but lets try it anyway. This tries to get around the issue where - // Windows - // refuses to unlock jar files that were previously loaded into the JVM. - System.gc(); - if (!me.delete()) { - me.deleteOnExit(); - } - }).start(); - } - public File getJarFile() { return getFile(); }