Early Access to Dispatcher#11145
Conversation
|
What is preventing you from simply registering such commands in the plugin bootstrap via the bootstrap context? BootstrapContext exposes a LifecycleEventManager in which you can also register commands during the initial commands class creation? |
|
Im currently using NMS for command creation, as most of my plugin follows the NMS system with ServerPlayers, ResourceLocations, etc |
|
Then reflect into the exposed Commands during the bootstrap lifecycle, it holds onto the dispatcher. Given that internals are not API and we may change anything about it when we see fit, I don't think this PR is of much use for you. There is little point in promising a plugin like yours a static method for the dispatcher, when such a method may not make sense anymore in a couple of versions (or already barely does, given we have exposed brigadier completely to the API). Thank you for the PR work, but I don't think Paper is interested in such a change due to the reasons laid out above. |
This adds a static variable to the Commands class to provide early access to the command dispatcher before bootstrapping the command system or before MinecraftServer has been loaded.
This is mainly needed for a plugin I'm working on, which needs access to the command dispatcher at plugin bootstrap to allow for mcfunctions to access the commands I add. Previously, I needed to wait for the Commands class to be created for bootstrapping, which occurs after plugin bootstrapping.