Add Bukkit's new `provides` field. (#8)

Commit adding this field: 9f2fd967a4 (src)/main/java/org/bukkit/plugin/PluginDescriptionFile.java
This commit is contained in:
Mariell Hoversholm 2021-04-30 10:15:16 +02:00 committed by GitHub
parent 2b2627e2db
commit 36ec001e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -49,6 +49,7 @@ bukkit {
loadBefore = ['BrokenPlugin']
prefix = 'TEST'
defaultPermission = 'OP' // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
provides = ['TestPluginOldName', 'TestPlug']
commands {
test {
@ -106,6 +107,7 @@ bukkit {
loadBefore = listOf("BrokenPlugin")
prefix = "TEST"
defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP
provides = listOf("TestPluginOldName", "TestPlug")
commands {
"test" {

View File

@ -60,6 +60,10 @@ class BukkitPlugin : PlatformPlugin<BukkitPluginDescription>("Bukkit", "plugin.y
if (alias.contains(':')) throw InvalidPluginDescriptionException("Alias '$alias' of '${command.name}' cannot contain ':'")
}
}
if (description.provides?.all(VALID_NAME::matches) == false) {
throw InvalidPluginDescriptionException("Invalid plugin provides name: all should match $VALID_NAME")
}
}
}

View File

@ -47,6 +47,7 @@ class BukkitPluginDescription(project: Project) : Serializable {
@JsonProperty("loadbefore") var loadBefore: List<String>? = null
var prefix: String? = null
@JsonProperty("default-permission") var defaultPermission: Permission.Default? = null
var provides: List<String>? = null
// DSL provider for commands and permissions (not serialized)
@Transient @JsonIgnore val commands: NamedDomainObjectContainer<Command> = project.container(Command::class.java)