mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-28 05:35:28 +01:00
Ensure ProtocolLib functions in 1.6.4 and below.
This commit is contained in:
parent
96f24167bb
commit
aedd97dfef
@ -177,7 +177,6 @@ class NetworkServerInjector extends PlayerInjector {
|
|||||||
callbackFilter = new SendMethodFilter();
|
callbackFilter = new SendMethodFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
ex.setClassLoader(classLoader);
|
|
||||||
ex.setSuperclass(serverClass);
|
ex.setSuperclass(serverClass);
|
||||||
ex.setCallbacks(new Callback[] { sendPacketCallback, noOpCallback });
|
ex.setCallbacks(new Callback[] { sendPacketCallback, noOpCallback });
|
||||||
ex.setCallbackFilter(callbackFilter);
|
ex.setCallbackFilter(callbackFilter);
|
||||||
|
@ -126,9 +126,6 @@ public abstract class PlayerInjector implements SocketInjector {
|
|||||||
// Handle errors
|
// Handle errors
|
||||||
protected ErrorReporter reporter;
|
protected ErrorReporter reporter;
|
||||||
|
|
||||||
// Used to construct proxy objects
|
|
||||||
protected ClassLoader classLoader;
|
|
||||||
|
|
||||||
// Previous markers
|
// Previous markers
|
||||||
protected Map<Object, NetworkMarker> queuedMarkers = new MapMaker().weakKeys().makeMap();
|
protected Map<Object, NetworkMarker> queuedMarkers = new MapMaker().weakKeys().makeMap();
|
||||||
protected InterceptWritePacket writePacketInterceptor;
|
protected InterceptWritePacket writePacketInterceptor;
|
||||||
|
@ -17,12 +17,15 @@
|
|||||||
|
|
||||||
package com.comphenix.protocol.reflect.cloning;
|
package com.comphenix.protocol.reflect.cloning;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.comphenix.protocol.reflect.EquivalentConverter;
|
import com.comphenix.protocol.reflect.EquivalentConverter;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import com.comphenix.protocol.wrappers.BukkitConverters;
|
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||||
import com.comphenix.protocol.wrappers.ChunkPosition;
|
import com.comphenix.protocol.wrappers.ChunkPosition;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import com.comphenix.protocol.wrappers.WrappedServerPing;
|
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.
|
* Represents an object that can clone a specific list of Bukkit- and Minecraft-related objects.
|
||||||
@ -31,8 +34,20 @@ import com.comphenix.protocol.wrappers.WrappedServerPing;
|
|||||||
*/
|
*/
|
||||||
public class BukkitCloner implements Cloner {
|
public class BukkitCloner implements Cloner {
|
||||||
// List of classes we support
|
// List of classes we support
|
||||||
private Class<?>[] clonableClasses = { MinecraftReflection.getItemStackClass(), MinecraftReflection.getChunkPositionClass(),
|
private Class<?>[] clonableClasses;
|
||||||
MinecraftReflection.getDataWatcherClass(), MinecraftReflection.getServerPingClass() };
|
|
||||||
|
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) {
|
private int findMatchingClass(Class<?> type) {
|
||||||
// See if is a subclass of any of our supported superclasses
|
// See if is a subclass of any of our supported superclasses
|
||||||
|
Loading…
Reference in New Issue
Block a user