You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose some changes to the @Permission annotation, to make its use a bit more unique and helpful.
Make it usable on classes
It would be a good addition to make the annotation usable on classes.
What this would do is essentially making the set permission(s) the parent of any other that get defined for sub commands.
Add option to make permission default
I'm not sure how the framework adds/registers the permissions, but I assume they're loaded with default being set to op or false?
My second suggestion is to have an option to make the permission be set with default as true (Granted to everyone).
It could perhaps be done like the #range option for the @Completion annotation, where you prefix the permission with #default: and it would be assigned as default.
Example
Imagine the above suggestions would've been implemented already, then a command class could look like this:
@Command("mycommand")
@Permission("myplugin.mycommand")
publicclassMyCmdClassextendsCommandBase{
@Default@SubCommand("help")
@Permission("#default:myplugin.command.help")
publicvoidsendHelp(finalCommandSendersender){
// Do something here
}
@SubCommand("stuff")
@Permission("myplugin.command.stuff")
publicvoiddoStuff(finalCommandSendersender){
// Do something here
}
}
The above example would be the equivalent of the following setting of the plugin.yml
I would like to propose some changes to the
@Permission
annotation, to make its use a bit more unique and helpful.Make it usable on classes
It would be a good addition to make the annotation usable on classes.
What this would do is essentially making the set permission(s) the parent of any other that get defined for sub commands.
Add option to make permission default
I'm not sure how the framework adds/registers the permissions, but I assume they're loaded with
default
being set toop
orfalse
?My second suggestion is to have an option to make the permission be set with
default
astrue
(Granted to everyone).It could perhaps be done like the
#range
option for the@Completion
annotation, where you prefix the permission with#default:
and it would be assigned as default.Example
Imagine the above suggestions would've been implemented already, then a command class could look like this:
The above example would be the equivalent of the following setting of the plugin.yml
The text was updated successfully, but these errors were encountered: