feat: add auto script to deploy bot on mcsm
This commit is contained in:
6 files changed
+272
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user