Greatly improve Brigardier support

This commit is contained in:
Jakob K
2021-09-06 17:40:55 +02:00
parent 8d460c514f
commit 91d025d9fb
13 changed files with 439 additions and 131 deletions

View File

@@ -0,0 +1,25 @@
package net.axay.kspigot.commands
import com.mojang.brigadier.builder.ArgumentBuilder
import net.axay.kspigot.commands.internal.ServerCommandSource
import org.bukkit.permissions.Permission
/**
* Defines that the given [permission] is required to interact with this
* path of the command.
*/
fun ArgumentBuilder<ServerCommandSource, *>.requiresPermission(permission: String) {
requires {
it.bukkitSender.hasPermission(permission)
}
}
/**
* Defines that the given [permission] is required to interact with this
* path of the command.
*/
fun ArgumentBuilder<ServerCommandSource, *>.requiresPermission(permission: Permission) {
requires {
it.bukkitSender.hasPermission(permission)
}
}