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

@Private annotation does not apply to root commands, only subcommands #380

Open
Astralchroma opened this issue Dec 11, 2022 · 3 comments
Open

Comments

@Astralchroma
Copy link

No description provided.

@DevJoey
Copy link

DevJoey commented Jan 26, 2023

Same nasty issue!

In the wiki
Useful for commands that are triggered indirectly, for example by clicking on a chat component in the chat or in a book.

Yea i have exactly a command that is only triggered via a book and should not be visible at all!

@Astralchroma
Copy link
Author

Astralchroma commented Feb 3, 2023

@DevJoey A work around we use is to have a listener which removes the command from the list during PlayerCommandSendEvent, this isn't exactly ideal behavior but it works:

@EventHandler
@Suppress("Unused")
fun onPlayerCommandSendEvent(event: PlayerCommandSendEvent) {
    event.commands.removeIf { it == "commandname" }
}

Note: This is Kotlin, not Java, but you get the idea.

@DevJoey
Copy link

DevJoey commented Feb 3, 2023

@DevJoey A work around we use is to have a listener which removes the command from the list during PlayerCommandSendEvent, this isn't exactly ideal behavior but it works:

@EventHandler
@Suppress("Unused")
fun onPlayerCommandSendEvent(event: PlayerCommandSendEvent) {
    event.commands.removeIf { it == "commandname" }
}

Note: This is Kotlin, not Java, but you get the idea.

Ye thank you... I have already implemented a method in my chat system that does exactly this! But is as you say not ideal and it would be nice if this gets fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants