From 9500da2ef0901a7288b63e229d8bafd716ff389d Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 12 Dec 2020 01:39:09 +0100 Subject: [PATCH] Small changes --- .../connector/network/session/cache/FormCache.java | 2 +- .../connector/utils/LoginEncryptionUtils.java | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java index 26589a82e..cdd8a01ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java @@ -77,7 +77,7 @@ public class FormCache { Consumer responseConsumer = form.getResponseHandler(); if (responseConsumer != null) { - responseConsumer.accept(response.getFormData().trim()); + responseConsumer.accept(response.getFormData()); } removeWindow(response.getFormId()); diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index af41a70ec..39e9e1738 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -154,17 +154,15 @@ public class LoginEncryptionUtils { } public static void buildAndShowLoginWindow(GeyserSession session) { - String userLanguage = session.getClientData().getLanguageCode(); - session.sendForm( SimpleForm.builder() - .translator(LanguageUtils::getPlayerLocaleString, userLanguage) + .translator(LanguageUtils::getPlayerLocaleString, session.getLocale()) .title("geyser.auth.login.form.notice.title") .content("geyser.auth.login.form.notice.desc") .button("geyser.auth.login.form.notice.btn_login") // id = 0 .button("geyser.auth.login.form.notice.btn_disconnect") .responseHandler((form, responseData) -> { - SimpleFormResponse response = form.parseResponse(responseData.trim()); + SimpleFormResponse response = form.parseResponse(responseData); if (!response.isCorrect()) { buildAndShowLoginWindow(session); return; @@ -180,16 +178,15 @@ public class LoginEncryptionUtils { } public static void buildAndShowLoginDetailsWindow(GeyserSession session) { - String userLanguage = session.getLocale(); session.sendForm( CustomForm.builder() - .translator(LanguageUtils::getPlayerLocaleString, userLanguage) + .translator(LanguageUtils::getPlayerLocaleString, session.getLocale()) .title("geyser.auth.login.form.details.title") .label("geyser.auth.login.form.details.desc") .input("geyser.auth.login.form.details.email", "account@geysermc.org", "") .input("geyser.auth.login.form.details.pass", "123456", "") .responseHandler((form, responseData) -> { - CustomFormResponse response = form.parseResponse(responseData.trim()); + CustomFormResponse response = form.parseResponse(responseData); if (!response.isCorrect()) { buildAndShowLoginDetailsWindow(session); return;