Java Community | Help. Code. Learn.JC|HCL
Java Community | Help. Code. Learn.โ€ข3y agoโ€ข
5 replies
eren.

Feedback on my Registration System

I am making an addon for a scripting language that adds new syntaxes (Skript)
In Skript, each syntax gets its own class and you must call the Skript.registerWhateverSyntax method on server load to use it.
You can bulk register syntaxes using
Skript.loadClasses(package, subpackage)
(assuming you register the syntax on the static block)
but this comes with a problem, you can't create a config file where you can edit what syntaxes are going to be registered, so you need to make your own registration system. I came up with this and I want feedback on it. Perhaps a way without reflection or something cleaner than this?

On server start: https://github.com/erenkarakal/SkCheese/blob/master/src/main/java/me/eren/skcheese/SkCheese.java#L14
Register syntax: https://github.com/erenkarakal/SkCheese/blob/master/src/main/java/me/eren/skcheese/elements/ExprParsedAs.java#L22
Was this page helpful?