Skip to content

Commit 9a2e860

Browse files
committed
[2.0.9] 支持 Folia
1 parent 151b3fb commit 9a2e860

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "io.izzel.taboolib"
11-
version = "2.0.8"
11+
version = "2.0.9"
1212

1313
configurations {
1414
create("embed") {

src/main/groovy/io/izzel/taboolib/gradle/description/Builder.groovy

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ abstract class Builder {
2424
}
2525

2626
static def writeLine(body) {
27-
body.add("")
27+
// body.add("")
2828
}
2929

30-
static def write(List<String> body, data, key) {
30+
static boolean write(List<String> body, data, key) {
3131
if (data != null) {
3232
body.add("$key: $data")
33+
return true
3334
}
35+
return false
3436
}
3537

3638
static def write(JsonObject body, data, key) {
@@ -39,18 +41,21 @@ abstract class Builder {
3941
}
4042
}
4143

42-
static def writeList(List<String> body, data, key) {
44+
static boolean writeList(List<String> body, data, key) {
4345
if (data instanceof List<String>) {
4446
if (data.size() > 0) {
4547
body.add("$key:")
4648
for (i in data) {
4749
body.add(" - '${i}'")
4850
}
51+
return true
4952
}
5053
} else if (data != null) {
5154
body.add("$key:")
5255
body.add(" - '${data}'")
56+
return true
5357
}
58+
return false
5459
}
5560

5661
static def writeList(JsonObject body, data, key) {

src/main/groovy/io/izzel/taboolib/gradle/description/BuilderBukkit.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.gradle.api.Project
55

66
class BuilderBukkit extends Builder {
77

8+
@SuppressWarnings('GroovyAssignabilityCheck')
89
@Override
910
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
1011
def body = startBukkitFile()
@@ -18,11 +19,11 @@ class BuilderBukkit extends Builder {
1819

1920
body += "version: ${project.version}"
2021
write(body, description.lin.links['homepage'], 'website')
21-
writeLine(body)
22+
2223
// authors
2324
def con = description.con.contributors.collect { it.name }
2425
writeList(body, con, 'authors')
25-
writeLine(body)
26+
2627
// dependency
2728
writeList(body, description.dep.dependencies
2829
.findAll { it.with == null || it.with.equalsIgnoreCase('bukkit') }
@@ -36,7 +37,7 @@ class BuilderBukkit extends Builder {
3637
.findAll { it.with == null || it.with.equalsIgnoreCase('bukkit') }
3738
.findAll { it.loadbefore }
3839
.collect { it.name }, 'loadbefore')
39-
writeLine(body)
40+
4041
// custom nodes
4142
description.bukkitNodes.each {
4243
if (it.value instanceof List) {
@@ -45,6 +46,9 @@ class BuilderBukkit extends Builder {
4546
write(body, it.value, it.key)
4647
}
4748
}
49+
50+
// Folia
51+
body += "folia-supported: true"
4852
return bytes(body)
4953
}
5054
}

src/main/kotlin/io/izzel/taboolib/gradle/Standards.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ const val EXPANSION_PTC_OBJECT = "expansion-persistent-container-object"
5050

5151
const val EXPANSION_JEXL = "expansion-jexl"
5252

53+
const val EXPANSION_FOLIA = "expansion-folia"
54+
5355
const val APPLICATION = "platform-application"
5456

5557
const val BUKKIT = "platform-bukkit"

0 commit comments

Comments
 (0)