-
-
Notifications
You must be signed in to change notification settings - Fork 74
Allow platform-specific configuration, Add hook-paper-reload config option #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Make CommandAPIConfig a ChainableBuilder
copied from CommandAPI@2d8ac6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pointed out a few minor changes to do with wording of some end-user-facing documentation and an assertion that I'd like added to check if users try to use the paper-specific configuration option on a non-paper server.
I've not done any manual testing, but just by static analysis of the current implementation, everything looks fairly clean and robust. I'm not going to let manual testing prevent this PR from merging, but it's something I'd like to do before 9.0.0's release.
The inspiration for this PR started in discord (see here).
This PR does two things:
...which is necessary for...
First,
CommandAPIConfig
is now abstract and implementsChainableBuilder
. Each platform should have a subclass ofCommandAPIConfig
, for example,CommandAPIBukkitConfig
. Any information needed for configuring the platform specifically can be added to the platform implementation, such asshouldHookPaperReload
.When a platform is loaded, it will now be passed the config object, which is packaged into an appropriate subclass of
InternalConfig
, which can be accessed later.Moving to the second point, when registering the event handler on the
ServerResourcesReloadedEvent
, the Bukkit-specific,hook-paper-reload
config option is now considered.IMPORTANT:
CommandAPI#onLoad
andCommandAPI#onEnable
method usage has changedPreviously,
CommandAPI#onEnable
received anObject
that represented the 'plugin' responsible for loading it. This was done in an attempt to be as backward-compatible as possible.CommandAPI#onEnable
used to takeJavaPlugin
, but that class is not accessible in a platform-free context, soObject
was the best bet for that to work.Now, however, the JavaPlugin variable was moved to the
CommandAPIBukkitConfig
. It was put in the constructor to make it required to create a Bukkit config object, reflecting how it is required for the CommandAPI to work.Altogether, here's how shaders need to change their code (taken from maven-shaded example)
From:
To:
Planned TODO before merge: