From 96323e8117deedd69b6be405bf7b403a9e761d10 Mon Sep 17 00:00:00 2001 From: XThe <101992755+SirXThe@users.noreply.github.com> Date: Tue, 9 May 2023 23:09:16 +0200 Subject: [PATCH] hotfix: resolve offline Sk1er API crashing the game (#77) --- .../handlers/language/LanguageHandler.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/cc/woverflow/hytils/handlers/language/LanguageHandler.java b/src/main/java/cc/woverflow/hytils/handlers/language/LanguageHandler.java index 9fe47b1..e706675 100644 --- a/src/main/java/cc/woverflow/hytils/handlers/language/LanguageHandler.java +++ b/src/main/java/cc/woverflow/hytils/handlers/language/LanguageHandler.java @@ -40,10 +40,6 @@ public class LanguageHandler { private final Gson gson = new GsonBuilder().create(); private final LanguageData fallback = new LanguageData(); - private final Map languageMappings = new HashMap() {{ - put("ENGLISH", "en"); - put("FRENCH", "fr"); - }}; private JsonObject regex = null; @@ -55,19 +51,9 @@ public LanguageHandler() { private void initialize() { fallback.initialize(); - final String username = Minecraft.getMinecraft().getSession().getUsername(); - final JsonObject json = NetworkUtils.getJsonElement("https://api.sk1er.club/player/" + username).getAsJsonObject(); - final JsonObject player = json.getAsJsonObject("player"); - String userLanguage; - if (player.has("userLanguage")) { - userLanguage = player.get("userLanguage").getAsString(); - } else { - userLanguage = "ENGLISH"; - } - final String language = languageMappings.getOrDefault(userLanguage, "en"); regex = NetworkUtils.getJsonElement("https://data.woverflow.cc/regex.json").getAsJsonObject(); if (!regex.entrySet().isEmpty()) { - current = gson.fromJson(regex.has(language) ? regex.getAsJsonObject(language).toString() : regex.getAsJsonObject("en").toString(), LanguageData.class); + current = gson.fromJson(regex.getAsJsonObject("en").toString(), LanguageData.class); } current.initialize(); }