don't kick if plugin message transformation fails

This commit is contained in:
creeper123123321 2023-05-04 09:36:32 -03:00
parent df5f4c67c8
commit 6db0559906
2 changed files with 16 additions and 12 deletions

View File

@ -61,8 +61,8 @@ dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
val vvVer = "4.7.0-23w16a-SNAPSHOT"
val vbVer = "4.7.0-23w16a-SNAPSHOT"
val vvVer = "4.7.0-23w18a-SNAPSHOT"
val vbVer = "4.7.0-23w18a-SNAPSHOT"
val vrVer = "5f7fdc5"
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }

View File

@ -58,19 +58,23 @@ class PlayState : ConnectionState {
private fun modifyPluginMessage(handler: MinecraftHandler, pluginMessage: PluginMessage) {
if (handler.frontEnd) return
when (pluginMessage.channel) {
"MC|Brand", "brand", "minecraft:brand" -> {
if (!VIAaaSConfig.showBrandInfo) return
try {
when (pluginMessage.channel) {
"MC|Brand", "brand", "minecraft:brand" -> {
if (!VIAaaSConfig.showBrandInfo) return
val brand = "${
decodeBrand(
pluginMessage.data,
is17(handler)
)
}${" (VIAaaS C: ${handler.data.frontVer?.parseProtocol()} S: ${handler.data.backServerVer?.parseProtocol()})"}"
val brand = "${
decodeBrand(
pluginMessage.data,
is17(handler)
)
}${" (VIAaaS C: ${handler.data.frontVer?.parseProtocol()} S: ${handler.data.backServerVer?.parseProtocol()})"}"
pluginMessage.data = encodeBrand(brand, is17(handler))
pluginMessage.data = encodeBrand(brand, is17(handler))
}
}
} catch (e: Exception) {
mcLogger.debug("Couldn't modify plugin message", e)
}
}