From eb7760236f9076a205c36d3622838e87068ddde8 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Fri, 21 Feb 2014 19:14:58 +0100 Subject: [PATCH] Don't update the player instances on the LOGIN packet. Instead, always check for the presence of NetServerHandler, and update then. --- .../protocol/injector/player/PlayerInjector.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/PlayerInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/PlayerInjector.java index 3554558e..05acf17d 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/PlayerInjector.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/PlayerInjector.java @@ -588,9 +588,14 @@ public abstract class PlayerInjector implements SocketInjector { // Hack #1 if (updateOnLogin) { - if (id == Packets.Server.LOGIN) { + if (updatedPlayer == null) { try { - updatedPlayer = (Player) MinecraftReflection.getBukkitEntity(getEntityPlayer(getNetHandler())); + final Object handler = getNetHandler(); + + // Is this a net server class? + if (MinecraftReflection.getNetServerHandlerClass().isAssignableFrom(handler.getClass())) { + updatedPlayer = (Player) MinecraftReflection.getBukkitEntity(getEntityPlayer(handler)); + } } catch (IllegalAccessException e) { reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLAYER).error(e).callerParam(packet)); }