-
-
Notifications
You must be signed in to change notification settings - Fork 57
Feature: Repatable Permissions #451
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
If i have a command thats needs multiple permissions for the same commands.
The the developer needs to add this checks inside of his command methods.
For example like this:
@CommandMethod("/schematic save <filename> [format]")
@CommandPermission("worldedit.schematic.save")
fun saveSchematic(
player: Player,
@Argument("filename") filename: String,
@Argument("format", defaultValue = "fast") format: String,
@Flag("f") override: Boolean,
@Flag("f") global: Boolean
) {
if(player.hasPermission("Permisson.A") || player.hasPermission("Permisson.B")) {
// Code here
}
}Now java allows to repeate annotations. As a result we get a cleaner code.
Docs/Ref: https://rolyhewage.medium.com/type-annotations-repeating-annotations-in-java-722073df9f99
Example code:
@CommandMethod("/schematic save <filename> [format]")
@CommandPermission("worldedit.schematic.save")
@CommandPermission("Permisson.A")
@CommandPermission("Permisson.B")
fun saveSchematic(
player: Player,
@Argument("filename") filename: String,
@Argument("format", defaultValue = "fast") format: String,
@Flag("f") override: Boolean,
@Flag("f") global: Boolean
) {
save(player, filename, format, override, global)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request