Using ClassLoader to make your game moddable

I had made reasonable progress stubbed out a proof-of-concept version of what I described, but sadly didn’t VC it and the drive the code it was on when south. (Yeah I should know better)

Nooooooo :point:

Class.forName(…) actually executes the static-blocks of the class, if not already loaded.

If you want to whitelist classes, you’d check isInWhitelist(String name), not isInWhitelist(Class clazz)

Ironic to use the 3-argument version and then not pass in false, which at least might make it vaguely safe! :slight_smile:

… yes, use String!

I use this for the server part of my multiplayer engine so I can hot-deploy to a cluster of machines asynchronously:

But if you are developing locally you can hot-reload code changes, I think something from here should work: