From fbdd8ffc35793fe7b1b9f0a7ced769b0fb866124 Mon Sep 17 00:00:00 2001 From: games647 Date: Wed, 7 Jun 2017 21:09:00 +0200 Subject: [PATCH] Choose player name casing based on client request. Since BungeeCord commit 5bc189fbb7e8ca19984544af78a083024404fb2a the name casing is based on the exact name saved at Mojang. This means it could have breaking effects on FastLogin, because it performs case-sensitive checks against the database. To provide backwards compatibility with old data we restore the old implementation access for FastLogin. Thanks to @Maxetto for pointing this out. This commit basically reverts: 059c3f346e98714a9f61ee9c2516ec7dc0a1809a --- .../fastlogin/bungee/listener/PlayerConnectionListener.java | 5 +++-- .../games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java index c694072f..392fabaf 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PlayerConnectionListener.java @@ -61,7 +61,9 @@ public class PlayerConnectionListener implements Listener { //use the loginevent instead of the postlogin event in order to send the loginsuccess packet to the client //with the offline uuid this makes it possible to set the skin then PendingConnection connection = loginEvent.getConnection(); - String username = connection.getName().toLowerCase(); + InitialHandler initialHandler = (InitialHandler) connection; + + String username = initialHandler.getLoginRequest().getData(); if (connection.isOnlineMode()) { LoginSession session = plugin.getSession().get(connection); session.setUuid(connection.getUniqueId()); @@ -70,7 +72,6 @@ public class PlayerConnectionListener implements Listener { playerProfile.setUuid(connection.getUniqueId()); //bungeecord will do this automatically so override it on disabled option - InitialHandler initialHandler = (InitialHandler) connection; if (!plugin.getCore().getConfig().get("premiumUuid", true)) { try { UUID offlineUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(Charsets.UTF_8)); diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java index 7a15b539..af514b06 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java @@ -10,6 +10,7 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.AsyncEvent; +import net.md_5.bungee.connection.InitialHandler; public class AsyncPremiumCheck extends JoinManagement implements Runnable { @@ -31,7 +32,8 @@ public class AsyncPremiumCheck extends JoinManagement