diff --git a/README.md b/README.md index 69db0e8..ad2257e 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt index 7142e9e..2aab159 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt @@ -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? = null + var children: List? // 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? = null enum class Default { @JsonProperty("true") TRUE,