mirror of
https://github.com/plexusorg/plugin-yml.git
synced 2024-12-22 08:15:08 +00:00
Make Bukkit permissions support maps
This commit is contained in:
parent
ac4f48ec8b
commit
2b2627e2db
2 changed files with 12 additions and 3 deletions
|
@ -63,7 +63,9 @@ bukkit {
|
|||
|
||||
permissions {
|
||||
'testplugin.*' {
|
||||
children = ['testplugin.test']
|
||||
children = ['testplugin.test'] // Defaults permissions to true
|
||||
// You can also specify the values of the permissions
|
||||
childrenMap = ['testplugin.test': false]
|
||||
}
|
||||
'testplugin.test' {
|
||||
description = 'Allows you to run the test command'
|
||||
|
@ -118,7 +120,9 @@ bukkit {
|
|||
|
||||
permissions {
|
||||
"testplugin.*" {
|
||||
children = listOf("testplugin.test")
|
||||
children = listOf("testplugin.test") // Defaults permissions to true
|
||||
// You can also specify the values of the permissions
|
||||
childrenMap = mapOf("testplugin.test" to true)
|
||||
}
|
||||
"testplugin.test" {
|
||||
description = "Allows you to run the test command"
|
||||
|
|
|
@ -78,7 +78,12 @@ class BukkitPluginDescription(project: Project) : Serializable {
|
|||
data class Permission(@Transient @JsonIgnore val name: String) : Serializable {
|
||||
var description: String? = null
|
||||
var default: Default? = null
|
||||
var children: List<String>? = null
|
||||
var children: List<String>? // No @[Transient JsonIgnore] needed as it has no backing value
|
||||
get() = childrenMap?.filterValues { it }?.keys?.toList()
|
||||
set(value) {
|
||||
childrenMap = value?.map { it to true }?.toMap()
|
||||
}
|
||||
@JsonProperty("children") var childrenMap: Map<String, Boolean>? = null
|
||||
|
||||
enum class Default {
|
||||
@JsonProperty("true") TRUE,
|
||||
|
|
Loading…
Reference in a new issue