| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Make CommandAPIConfig a ChainableBuilder
copied from CommandAPI@2d8ac6c
There was a problem hiding this comment.
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.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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 implements ChainableBuilder. Each platform should have a subclass of CommandAPIConfig, for example, CommandAPIBukkitConfig. Any information needed for configuring the platform specifically can be added to the platform implementation, such as shouldHookPaperReload.
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 and CommandAPI#onEnable method usage has changed
Previously, CommandAPI#onEnable received an Object 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 take JavaPlugin, but that class is not accessible in a platform-free context, so Object 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: