Plugin reloading/enabling

The problem with reloading plugins/mods/extensions/etc. in most languages, Java included, is that ultimately a plugin will leave references to itself in the main application or in other plugins.

In Java, for example, plugin A might use B and get a class Apple from B. Upon reloading B, A still has a copy of Apple from B but it is the old version of the class from before the reload. Java does not see the two classes to be the same and you will encounter problems.

It also risks classloader leaks, where these references stick around for a long time and compound after every restart, so you end up with a memory leak.

If you are developing, I recommend running the server from within your IDE. If you are only making minor changes (not removing or adding methods), you can just “reload changed classes” and inject your changes into the running server without restarting or reloading anything. No (manual) compilation needed. Immediate effect.

4 Likes