Skip to content
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

Disallow calling JavaPlugin#getCommand during onEnable for Paper plugins #11914

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NoahvdAa
Copy link
Member

@NoahvdAa NoahvdAa commented Jan 5, 2025

Every other day someone in #paper-dev tries to declare commands in paper-plugin.yml and use JavaPlugin#getCommand, which is not supported, but simply returns null instead of a clear error message.
This commit hopes to clarify that calling getCommand on self is not supported for paper plugins.

Note: check only applies during onEnable because we do not want to break the ability for other plugins to check if a plugin defines a command by calling JavaPlugin#getCommand on it

Every other day someone in #paper-dev tries to declare commands in paper-plugin.yml, which is not supported, but simply returns null instead of a clear error message.

This commit hopes to clarify that calling getCommand on self is not supported for paper plugins.

Note: check only applies during onEnable because we do not want to break the ability for other plugins to check if a plugin defines a command by calling JavaPlugin#getCommand on it
@NoahvdAa NoahvdAa requested a review from a team as a code owner January 5, 2025 13:50
@Leguan16
Copy link
Contributor

Leguan16 commented Jan 5, 2025

related to #10588

@NoahvdAa NoahvdAa requested a review from Machine-Maker January 5, 2025 19:25
Comment on lines +345 to +346
You are trying to call JavaPlugin#getCommand on a Paper plugin during startup:
you are probably trying to get a command you tried to define in paper-plugin.yml.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these first lines really needed? I feel like the last two are enough or am I wrong?

@lynxplay lynxplay added the type: feature Request for a new Feature. label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Request for a new Feature.
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

4 participants