feat: error handling

notlin4-patch-1
Skye 2 years ago
parent 017d5f88f0
commit dfb6935b7b
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -86,6 +86,26 @@ class E4mcRelayHandler: WebSocketClient(URI(System.getProperty("vg.skye.e4mc_min
override fun onError(ex: java.lang.Exception) {
ex.printStackTrace()
//#if FABRIC==1
val isClient = FabricLoader.getInstance().environmentType.equals(EnvType.CLIENT)
//#else
//$$ val isClient = FMLLoader.getDist().isClient
//#endif
if (isClient) {
try {
MinecraftClient.getInstance().inGameHud.chatHud.addMessage(
//#if MC>=11900
Text.translatable("text.e4mc_minecraft.error")
//#elseif FABRIC==1
//$$ TranslatableText("text.e4mc_minecraft.error")
//#else
//$$ TranslatableComponent("text.e4mc_minecraft.error")
//#endif
)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
private fun handleDomainAssigned(json: JsonObject) {

@ -2,5 +2,6 @@
"text.e4mc_minecraft.domainAssigned": "Local game hosted on domain [%s]",
"text.e4mc_minecraft.closeServer": "Local game no longer publicly hosted",
"text.e4mc_minecraft.serverAlreadyClosed": "Local game not publicly hosted",
"text.e4mc_minecraft.clickToStop": " (Click here to stop)"
"text.e4mc_minecraft.clickToStop": " (Click here to stop)",
"text.e4mc_minecraft.error": "An error occurred in e4mc"
}

@ -2,5 +2,6 @@
"text.e4mc_minecraft.domainAssigned": "로컬 게임을 도메인 [%s]에서 호스트합니다",
"text.e4mc_minecraft.closeServer": "로컬 게임이 더이상 공개되지 않습니다",
"text.e4mc_minecraft.serverAlreadyClosed": "로컬 게임이 이미 공개중이 아닙니다",
"text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)"
"text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)",
"text.e4mc_minecraft.error": "e4mc에서 오류가 발생했습니다."
}
Loading…
Cancel
Save