feat: add auto script to deploy bot on mcsm

This commit is contained in:
2024-09-14 23:10:34 +08:00
parent 97ca10ae3e
commit 48c82a5c24
6 files changed
+272

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright © 2024 RTAkland
* Author: RTAkland
* Date: 2024/9/14
*/
package buildsrc
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
val gson: Gson = GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.create()
fun Any.toJson(): String {
return gson.toJson(this)
}
inline fun <reified T> String.fromJson(): T {
return gson.fromJson(this, T::class.java)
}
inline fun <reified T> String.fromArrayJson(): T {
return gson.fromJson(this, object : TypeToken<T>() {}.type)
}