-
Notifications
You must be signed in to change notification settings - Fork 18
Make Bukkit permission children be a map #7
Conversation
That's not entirely correct, children can be also a list: https://github.com/Bukkit/Bukkit/blob/f210234e59275330f83b994e199c76f6abd41ee7/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java#L727-L730, which I think covers the only useful case. If you really want a map for some reason, then we should at least have an overload setter which accepts a list (for some sort of backwards compatibility). |
While Groovy might be able to handle a setter such as |
Uh yeah. I forgot how/if that is possible in Kotlin... 🤔 |
I suppose making it something à la this would work? children = listOf("perm.node") // Old API delegates to the under:
childrenMap = mapOf("perm.node" to true) |
@Proximyst Hm, yes. I suppose that would be the best solution. Thanks. You would make |
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this comment doesn't seem to be correct:
Execution failed for task ':Bukkit:generateBukkitPluginDescription'.
> com.fasterxml.jackson.databind.JsonMappingException: Conflicting getter definitions for property "children": net.minecrell.pluginyml.bukkit.BukkitPluginDescription$Permission#getChildren() vs net.minecrell.pluginyml.bukkit.BukkitPluginDescription$Permission#getChildrenMap() (through reference chain: net.minecrell.pluginyml.bukkit.BukkitPluginDescription["permissions"])
@JsonIgnore
is needed on the getter to make it work.
…rell#7) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #5
This makes the Bukkit permission children be a map instead of a list.
Code which says this is the case: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java#169-172