Add some debug info for #208
Dieser Commit ist enthalten in:
Ursprung
1c36c41050
Commit
4330bae47f
@ -33,6 +33,10 @@ import com.google.common.collect.Maps;
|
|||||||
|
|
||||||
public class NettyProtocolRegistry extends ProtocolRegistry {
|
public class NettyProtocolRegistry extends ProtocolRegistry {
|
||||||
|
|
||||||
|
public NettyProtocolRegistry() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized void initialize() {
|
protected synchronized void initialize() {
|
||||||
Object[] protocols = enumProtocol.getEnumConstants();
|
Object[] protocols = enumProtocol.getEnumConstants();
|
||||||
@ -59,7 +63,7 @@ public class NettyProtocolRegistry extends ProtocolRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maps we have to occationally check have changed
|
// Maps we have to occasionally check have changed
|
||||||
for (Map<Integer, Class<?>> map : serverMaps.values()) {
|
for (Map<Integer, Class<?>> map : serverMaps.values()) {
|
||||||
result.containers.add(new MapContainer(map));
|
result.containers.add(new MapContainer(map));
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
import com.comphenix.protocol.reflect.accessors.Accessors;
|
import com.comphenix.protocol.reflect.accessors.Accessors;
|
||||||
import com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher;
|
import com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher;
|
||||||
import com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract;
|
import com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract;
|
||||||
@ -577,6 +579,8 @@ public class FuzzyReflection {
|
|||||||
* @return Every field.
|
* @return Every field.
|
||||||
*/
|
*/
|
||||||
public Set<Field> getFields() {
|
public Set<Field> getFields() {
|
||||||
|
Validate.notNull(source, "source cannot be null!");
|
||||||
|
|
||||||
// We will only consider private fields in the declared class
|
// We will only consider private fields in the declared class
|
||||||
if (forceAccess)
|
if (forceAccess)
|
||||||
return setUnion(source.getDeclaredFields(), source.getFields());
|
return setUnion(source.getDeclaredFields(), source.getFields());
|
||||||
|
@ -582,6 +582,7 @@ 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 {
|
||||||
Class<?> loginClass = PACKET_LOGIN_CLIENT;
|
Class<?> loginClass = PACKET_LOGIN_CLIENT;
|
||||||
FieldAccessor loginClient = LOGIN_GAME_PROFILE;
|
FieldAccessor loginClient = LOGIN_GAME_PROFILE;
|
||||||
|
|
||||||
@ -603,6 +604,14 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
// Save the channel injector
|
// Save the channel injector
|
||||||
factory.cacheInjector(profile.getName(), this);
|
factory.cacheInjector(profile.getName(), this);
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException ex) {
|
||||||
|
System.err.println(String.format("[ProtocolLib] Encountered NPE in handleLogin(%s, %s)", packetClass, packet));
|
||||||
|
System.err.println("PACKET_LOGIN_CLIENT = " + PACKET_LOGIN_CLIENT);
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,6 +14,8 @@ import com.comphenix.protocol.PacketType.Sender;
|
|||||||
import com.comphenix.protocol.injector.netty.NettyProtocolRegistry;
|
import com.comphenix.protocol.injector.netty.NettyProtocolRegistry;
|
||||||
import com.comphenix.protocol.injector.netty.ProtocolRegistry;
|
import com.comphenix.protocol.injector.netty.ProtocolRegistry;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_9_R2.PacketLoginInStart;
|
||||||
|
|
||||||
public class PacketTypeTest {
|
public class PacketTypeTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@ -26,6 +28,12 @@ public class PacketTypeTest {
|
|||||||
assertEquals(PacketType.Play.Client.STEER_VEHICLE, PacketType.findCurrent(Protocol.PLAY, Sender.CLIENT, "SteerVehicle"));
|
assertEquals(PacketType.Play.Client.STEER_VEHICLE, PacketType.findCurrent(Protocol.PLAY, Sender.CLIENT, "SteerVehicle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLoginStart() {
|
||||||
|
// This packet is critical for handleLoin
|
||||||
|
assertEquals(PacketLoginInStart.class, PacketType.Login.Client.START.getPacketClass());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensureAllExist() {
|
public void ensureAllExist() {
|
||||||
boolean missing = false;
|
boolean missing = false;
|
||||||
|
@ -4,18 +4,6 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import net.minecraft.server.v1_9_R2.ChatComponentText;
|
|
||||||
import net.minecraft.server.v1_9_R2.ChunkCoordIntPair;
|
|
||||||
import net.minecraft.server.v1_9_R2.DataWatcher;
|
|
||||||
import net.minecraft.server.v1_9_R2.IBlockData;
|
|
||||||
import net.minecraft.server.v1_9_R2.IChatBaseComponent;
|
|
||||||
import net.minecraft.server.v1_9_R2.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_9_R2.NBTCompressedStreamTools;
|
|
||||||
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
|
||||||
import net.minecraft.server.v1_9_R2.PlayerConnection;
|
|
||||||
import net.minecraft.server.v1_9_R2.ServerPing;
|
|
||||||
import net.minecraft.server.v1_9_R2.ServerPing.ServerData;
|
|
||||||
import net.minecraft.server.v1_9_R2.ServerPing.ServerPingPlayerSample;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -28,6 +16,20 @@ import org.junit.runner.RunWith;
|
|||||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
|
|
||||||
import com.comphenix.protocol.BukkitInitialization;
|
import com.comphenix.protocol.BukkitInitialization;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_9_R2.ChatComponentText;
|
||||||
|
import net.minecraft.server.v1_9_R2.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.v1_9_R2.DataWatcher;
|
||||||
|
import net.minecraft.server.v1_9_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_9_R2.IChatBaseComponent;
|
||||||
|
import net.minecraft.server.v1_9_R2.IChatBaseComponent.ChatSerializer;
|
||||||
|
import net.minecraft.server.v1_9_R2.NBTCompressedStreamTools;
|
||||||
|
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||||
|
import net.minecraft.server.v1_9_R2.PlayerConnection;
|
||||||
|
import net.minecraft.server.v1_9_R2.ServerPing;
|
||||||
|
import net.minecraft.server.v1_9_R2.ServerPing.ServerData;
|
||||||
|
import net.minecraft.server.v1_9_R2.ServerPing.ServerPingPlayerSample;
|
||||||
|
|
||||||
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
|
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
|
||||||
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
|
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
|
||||||
@ -136,4 +138,9 @@ public class MinecraftReflectionTest {
|
|||||||
Object nmsStack = MinecraftReflection.getMinecraftItemStack(stack);
|
Object nmsStack = MinecraftReflection.getMinecraftItemStack(stack);
|
||||||
assertEquals(stack, MinecraftReflection.getBukkitItemStack(nmsStack));
|
assertEquals(stack, MinecraftReflection.getBukkitItemStack(nmsStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGameProfile() {
|
||||||
|
assertEquals(GameProfile.class, MinecraftReflection.getGameProfileClass());
|
||||||
|
}
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren