Skip to content

Commit eadd341

Browse files
committed
[publish] 6.0.12 udpate ItemTag
1 parent 7669965 commit eadd341

File tree

2 files changed

+19
-10
lines changed
  • module/module-nms-util/src/main/kotlin/taboolib/module/nms
  • platform/platform-application/src/main/kotlin/taboolib/platform

2 files changed

+19
-10
lines changed

module/module-nms-util/src/main/kotlin/taboolib/module/nms/ItemTag.kt

+10-4
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,21 @@ class ItemTag : ItemTagData, MutableMap<String, ItemTagData> {
114114
return this.value.put(key, value)
115115
}
116116

117-
fun put(key: String, value: Any): ItemTagData? {
118-
return this.value.put(key, toNBT(value))
117+
fun put(key: String, value: Any?): ItemTagData? {
118+
return if (value == null) {
119+
remove(key)
120+
} else {
121+
this.value.put(key, toNBT(value))
122+
}
119123
}
120124

121125
/**
122126
* 深度写入,以 "." 作为分层符
123127
*/
124-
fun putDeep(key: String, value: Any): ItemTagData? {
125-
return if (key.contains('.')) {
128+
fun putDeep(key: String, value: Any?): ItemTagData? {
129+
return if (value == null) {
130+
removeDeep(key)
131+
} else if (key.contains('.')) {
126132
getDeepWith(key, true) { it.put(key.substringAfterLast('.'), toNBT(value)) }
127133
} else {
128134
put(key, value)

platform/platform-application/src/main/kotlin/taboolib/platform/AppIO.kt

+9-6
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,31 @@ class AppIO : PlatformIO {
4646

4747
override fun info(vararg message: Any?) {
4848
message.filterNotNull().forEach {
49-
if (isLog4jEnabled)
49+
if (isLog4jEnabled) {
5050
println(it)
51-
else
51+
} else {
5252
println("[${date}][INFO] $it")
53+
}
5354
}
5455
}
5556

5657
override fun severe(vararg message: Any?) {
5758
message.filterNotNull().forEach {
58-
if (isLog4jEnabled)
59+
if (isLog4jEnabled) {
5960
println(it)
60-
else
61+
} else {
6162
println("[${date}][ERROR] $it")
63+
}
6264
}
6365
}
6466

6567
override fun warning(vararg message: Any?) {
6668
message.filterNotNull().forEach {
67-
if (isLog4jEnabled)
69+
if (isLog4jEnabled) {
6870
println(it)
69-
else
71+
} else {
7072
println("[${date}][WARN] $it")
73+
}
7174
}
7275
}
7376

0 commit comments

Comments
 (0)