Skip to content

Commit

Permalink
[publish] 6.0.12 udpate ItemTag
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Sep 7, 2023
1 parent 7669965 commit eadd341
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,21 @@ class ItemTag : ItemTagData, MutableMap<String, ItemTagData> {
return this.value.put(key, value)
}

fun put(key: String, value: Any): ItemTagData? {
return this.value.put(key, toNBT(value))
fun put(key: String, value: Any?): ItemTagData? {
return if (value == null) {
remove(key)
} else {
this.value.put(key, toNBT(value))
}
}

/**
* 深度写入,以 "." 作为分层符
*/
fun putDeep(key: String, value: Any): ItemTagData? {
return if (key.contains('.')) {
fun putDeep(key: String, value: Any?): ItemTagData? {
return if (value == null) {
removeDeep(key)
} else if (key.contains('.')) {
getDeepWith(key, true) { it.put(key.substringAfterLast('.'), toNBT(value)) }
} else {
put(key, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,31 @@ class AppIO : PlatformIO {

override fun info(vararg message: Any?) {
message.filterNotNull().forEach {
if (isLog4jEnabled)
if (isLog4jEnabled) {
println(it)
else
} else {
println("[${date}][INFO] $it")
}
}
}

override fun severe(vararg message: Any?) {
message.filterNotNull().forEach {
if (isLog4jEnabled)
if (isLog4jEnabled) {
println(it)
else
} else {
println("[${date}][ERROR] $it")
}
}
}

override fun warning(vararg message: Any?) {
message.filterNotNull().forEach {
if (isLog4jEnabled)
if (isLog4jEnabled) {
println(it)
else
} else {
println("[${date}][WARN] $it")
}
}
}

Expand Down

0 comments on commit eadd341

Please sign in to comment.