No Images in /plugins if exception occurs
The main plugin class performs several operations when the class is statically initialized instead of using onEnable(). When performing these operations, errors can occur. For this reason, Spigot is unable to initialize the main class of a plugin, which leads to the absence of Images in the plugins list (/plugins). This negatively affects the user experience, because the server administrator may not observe for a long time that there are problems with the plugin.
If you use onEnable() instead of static initialization, the plugin will be displayed in /plugins, and if any error occurs during loading, it will just be colored red.
As far as I can see, exceptions can only occur on this line:
private static final PacketListener BRIDGE = Versioned.getInstance(PacketListener.class);
So, if we move the method call to onEnable(), this issue will be solved.
An example of an exception that may occur when calling this method:
Could not load 'plugins\images-2.2.7.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:159) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:419) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:327) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.loadPlugins(CraftServer.java:481) ~[purpur-1.19.3.jar:git-Purpur-1860]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:307) ~[purpur-1.19.3.jar:git-Purpur-1860]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1115) ~[purpur-1.19.3.jar:git-Purpur-1860]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[purpur-1.19.3.jar:git-Purpur-1860]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:467) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:71) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
... 7 more
Caused by: java.lang.UnsupportedOperationException: Class class com.andavin.images.PacketListener is not currently supported for version v1_19_R2
at com.andavin.images.Versioned.getInstance(Versioned.java:60) ~[images-2.2.7.jar:?]
at com.andavin.images.Images.<clinit>(Images.java:97) ~[images-2.2.7.jar:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:467) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:71) ~purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
... 7 more
we also hope for the update
plugin was updated allready for 1.19.x
https://github.com/resi23/Images/releases/tag/v2.3.3
plugin was updated allready for 1.19.x
https://github.com/resi23/Images/releases/tag/v2.3.3
It's NOT an issue about updating plugin to 1.19 or some else version. But OK
use the right Version for
plugin was updated allready for 1.19.x https://github.com/resi23/Images/releases/tag/v2.3.3
It's NOT an issue about updating plugin to 1.19 or some else version. But OK
use the right Version for 1.19 you need to look in the patchlogs what version was made for the right server version your using