forked from TuxCoding/FastLogin
Use username from Mojang for offline IDs
Affected systems: BungeeCord after name change Effects: Carry on items, permissions, etc. from the old user account without access to the new one After a name change it could happen that the client still only knows the old username and will send it to the server. Mojang will provide us with an up-to-date username that we should use instead. The username is also sent to Mojang, so that they could verify the use. Therefore exploiting this behavior extensively for arbitrary usernames is not possible. Related #344
This commit is contained in:
+8
-7
@@ -101,25 +101,26 @@ public class ConnectListener implements Listener {
|
||||
final PendingConnection connection = loginEvent.getConnection();
|
||||
final InitialHandler initialHandler = (InitialHandler) connection;
|
||||
|
||||
final String username = initialHandler.getLoginRequest().getData();
|
||||
if (connection.isOnlineMode()) {
|
||||
LoginSession session = plugin.getSession().get(connection);
|
||||
session.setUuid(connection.getUniqueId());
|
||||
LoginResult loginProfile = initialHandler.getLoginProfile();
|
||||
|
||||
UUID verifiedUUID = connection.getUniqueId();
|
||||
session.setUuid(verifiedUUID);
|
||||
session.setVerifiedUsername(loginProfile.getName());
|
||||
|
||||
StoredProfile playerProfile = session.getProfile();
|
||||
playerProfile.setId(connection.getUniqueId());
|
||||
playerProfile.setId(verifiedUUID);
|
||||
|
||||
//bungeecord will do this automatically so override it on disabled option
|
||||
if (!plugin.getCore().getConfig().get("premiumUuid", true)) {
|
||||
String username = loginProfile.getName();
|
||||
setOfflineId(initialHandler, username);
|
||||
}
|
||||
|
||||
if (!plugin.getCore().getConfig().get("forwardSkin", true)) {
|
||||
// this is null on offline mode
|
||||
LoginResult loginProfile = initialHandler.getLoginProfile();
|
||||
if (loginProfile != null) {
|
||||
loginProfile.setProperties(emptyProperties);
|
||||
}
|
||||
loginProfile.setProperties(emptyProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user