Ensure ProtocolLib functions in 1.6.4 and below.

This commit is contained in:
Kristian S. Stangeland 2013-12-14 19:17:48 +01:00
parent 96f24167bb
commit aedd97dfef
3 changed files with 17 additions and 6 deletions

View File

@ -177,7 +177,6 @@ class NetworkServerInjector extends PlayerInjector {
callbackFilter = new SendMethodFilter();
}
ex.setClassLoader(classLoader);
ex.setSuperclass(serverClass);
ex.setCallbacks(new Callback[] { sendPacketCallback, noOpCallback });
ex.setCallbackFilter(callbackFilter);

View File

@ -125,9 +125,6 @@ public abstract class PlayerInjector implements SocketInjector {
// Handle errors
protected ErrorReporter reporter;
// Used to construct proxy objects
protected ClassLoader classLoader;
// Previous markers
protected Map<Object, NetworkMarker> queuedMarkers = new MapMaker().weakKeys().makeMap();

View File

@ -17,12 +17,15 @@
package com.comphenix.protocol.reflect.cloning;
import java.util.List;
import com.comphenix.protocol.reflect.EquivalentConverter;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.BukkitConverters;
import com.comphenix.protocol.wrappers.ChunkPosition;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedServerPing;
import com.google.common.collect.Lists;
/**
* Represents an object that can clone a specific list of Bukkit- and Minecraft-related objects.
@ -31,9 +34,21 @@ import com.comphenix.protocol.wrappers.WrappedServerPing;
*/
public class BukkitCloner implements Cloner {
// List of classes we support
private Class<?>[] clonableClasses = { MinecraftReflection.getItemStackClass(), MinecraftReflection.getChunkPositionClass(),
MinecraftReflection.getDataWatcherClass(), MinecraftReflection.getServerPingClass() };
private Class<?>[] clonableClasses;
public BukkitCloner() {
List<Class<?>> classes = Lists.newArrayList();
classes.add(MinecraftReflection.getItemStackClass());
classes.add(MinecraftReflection.getChunkPositionClass());
classes.add(MinecraftReflection.getDataWatcherClass());
if (MinecraftReflection.isUsingNetty()) {
classes.add(MinecraftReflection.getServerPingClass());
}
this.clonableClasses = classes.toArray(new Class<?>[0]);
}
private int findMatchingClass(Class<?> type) {
// See if is a subclass of any of our supported superclasses
for (int i = 0; i < clonableClasses.length; i++) {