Skip to content

Commit 2f8f7e0

Browse files
ZachDenWav
authored andcommitted
Add API Version flag for 1.13+ Bukkit plugins (#462)
Fixes GH-453
1 parent 2f5a0eb commit 2f8f7e0

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/main/kotlin/com/demonwav/mcdev/platform/bukkit/BukkitTemplate.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ object BukkitTemplate {
101101
properties.setProperty("HAS_WEBSITE", "true")
102102
}
103103

104+
// Plugins targeting 1.13 or newer need an explicit api declaration flag
105+
// Unfortunately this flag has no contract to match any specific API version
106+
val mcVer = settings.minecraftVersion.substring(0, 4).toDoubleOrNull()
107+
if (mcVer != null && mcVer >= 1.13) {
108+
properties.setProperty("API_VERSION", "1.13")
109+
properties.setProperty("HAS_API_VERSION", "true")
110+
}
111+
104112
BaseTemplate.applyTemplate(project, file, MinecraftFileTemplateGroupFactory.BUKKIT_PLUGIN_YML_TEMPLATE, properties, true)
105113
}
106114
}

src/main/resources/fileTemplates/j2ee/bukkit_plugin_description_file.yml.ft

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: ${NAME}
22
version: ${VERSION}
33
main: ${MAIN}
4+
#if (${HAS_API_VERSION})
5+
api-version: ${API_VERSION}
6+
#end
47
#if (${HAS_PREFIX})
58
prefix: ${PREFIX}
69
#end

0 commit comments

Comments
 (0)