Skip to content

Commit

Permalink
fix: 修复GSON泛化抵抗特殊问题
Browse files Browse the repository at this point in the history
  • Loading branch information
BingZi-233 committed Oct 24, 2023
1 parent f244efe commit e0b8734
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.util.*
private val gson: Gson = Gson()

// 泛化抵抗
private val listStringType = TypeToken<List<String>>().type
private val listStringType = object : TypeToken<List<String>>() {}.type

val cookieCache = Caffeine.newBuilder()
.maximumSize(100)
Expand All @@ -26,5 +26,5 @@ val cookieCache = Caffeine.newBuilder()
.build<UUID, List<String>> {
Bukkit.getPlayer(it)?.getDataContainer()?.get("cookie")?.let { json ->
gson.fromJson(json, listStringType)
} ?: ?: infoMessageAsLang ("WarnPlayerNotOnline")
}
}

0 comments on commit e0b8734

Please sign in to comment.