Skip to content

Early Access to Dispatcher#11145

Closed
Dueris wants to merge 1 commit into
PaperMC:masterfrom
Dueris:feat/early-dispatcher-access
Closed

Early Access to Dispatcher#11145
Dueris wants to merge 1 commit into
PaperMC:masterfrom
Dueris:feat/early-dispatcher-access

Conversation

@Dueris
Copy link
Copy Markdown
Contributor

@Dueris Dueris commented Jul 22, 2024

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.

@Dueris Dueris requested a review from a team as a code owner July 22, 2024 08:03
@lynxplay
Copy link
Copy Markdown
Contributor

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?

@Dueris
Copy link
Copy Markdown
Contributor Author

Dueris commented Jul 22, 2024

Im currently using NMS for command creation, as most of my plugin follows the NMS system with ServerPlayers, ResourceLocations, etc

@kennytv kennytv closed this Jul 22, 2024
@lynxplay
Copy link
Copy Markdown
Contributor

lynxplay commented Jul 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants