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'] loadBefore = ['BrokenPlugin']
prefix = 'TEST' prefix = 'TEST'
defaultPermission = 'OP' // 'TRUE', 'FALSE', 'OP' or 'NOT_OP' defaultPermission = 'OP' // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
provides = ['TestPluginOldName', 'TestPlug']
commands { commands {
test { test {
@ -106,6 +107,7 @@ bukkit {
loadBefore = listOf("BrokenPlugin") loadBefore = listOf("BrokenPlugin")
prefix = "TEST" prefix = "TEST"
defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP
provides = listOf("TestPluginOldName", "TestPlug")
commands { commands {
"test" { "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 (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 @JsonProperty("loadbefore") var loadBefore: List<String>? = null
var prefix: String? = null var prefix: String? = null
@JsonProperty("default-permission") var defaultPermission: Permission.Default? = null @JsonProperty("default-permission") var defaultPermission: Permission.Default? = null
var provides: List<String>? = null
// DSL provider for commands and permissions (not serialized) // DSL provider for commands and permissions (not serialized)
@Transient @JsonIgnore val commands: NamedDomainObjectContainer<Command> = project.container(Command::class.java) @Transient @JsonIgnore val commands: NamedDomainObjectContainer<Command> = project.container(Command::class.java)