Archiviert
13
0

Workaround for ServerConnection not being constructed yet.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-05-11 14:26:12 +02:00
Ursprung 180caed6b9
Commit d415bd7643
3 geänderte Dateien mit 16 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -36,7 +36,6 @@ import com.comphenix.protocol.error.Report;
import com.comphenix.protocol.error.ReportType;
import com.comphenix.protocol.events.ConnectionSide;
import com.comphenix.protocol.events.NetworkMarker;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.NetworkProcessor;
import com.comphenix.protocol.injector.server.SocketInjector;

Datei anzeigen

@ -96,11 +96,25 @@ public class NettyProtocolInjector implements ChannelListener {
throw new IllegalStateException("Cannot inject twice.");
try {
FuzzyReflection fuzzyServer = FuzzyReflection.fromClass(MinecraftReflection.getMinecraftServerClass());
Method serverConnectionMethod = fuzzyServer.getMethodByParameters("getServerConnection", MinecraftReflection.getServerConnectionClass(), new Class[] {});
List<Method> serverConnectionMethods = fuzzyServer.getMethodListByParameters(MinecraftReflection.getServerConnectionClass(), new Class[] {});
// Get the server connection
Object server = fuzzyServer.getSingleton();
Object serverConnection = serverConnectionMethod.invoke(server);
Object serverConnection = null;
for (Method method : serverConnectionMethods) {
try {
serverConnection = method.invoke(server);
// Continue until we get a server connection
if (serverConnection != null) {
break;
}
} catch (Exception e) {
// Try the next though
e.printStackTrace();
}
}
// Handle connected channels
final ChannelInboundHandler endInitProtocol = new ChannelInitializer<Channel>() {

Datei anzeigen

@ -1,6 +1,5 @@
package com.comphenix.protocol.wrappers;
import java.math.BigInteger;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
@ -18,8 +17,6 @@ import com.google.common.collect.Multimap;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.properties.Property;
import net.minecraft.util.io.netty.handler.codec.base64.Base64;
import net.minecraft.util.org.apache.commons.codec.binary.Base32;
/**
* Represents a wrapper for a game profile.