Replace some debug info with the actual cause

This commit is contained in:
Dan Mulloy 2016-07-05 22:54:25 -04:00
parent e34105e754
commit 015a6067fd

View File

@ -582,35 +582,26 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
* @param packet - the packet. * @param packet - the packet.
*/ */
protected void handleLogin(Class<?> packetClass, Object packet) { protected void handleLogin(Class<?> packetClass, Object packet) {
try { // Try to find the login packet class
Class<?> loginClass = PACKET_LOGIN_CLIENT; if (PACKET_LOGIN_CLIENT == null) {
FieldAccessor loginClient = LOGIN_GAME_PROFILE; PACKET_LOGIN_CLIENT = PacketType.Login.Client.START.getPacketClass();
}
// Initialize packet class and login // If we can't, there's an issue
if (loginClass == null) { if (PACKET_LOGIN_CLIENT == null) {
loginClass = PacketType.Login.Client.START.getPacketClass(); throw new IllegalStateException("Failed to obtain login start packet. Did you build Spigot with BuildTools?");
PACKET_LOGIN_CLIENT = loginClass; }
}
if (loginClient == null) {
loginClient = Accessors.getFieldAccessor(PACKET_LOGIN_CLIENT, MinecraftReflection.getGameProfileClass(), true);
LOGIN_GAME_PROFILE = loginClient;
}
// See if we are dealing with the login packet if (LOGIN_GAME_PROFILE == null) {
if (loginClass.equals(packetClass)) { LOGIN_GAME_PROFILE = Accessors.getFieldAccessor(PACKET_LOGIN_CLIENT, MinecraftReflection.getGameProfileClass(), true);
// GameProfile profile = (GameProfile) loginClient.get(packet); }
WrappedGameProfile profile = WrappedGameProfile.fromHandle(loginClient.get(packet));
// Save the channel injector // See if we are dealing with the login packet
factory.cacheInjector(profile.getName(), this); if (PACKET_LOGIN_CLIENT.equals(packetClass)) {
} WrappedGameProfile profile = WrappedGameProfile.fromHandle(LOGIN_GAME_PROFILE.get(packet));
} catch (IllegalArgumentException ex) { // Thrown by FuzzyReflection#getFields()
System.err.println(String.format("[ProtocolLib] Encountered NPE in handleLogin(%s, %s)", packetClass, packet)); // Save the channel injector
System.err.println("PACKET_LOGIN_CLIENT = " + PACKET_LOGIN_CLIENT); factory.cacheInjector(profile.getName(), this);
System.err.println("LOGIN_GAME_PROFILE = " + LOGIN_GAME_PROFILE);
System.err.println("GameProfile class = " + MinecraftReflection.getGameProfileClass());
System.err.println("Provide this information in a new or existing issue");
throw ex;
} }
} }