Use the loginevent to send the client the offline uuid

-> skin applies on deactivated premium uuid
This commit is contained in:
games647
2016-07-03 16:58:23 +02:00
parent 167ce66057
commit 2b16f3341f
3 changed files with 8 additions and 6 deletions

View File

@ -3,6 +3,7 @@
* Added support for making requests to Mojang from different IPv4 addresses * Added support for making requests to Mojang from different IPv4 addresses
* Added us.mcapi.com as third-party APIs to workaround rate-limits * Added us.mcapi.com as third-party APIs to workaround rate-limits
* Fixed NPE in BungeeCord on cracked session * Fixed NPE in BungeeCord on cracked session
* Fixed skin applies if premium uuid is deactivated
######1.6.2 ######1.6.2

View File

@ -14,8 +14,8 @@ import java.util.logging.Level;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.PreLoginEvent; import net.md_5.bungee.api.event.PreLoginEvent;
import net.md_5.bungee.api.event.ServerConnectedEvent; import net.md_5.bungee.api.event.ServerConnectedEvent;
import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Listener;
@ -48,14 +48,16 @@ public class PlayerConnectionListener implements Listener {
} }
@EventHandler @EventHandler
public void onLogin(PostLoginEvent loginEvent) { public void onLogin(LoginEvent loginEvent) {
ProxiedPlayer player = loginEvent.getPlayer(); //use the loginevent instead of the postlogin event in order to send the loginsuccess packet to the client
PendingConnection connection = player.getPendingConnection(); //with the offline uuid this makes it possible to set the skin then
PendingConnection connection = loginEvent.getConnection();
String username = connection.getName(); String username = connection.getName();
if (connection.isOnlineMode()) { if (connection.isOnlineMode()) {
LoginSession session = plugin.getSession().get(connection); LoginSession session = plugin.getSession().get(connection);
PlayerProfile playerProfile = session.getProfile(); PlayerProfile playerProfile = session.getProfile();
playerProfile.setUuid(player.getUniqueId()); playerProfile.setUuid(connection.getUniqueId());
//bungeecord will do this automatically so override it on disabled option //bungeecord will do this automatically so override it on disabled option
InitialHandler initialHandler = (InitialHandler) connection; InitialHandler initialHandler = (InitialHandler) connection;

View File

@ -91,7 +91,6 @@ nameChangeCheck: false
# * is the owner of the premium account # * is the owner of the premium account
# * the serverconnection is established through a premium connection (paid account authentification) # * the serverconnection is established through a premium connection (paid account authentification)
# * has a skin # * has a skin
# * and you activated premium uuids
# #
# This means this plugin doesn't need to create a new connection to the Mojang servers, because # This means this plugin doesn't need to create a new connection to the Mojang servers, because
# the skin data is included in the Auth-Verification-Response sent by Mojang. If you want to use for other # the skin data is included in the Auth-Verification-Response sent by Mojang. If you want to use for other