, TValue
/**
* Associates a given interval of keys with a certain value. Any previous
- * association will be overwritten in the given interval.
+ * association will be overwritten in the given interval.
*
* Overlapping intervals are not permitted. A key can only be associated with a single value.
*
@@ -262,7 +261,7 @@ public abstract class AbstractIntervalTree, TValue
* @param value - the value, or NULL to reset this range.
*/
public void put(TKey lowerBound, TKey upperBound, TValue value) {
- // While we don't permit overlapping intervals, we'll still allow overwriting existing intervals.
+ // While we don't permit overlapping intervals, we'll still allow overwriting existing intervals.
remove(lowerBound, upperBound, true);
invokeEntryAdded(putUnsafe(lowerBound, upperBound, value));
}
@@ -423,7 +422,7 @@ public abstract class AbstractIntervalTree, TValue
if (point != null) {
Map.Entry previous = bounds.floorEntry(inclusive ? point : decrementKey(point));
- if (previous != null)
+ if (previous != null)
return previous.getValue();
}
return null;
@@ -439,7 +438,7 @@ public abstract class AbstractIntervalTree, TValue
if (point != null) {
Map.Entry next = bounds.ceilingEntry(inclusive ? point : incrementKey(point));
- if (next != null)
+ if (next != null)
return next.getValue();
}
return null;
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
index 05be700f..2a7ea9c6 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
@@ -17,6 +17,9 @@
package com.comphenix.protocol.events;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
@@ -37,10 +40,6 @@ import java.util.concurrent.ConcurrentMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.buffer.UnpooledByteBufAllocator;
-
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldType;
@@ -88,6 +87,7 @@ import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import com.mojang.authlib.GameProfile;
/**
* Represents a Minecraft packet indirectly.
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/BootstrapList.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/BootstrapList.java
index 326f1642..3c7043cf 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/BootstrapList.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/BootstrapList.java
@@ -1,17 +1,17 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.Callable;
-import net.minecraft.util.io.netty.channel.Channel;
-// Hopefully, CB won't version these as well
-import net.minecraft.util.io.netty.channel.ChannelFuture;
-import net.minecraft.util.io.netty.channel.ChannelHandler;
-
import com.google.common.collect.Lists;
+// Hopefully, CB won't version these as well
class BootstrapList implements List {
private List delegate;
@@ -116,82 +116,102 @@ class BootstrapList implements List {
}
// Boiler plate
+ @Override
public synchronized int size() {
return delegate.size();
}
+ @Override
public synchronized boolean isEmpty() {
return delegate.isEmpty();
}
+ @Override
public boolean contains(Object o) {
return delegate.contains(o);
}
+ @Override
public synchronized Iterator iterator() {
return delegate.iterator();
}
+ @Override
public synchronized Object[] toArray() {
return delegate.toArray();
}
+ @Override
public synchronized T[] toArray(T[] a) {
return delegate.toArray(a);
}
+ @Override
public synchronized boolean remove(Object o) {
return delegate.remove(o);
}
+ @Override
public synchronized boolean containsAll(Collection> c) {
return delegate.containsAll(c);
}
+ @Override
public synchronized boolean addAll(int index, Collection extends Object> c) {
return delegate.addAll(index, c);
}
+ @Override
public synchronized boolean removeAll(Collection> c) {
return delegate.removeAll(c);
}
+ @Override
public synchronized boolean retainAll(Collection> c) {
return delegate.retainAll(c);
}
+ @Override
public synchronized void clear() {
delegate.clear();
}
+ @Override
public synchronized Object get(int index) {
return delegate.get(index);
}
+ @Override
public synchronized void add(int index, Object element) {
delegate.add(index, element);
}
+ @Override
public synchronized Object remove(int index) {
return delegate.remove(index);
}
+ @Override
public synchronized int indexOf(Object o) {
return delegate.indexOf(o);
}
+ @Override
public synchronized int lastIndexOf(Object o) {
return delegate.lastIndexOf(o);
}
+ @Override
public synchronized ListIterator listIterator() {
return delegate.listIterator();
}
+ @Override
public synchronized ListIterator listIterator(int index) {
return delegate.listIterator(index);
}
+ @Override
public synchronized List subList(int fromIndex, int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java
index 9c6ecc96..bedf8fad 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java
@@ -1,5 +1,19 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.ChannelPromise;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.handler.codec.ByteToMessageDecoder;
+import io.netty.handler.codec.MessageToByteEncoder;
+import io.netty.util.concurrent.GenericFutureListener;
+import io.netty.util.internal.TypeParameterMatcher;
+
import java.lang.reflect.InvocationTargetException;
import java.net.Socket;
import java.net.SocketAddress;
@@ -12,20 +26,6 @@ import java.util.NoSuchElementException;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelHandler;
-import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
-import net.minecraft.util.io.netty.channel.ChannelInboundHandler;
-import net.minecraft.util.io.netty.channel.ChannelInboundHandlerAdapter;
-import net.minecraft.util.io.netty.channel.ChannelPipeline;
-import net.minecraft.util.io.netty.channel.ChannelPromise;
-import net.minecraft.util.io.netty.channel.socket.SocketChannel;
-import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder;
-import net.minecraft.util.io.netty.handler.codec.MessageToByteEncoder;
-import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
-import net.minecraft.util.io.netty.util.internal.TypeParameterMatcher;
import net.sf.cglib.proxy.Factory;
import org.bukkit.Bukkit;
@@ -53,6 +53,7 @@ import com.comphenix.protocol.utility.MinecraftProtocolVersion;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.google.common.base.Preconditions;
import com.google.common.collect.MapMaker;
+import com.mojang.authlib.GameProfile;
/**
* Represents a channel injector.
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelProxy.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelProxy.java
index d9caf5d3..d951ff9d 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelProxy.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelProxy.java
@@ -1,22 +1,22 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelConfig;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelMetadata;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.ChannelProgressivePromise;
+import io.netty.channel.ChannelPromise;
+import io.netty.channel.EventLoop;
+import io.netty.util.Attribute;
+import io.netty.util.AttributeKey;
+
import java.lang.reflect.Field;
import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.Callable;
-import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelConfig;
-import net.minecraft.util.io.netty.channel.ChannelFuture;
-import net.minecraft.util.io.netty.channel.ChannelMetadata;
-import net.minecraft.util.io.netty.channel.ChannelPipeline;
-import net.minecraft.util.io.netty.channel.ChannelProgressivePromise;
-import net.minecraft.util.io.netty.channel.ChannelPromise;
-import net.minecraft.util.io.netty.channel.EventLoop;
-import net.minecraft.util.io.netty.util.Attribute;
-import net.minecraft.util.io.netty.util.AttributeKey;
-
import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
import com.google.common.collect.Maps;
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/EventLoopProxy.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/EventLoopProxy.java
index 627a6c09..9576c9ac 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/EventLoopProxy.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/EventLoopProxy.java
@@ -1,5 +1,15 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelPromise;
+import io.netty.channel.EventLoop;
+import io.netty.channel.EventLoopGroup;
+import io.netty.util.concurrent.EventExecutor;
+import io.netty.util.concurrent.ProgressivePromise;
+import io.netty.util.concurrent.Promise;
+import io.netty.util.concurrent.ScheduledFuture;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -9,27 +19,19 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelFuture;
-import net.minecraft.util.io.netty.channel.ChannelPromise;
-import net.minecraft.util.io.netty.channel.EventLoop;
-import net.minecraft.util.io.netty.channel.EventLoopGroup;
-import net.minecraft.util.io.netty.util.concurrent.EventExecutor;
-import net.minecraft.util.io.netty.util.concurrent.ProgressivePromise;
-import net.minecraft.util.io.netty.util.concurrent.Promise;
-import net.minecraft.util.io.netty.util.concurrent.ScheduledFuture;
-
/**
* An event loop proxy.
* @author Kristian.
*/
abstract class EventLoopProxy implements EventLoop {
private static final Runnable EMPTY_RUNNABLE = new Runnable() {
+ @Override
public void run() {
// Do nothing
}
};
private static final Callable> EMPTY_CALLABLE = new Callable() {
+ @Override
public Object call() throws Exception {
return null;
};
@@ -72,88 +74,108 @@ abstract class EventLoopProxy implements EventLoop {
*/
protected abstract Callable schedulingCallable(Callable callable);
+ @Override
public void execute(Runnable command) {
getDelegate().execute(schedulingRunnable(command));
}
- public net.minecraft.util.io.netty.util.concurrent.Future submit(Callable action) {
+ @Override
+ public io.netty.util.concurrent.Future submit(Callable action) {
return getDelegate().submit(schedulingCallable(action));
}
- public net.minecraft.util.io.netty.util.concurrent.Future submit(Runnable action, T arg1) {
+ @Override
+ public io.netty.util.concurrent.Future submit(Runnable action, T arg1) {
return getDelegate().submit(schedulingRunnable(action), arg1);
}
- public net.minecraft.util.io.netty.util.concurrent.Future> submit(Runnable action) {
+ @Override
+ public io.netty.util.concurrent.Future> submit(Runnable action) {
return getDelegate().submit(schedulingRunnable(action));
}
+ @Override
public ScheduledFuture schedule(Callable action, long arg1, TimeUnit arg2) {
return getDelegate().schedule(schedulingCallable(action), arg1, arg2);
}
+ @Override
public ScheduledFuture> schedule(Runnable action, long arg1, TimeUnit arg2) {
return getDelegate().schedule(schedulingRunnable(action), arg1, arg2);
}
+ @Override
public ScheduledFuture> scheduleAtFixedRate(Runnable action, long arg1, long arg2, TimeUnit arg3) {
return getDelegate().scheduleAtFixedRate(schedulingRunnable(action), arg1, arg2, arg3);
}
+ @Override
public ScheduledFuture> scheduleWithFixedDelay(Runnable action, long arg1, long arg2, TimeUnit arg3) {
return getDelegate().scheduleWithFixedDelay(schedulingRunnable(action), arg1, arg2, arg3);
}
// Boiler plate:
+ @Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
return getDelegate().awaitTermination(timeout, unit);
}
+ @Override
public boolean inEventLoop() {
return getDelegate().inEventLoop();
}
+ @Override
public boolean inEventLoop(Thread arg0) {
return getDelegate().inEventLoop(arg0);
}
+ @Override
public boolean isShutdown() {
return getDelegate().isShutdown();
}
+ @Override
public boolean isTerminated() {
return getDelegate().isTerminated();
}
+ @Override
public List> invokeAll(Collection extends Callable> tasks)
throws InterruptedException {
return getDelegate().invokeAll(tasks);
}
+ @Override
public List> invokeAll(Collection extends Callable> tasks, long timeout,
TimeUnit unit) throws InterruptedException {
return getDelegate().invokeAll(tasks, timeout, unit);
}
+ @Override
public T invokeAny(Collection extends Callable> tasks) throws InterruptedException,
ExecutionException {
return getDelegate().invokeAny(tasks);
}
+ @Override
public T invokeAny(Collection extends Callable> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
return getDelegate().invokeAny(tasks, timeout, unit);
}
+ @Override
public boolean isShuttingDown() {
return getDelegate().isShuttingDown();
}
+ @Override
public Iterator iterator() {
return getDelegate().iterator();
}
- public net.minecraft.util.io.netty.util.concurrent.Future newFailedFuture(Throwable arg0) {
+ @Override
+ public io.netty.util.concurrent.Future newFailedFuture(Throwable arg0) {
return getDelegate().newFailedFuture(arg0);
}
@@ -162,47 +184,58 @@ abstract class EventLoopProxy implements EventLoop {
return getDelegate().next();
}
+ @Override
public ProgressivePromise newProgressivePromise() {
return getDelegate().newProgressivePromise();
}
+ @Override
public Promise newPromise() {
return getDelegate().newPromise();
}
- public net.minecraft.util.io.netty.util.concurrent.Future newSucceededFuture(V arg0) {
+ @Override
+ public io.netty.util.concurrent.Future newSucceededFuture(V arg0) {
return getDelegate().newSucceededFuture(arg0);
}
+ @Override
public EventLoopGroup parent() {
return getDelegate().parent();
}
+ @Override
public ChannelFuture register(Channel arg0, ChannelPromise arg1) {
return getDelegate().register(arg0, arg1);
}
+ @Override
public ChannelFuture register(Channel arg0) {
return getDelegate().register(arg0);
}
- public net.minecraft.util.io.netty.util.concurrent.Future> shutdownGracefully() {
+ @Override
+ public io.netty.util.concurrent.Future> shutdownGracefully() {
return getDelegate().shutdownGracefully();
}
- public net.minecraft.util.io.netty.util.concurrent.Future> shutdownGracefully(long arg0, long arg1, TimeUnit arg2) {
+ @Override
+ public io.netty.util.concurrent.Future> shutdownGracefully(long arg0, long arg1, TimeUnit arg2) {
return getDelegate().shutdownGracefully(arg0, arg1, arg2);
}
- public net.minecraft.util.io.netty.util.concurrent.Future> terminationFuture() {
+ @Override
+ public io.netty.util.concurrent.Future> terminationFuture() {
return getDelegate().terminationFuture();
}
+ @Override
@Deprecated
public void shutdown() {
getDelegate().shutdown();
}
+ @Override
@Deprecated
public List shutdownNow() {
return getDelegate().shutdownNow();
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/InjectionFactory.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/InjectionFactory.java
index 9e76aabf..72137714 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/InjectionFactory.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/InjectionFactory.java
@@ -1,11 +1,11 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+
import java.util.concurrent.ConcurrentMap;
import javax.annotation.Nonnull;
-import net.minecraft.util.io.netty.channel.Channel;
-
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -119,11 +119,11 @@ class InjectionFactory {
* @return The channel injector, or a closed injector.
*/
@Nonnull
- public Injector fromChannel(Channel channel, ChannelListener listener, TemporaryPlayerFactory playerFactory) {
+ public Injector fromChannel(Channel channel, ChannelListener listener, TemporaryPlayerFactory playerFactory) {
if (closed)
return new ClosedInjector(null);
- Object networkManager = findNetworkManager(channel);
+ Object networkManager = findNetworkManager(channel);
Player temporaryPlayer = playerFactory.createTemporaryPlayer(Bukkit.getServer());
ChannelInjector injector = new ChannelInjector(temporaryPlayer, networkManager, channel, listener, this);
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolInjector.java
index 61f402bc..3979895e 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolInjector.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolInjector.java
@@ -1,5 +1,13 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.ChannelInitializer;
+
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -8,14 +16,6 @@ import java.net.InetSocketAddress;
import java.util.List;
import java.util.Set;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelFuture;
-import net.minecraft.util.io.netty.channel.ChannelHandler;
-import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
-import net.minecraft.util.io.netty.channel.ChannelInboundHandler;
-import net.minecraft.util.io.netty.channel.ChannelInboundHandlerAdapter;
-import net.minecraft.util.io.netty.channel.ChannelInitializer;
-
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -42,7 +42,7 @@ import com.comphenix.protocol.utility.MinecraftReflection;
import com.google.common.collect.Lists;
-public class NettyProtocolInjector implements ChannelListener {
+public class NettyProtocolInjector implements ChannelListener {
public static final ReportType REPORT_CANNOT_INJECT_INCOMING_CHANNEL = new ReportType("Unable to inject incoming channel %s.");
private volatile boolean injected;
@@ -234,7 +234,7 @@ public class NettyProtocolInjector implements ChannelListener {
for (VolatileField field : bootstrapFields) {
Object value = field.getValue();
- // Undo the processed channels, if any
+ // Undo the processed channels, if any
if (value instanceof BootstrapList) {
((BootstrapList) value).close();
}
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettySocketAdaptor.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettySocketAdaptor.java
index a772a860..a8632e06 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettySocketAdaptor.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettySocketAdaptor.java
@@ -1,5 +1,9 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.socket.SocketChannel;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -8,9 +12,6 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
-import net.minecraft.util.io.netty.channel.ChannelOption;
-import net.minecraft.util.io.netty.channel.socket.SocketChannel;
-
/**
* This class wraps a Netty {@link Channel} in a {@link Socket}. It overrides
* all methods in {@link Socket} to ensure that calls are not mistakingly made
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/PipelineProxy.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/PipelineProxy.java
index c855e938..2e126158 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/PipelineProxy.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/PipelineProxy.java
@@ -1,19 +1,19 @@
package com.comphenix.protocol.injector.netty;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.ChannelPromise;
+import io.netty.util.concurrent.EventExecutorGroup;
+
import java.net.SocketAddress;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import net.minecraft.util.io.netty.channel.Channel;
-import net.minecraft.util.io.netty.channel.ChannelFuture;
-import net.minecraft.util.io.netty.channel.ChannelHandler;
-import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
-import net.minecraft.util.io.netty.channel.ChannelPipeline;
-import net.minecraft.util.io.netty.channel.ChannelPromise;
-import net.minecraft.util.io.netty.util.concurrent.EventExecutorGroup;
-
/**
* A pipeline proxy.
* @author Kristian
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java b/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java
index ead644e8..63e74693 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java
@@ -12,7 +12,7 @@ import com.comphenix.protocol.timing.TimedListenerManager.ListenerType;
import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
-import com.google.common.io.Closeables;
+import com.google.common.io.Closer;
import com.google.common.io.Files;
public class TimingReportGenerator {
@@ -22,20 +22,21 @@ public class TimingReportGenerator {
private static final String PLUGIN_HEADER = "=== PLUGIN %s ===" + NEWLINE;
private static final String LISTENER_HEADER = " TYPE: %s " + NEWLINE;
private static final String SEPERATION_LINE = " " + Strings.repeat("-", 139) + NEWLINE;
- private static final String STATISTICS_HEADER =
+ private static final String STATISTICS_HEADER =
" Protocol: Name: ID: Count: Min (ms): " +
"Max (ms): Mean (ms): Std (ms): " + NEWLINE;
private static final String STATISTICS_ROW = " %-15s %-29s %-19s %-12d %-15.6f %-15.6f %-15.6f %.6f " + NEWLINE;
private static final String SUM_MAIN_THREAD = " => Time on main thread: %.6f ms" + NEWLINE;
public void saveTo(File destination, TimedListenerManager manager) throws IOException {
+ Closer closer = Closer.create();
BufferedWriter writer = null;
Date started = manager.getStarted();
Date stopped = manager.getStopped();
long seconds = Math.abs((stopped.getTime() - started.getTime()) / 1000);
try {
- writer = Files.newWriter(destination, Charsets.UTF_8);
+ writer = closer.register(Files.newWriter(destination, Charsets.UTF_8));
// Write some timing information
writer.write(String.format(META_STARTED, started));
@@ -60,13 +61,8 @@ public class TimingReportGenerator {
// Next plugin
writer.write(NEWLINE);
}
-
} finally {
- if (writer != null) {
- // Don't suppress exceptions
- writer.flush();
- Closeables.closeQuietly(writer);
- }
+ closer.close();
}
}
@@ -97,21 +93,21 @@ public class TimingReportGenerator {
}
// These are executed on the main thread
if (type == ListenerType.SYNC_SERVER_SIDE) {
- destination.write(String.format(SUM_MAIN_THREAD,
+ destination.write(String.format(SUM_MAIN_THREAD,
toMilli(sum.getCount() * sum.getMean())
));
}
}
private void printStatistic(Writer destination, PacketType key, final StatisticsStream stream) throws IOException {
- destination.write(String.format(STATISTICS_ROW,
- key != null ? key.getProtocol() : "SUM",
- key != null ? key.name() : "-",
+ destination.write(String.format(STATISTICS_ROW,
+ key != null ? key.getProtocol() : "SUM",
+ key != null ? key.name() : "-",
key != null ? getPacketId(key) : "-",
- stream.getCount(),
- toMilli(stream.getMinimum()),
- toMilli(stream.getMaximum()),
- toMilli(stream.getMean()),
+ stream.getCount(),
+ toMilli(stream.getMinimum()),
+ toMilli(stream.getMaximum()),
+ toMilli(stream.getMean()),
toMilli(stream.getStandardDeviation())
));
}
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufAdapter.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufAdapter.java
index 6d370b4a..65dcb2c3 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufAdapter.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufAdapter.java
@@ -1,5 +1,9 @@
package com.comphenix.protocol.utility;
+import io.netty.buffer.AbstractByteBuf;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -12,19 +16,14 @@ import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.channels.WritableByteChannel;
-import net.minecraft.util.io.netty.buffer.AbstractByteBuf;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
-
import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
import com.google.common.io.ByteStreams;
-import com.google.common.io.LimitInputStream;
/**
* Construct a ByteBuf around an input stream and an output stream.
*
- * Note that as streams usually don't support seeking, this implementation will ignore
+ * Note that as streams usually don't support seeking, this implementation will ignore
* all indexing in the byte buffer.
* @author Kristian
*/
@@ -250,13 +249,13 @@ class ByteBufAdapter extends AbstractByteBuf {
@Override
public ByteBuf getBytes(int index, OutputStream dst, int length) throws IOException {
- ByteStreams.copy(new LimitInputStream(input, length), dst);
+ ByteStreams.copy(ByteStreams.limit(input, length), dst);
return this;
}
@Override
public int getBytes(int index, GatheringByteChannel out, int length) throws IOException {
- byte[] data = ByteStreams.toByteArray(new LimitInputStream(input, length));
+ byte[] data = ByteStreams.toByteArray(ByteStreams.limit(input, length));
out.write(ByteBuffer.wrap(data));
return data.length;
@@ -299,7 +298,7 @@ class ByteBufAdapter extends AbstractByteBuf {
@Override
public int setBytes(int index, InputStream in, int length) throws IOException {
- LimitInputStream limit = new LimitInputStream(in, length);
+ InputStream limit = ByteStreams.limit(in, length);
ByteStreams.copy(limit, output);
return length - limit.available();
}
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java
index c8caaa50..8a6c388a 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java
@@ -1,14 +1,15 @@
package com.comphenix.protocol.utility;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.util.concurrent.GenericFutureListener;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.buffer.UnpooledByteBufAllocator;
-import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
-import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java
index a7d9e5eb..ba0987b7 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java
@@ -17,6 +17,8 @@
package com.comphenix.protocol.utility;
+import io.netty.buffer.ByteBuf;
+
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.IOException;
@@ -37,8 +39,6 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
import net.sf.cglib.asm.ClassReader;
import net.sf.cglib.asm.MethodVisitor;
import net.sf.cglib.asm.Opcodes;
@@ -73,6 +73,7 @@ import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import com.comphenix.protocol.wrappers.nbt.NbtType;
import com.google.common.base.Joiner;
import com.google.common.collect.Maps;
+import com.mojang.authlib.GameProfile;
/**
* Methods and constants specifically used in conjuction with reflecting Minecraft object.
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java
index 78d45409..1b564865 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java
@@ -23,65 +23,79 @@ class GuavaWrappers {
* @return The Bukkit multimap.
*/
public static Multimap getBukkitMultimap(
- final net.minecraft.util.com.google.common.collect.Multimap multimap) {
+ final com.google.common.collect.Multimap multimap) {
if (USE_REFLECTION_FALLBACK) {
return GuavaReflection.getBukkitMultimap(multimap);
}
Multimap result = new Multimap() {
+ @Override
public Map> asMap() {
return multimap.asMap();
}
+ @Override
public void clear() {
multimap.clear();
}
+ @Override
public boolean containsEntry(Object arg0, Object arg1) {
return multimap.containsEntry(arg0, arg1);
}
+ @Override
public boolean containsKey(Object arg0) {
return multimap.containsKey(arg0);
}
+ @Override
public boolean containsValue(Object arg0) {
return multimap.containsValue(arg0);
}
+ @Override
public Collection> entries() {
return multimap.entries();
}
+ @Override
public boolean equals(Object arg0) {
return multimap.equals(arg0);
}
+ @Override
public Collection get(TKey arg0) {
return multimap.get(arg0);
}
+ @Override
public int hashCode() {
return multimap.hashCode();
}
+ @Override
public boolean isEmpty() {
return multimap.isEmpty();
}
+ @Override
public Set keySet() {
return multimap.keySet();
}
+ @Override
public Multiset keys() {
return getBukkitMultiset(multimap.keys());
}
+ @Override
public boolean put(TKey arg0, TValue arg1) {
return multimap.put(arg0, arg1);
}
+ @Override
public boolean putAll(com.google.common.collect.Multimap extends TKey, ? extends TValue> arg0) {
boolean result = false;
@@ -92,33 +106,39 @@ class GuavaWrappers {
return result;
}
+ @Override
public boolean putAll(TKey arg0, Iterable extends TValue> arg1) {
return multimap.putAll(arg0, arg1);
}
+ @Override
public boolean remove(Object arg0, Object arg1) {
return multimap.remove(arg0, arg1);
}
+ @Override
public Collection removeAll(Object arg0) {
return multimap.removeAll(arg0);
}
+ @Override
public Collection replaceValues(TKey arg0, Iterable extends TValue> arg1) {
return multimap.replaceValues(arg0, arg1);
}
+ @Override
public int size() {
return multimap.size();
}
+ @Override
public Collection values() {
return multimap.values();
- }
+ }
};
try {
- result.size(); // Test
+ result.size(); // Test
return result;
} catch (LinkageError e) {
// Occurs on Cauldron 1.7.10
@@ -127,123 +147,146 @@ class GuavaWrappers {
}
}
- public static Multiset getBukkitMultiset(final net.minecraft.util.com.google.common.collect.Multiset multiset) {
+ public static Multiset getBukkitMultiset(final com.google.common.collect.Multiset multiset) {
if (USE_REFLECTION_FALLBACK) {
return GuavaReflection.getBukkitMultiset(multiset);
}
Multiset result = new Multiset() {
+ @Override
public int add(TValue arg0, int arg1) {
return multiset.add(arg0, arg1);
}
+ @Override
public boolean add(TValue arg0) {
return multiset.add(arg0);
}
+ @Override
public boolean addAll(Collection extends TValue> c) {
return multiset.addAll(c);
}
+ @Override
public void clear() {
multiset.clear();
}
+ @Override
public boolean contains(Object arg0) {
return multiset.contains(arg0);
}
+ @Override
public boolean containsAll(Collection> arg0) {
return multiset.containsAll(arg0);
}
+ @Override
public int count(Object arg0) {
return multiset.count(arg0);
}
+ @Override
public Set elementSet() {
return multiset.elementSet();
}
+ @Override
public Set> entrySet() {
return new ConvertedSet<
- net.minecraft.util.com.google.common.collect.Multiset.Entry,
+ com.google.common.collect.Multiset.Entry,
Multiset.Entry>
(multiset.entrySet()) {
@Override
protected com.google.common.collect.Multiset.Entry toOuter(
- net.minecraft.util.com.google.common.collect.Multiset.Entry inner) {
+ com.google.common.collect.Multiset.Entry inner) {
return getBukkitEntry(inner);
}
@Override
- protected net.minecraft.util.com.google.common.collect.Multiset.Entry toInner(
+ protected com.google.common.collect.Multiset.Entry toInner(
com.google.common.collect.Multiset.Entry outer) {
throw new UnsupportedOperationException("Cannot convert " + outer);
}
};
}
+ @Override
public boolean equals(Object arg0) {
return multiset.equals(arg0);
}
+ @Override
public int hashCode() {
return multiset.hashCode();
}
+ @Override
public boolean isEmpty() {
return multiset.isEmpty();
}
+ @Override
public Iterator iterator() {
return multiset.iterator();
}
+ @Override
public int remove(Object arg0, int arg1) {
return multiset.remove(arg0, arg1);
}
+ @Override
public boolean remove(Object arg0) {
return multiset.remove(arg0);
}
+ @Override
public boolean removeAll(Collection> arg0) {
return multiset.removeAll(arg0);
}
+ @Override
public boolean retainAll(Collection> arg0) {
return multiset.retainAll(arg0);
}
+ @Override
public boolean setCount(TValue arg0, int arg1, int arg2) {
return multiset.setCount(arg0, arg1, arg2);
}
+ @Override
public int setCount(TValue arg0, int arg1) {
return multiset.setCount(arg0, arg1);
}
+ @Override
public int size() {
return multiset.size();
}
+ @Override
public Object[] toArray() {
return multiset.toArray();
}
+ @Override
public T[] toArray(T[] a) {
return multiset.toArray(a);
}
+ @Override
public String toString() {
return multiset.toString();
}
};
try {
- result.size(); // Test
+ result.size(); // Test
return result;
} catch (LinkageError e) {
USE_REFLECTION_FALLBACK = true;
@@ -251,24 +294,29 @@ class GuavaWrappers {
}
}
- private static Multiset.Entry getBukkitEntry(final net.minecraft.util.com.google.common.collect.Multiset.Entry entry) {
+ private static Multiset.Entry getBukkitEntry(final com.google.common.collect.Multiset.Entry entry) {
return new Multiset.Entry() {
+ @Override
public boolean equals(Object arg0) {
return entry.equals(arg0);
}
+ @Override
public int getCount() {
return entry.getCount();
}
+ @Override
public TValue getElement() {
return entry.getElement();
}
+ @Override
public int hashCode() {
return entry.hashCode();
}
+ @Override
public String toString() {
return entry.toString();
}
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java
index 2da52be1..271ea372 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java
@@ -3,9 +3,6 @@ package com.comphenix.protocol.wrappers;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.com.mojang.authlib.properties.Property;
-
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@@ -22,6 +19,8 @@ import com.comphenix.protocol.wrappers.collection.ConvertedMultimap;
import com.google.common.base.Charsets;
import com.google.common.base.Objects;
import com.google.common.collect.Multimap;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.properties.Property;
/**
* Represents a wrapper for a game profile.
@@ -88,7 +87,7 @@ public class WrappedGameProfile extends AbstractWrapper {
/**
* Construct a new game profile with the given properties.
*
- * Note that this constructor is very lenient when parsing UUIDs for backwards compatibility reasons.
+ * Note that this constructor is very lenient when parsing UUIDs for backwards compatibility reasons.
* IDs that cannot be parsed as an UUID will be hashed and form a version 3 UUID instead.
*
* This method is deprecated for Minecraft 1.7.8 and above.
@@ -128,7 +127,7 @@ public class WrappedGameProfile extends AbstractWrapper {
* @param profile - the underlying profile, or NULL.
*/
public static WrappedGameProfile fromHandle(Object handle) {
- if (handle == null)
+ if (handle == null)
return null;
return new WrappedGameProfile(handle);
}
@@ -145,7 +144,7 @@ public class WrappedGameProfile extends AbstractWrapper {
} catch (IllegalArgumentException e) {
// Warn once every hour (per plugin)
ProtocolLibrary.getErrorReporter().reportWarning(
- WrappedGameProfile.class,
+ WrappedGameProfile.class,
Report.newBuilder(REPORT_INVALID_UUID).
rateLimit(1, TimeUnit.HOURS).
messageParam(PluginContext.getPluginCaller(new Exception()), id)
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java
index 785e9c3b..dd17698a 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java
@@ -1,5 +1,10 @@
package com.comphenix.protocol.wrappers;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.handler.codec.base64.Base64;
+import io.netty.util.IllegalReferenceCountException;
+
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.ByteArrayInputStream;
@@ -10,12 +15,6 @@ import java.util.List;
import javax.imageio.ImageIO;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.buffer.Unpooled;
-import net.minecraft.util.io.netty.handler.codec.base64.Base64;
-import net.minecraft.util.io.netty.util.IllegalReferenceCountException;
-
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@@ -39,6 +38,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
+import com.mojang.authlib.GameProfile;
/**
* Represents a server ping packet data.
diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java
index 5970c8b2..fd6f322b 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java
@@ -2,9 +2,8 @@ package com.comphenix.protocol.wrappers;
import java.security.PublicKey;
-import net.minecraft.util.com.mojang.authlib.properties.Property;
-
import com.google.common.base.Objects;
+import com.mojang.authlib.properties.Property;
/**
* Represents a wrapper over a signed property.
@@ -68,7 +67,7 @@ public class WrappedSignedProperty extends AbstractWrapper {
}
/**
- * Retrieve the signature of the property (base64) as returned by the session server's /hasJoined.
+ * Retrieve the signature of the property (base64) as returned by the session server's /hasJoined.
* @return The signature of the property.
*/
public String getSignature() {
@@ -76,7 +75,7 @@ public class WrappedSignedProperty extends AbstractWrapper {
}
/**
- * Retrieve the value of the property (base64) as return by the session server's /hasJoined
+ * Retrieve the value of the property (base64) as return by the session server's /hasJoined
* @return The value of the property.
*/
public String getValue() {
@@ -108,7 +107,7 @@ public class WrappedSignedProperty extends AbstractWrapper {
@Override
public boolean equals(Object object){
if (object instanceof WrappedSignedProperty) {
- if (!super.equals(object))
+ if (!super.equals(object))
return false;
WrappedSignedProperty that = (WrappedSignedProperty) object;
return Objects.equal(this.getName(), that.getName())
diff --git a/ProtocolLib/src/test/java/com/comphenix/integration/protocol/SimpleCraftBukkitITCase.java b/ProtocolLib/src/test/java/com/comphenix/integration/protocol/SimpleCraftBukkitITCase.java
index f93cf690..ebfcea50 100644
--- a/ProtocolLib/src/test/java/com/comphenix/integration/protocol/SimpleCraftBukkitITCase.java
+++ b/ProtocolLib/src/test/java/com/comphenix/integration/protocol/SimpleCraftBukkitITCase.java
@@ -34,14 +34,14 @@ import com.google.common.io.Files;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
@PrepareForTest(PluginDescriptionFile.class)
-public class SimpleCraftBukkitITCase {
+public class SimpleCraftBukkitITCase {
// The fake plugin
private static volatile Plugin FAKE_PLUGIN = null;
/**
* The maximum amount of time to wait before a server has started.
*
- * We have to give it the ample time of 60 seconds, as a server may have to
+ * We have to give it the ample time of 60 seconds, as a server may have to
* generate the spawn area in three worlds.
*/
private static final int TIMEOUT_MS = 60000;
@@ -125,7 +125,7 @@ public class SimpleCraftBukkitITCase {
// Copy the ProtocolLib plugin to the server
if (pluginDirectory.exists()) {
- Files.deleteDirectoryContents(pluginDirectory);
+ deleteFolder(pluginDirectory);
}
pluginDirectory.mkdirs();
@@ -133,6 +133,21 @@ public class SimpleCraftBukkitITCase {
File destination = new File(pluginDirectory, bestFile.getName()).getAbsoluteFile();
Files.copy(bestFile, destination);
}
+
+ private static void deleteFolder(File folder) {
+ if (folder.exists()) {
+ File[] files = folder.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ deleteFolder(file);
+ } else {
+ file.delete();
+ }
+ }
+ }
+ }
+ }
/**
* Load a specific fake plugin.
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java b/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java
index cd029e8f..e653daef 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java
@@ -3,14 +3,14 @@ package com.comphenix.protocol;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import net.minecraft.server.v1_7_R4.Block;
-import net.minecraft.server.v1_7_R4.Item;
-import net.minecraft.server.v1_7_R4.StatisticList;
+import net.minecraft.server.v1_8_R1.Block;
+import net.minecraft.server.v1_8_R1.Item;
+import net.minecraft.server.v1_8_R1.StatisticList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemFactory;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.ItemMeta;
@@ -38,9 +38,9 @@ public class BukkitInitialization {
initializePackage();
try {
- Block.p();
- Item.l();
- StatisticList.a();
+ Block.R(); // Block.register();
+ Item.t(); // Item.register();
+ StatisticList.a(); // StatisticList.register();
} catch (Exception e) {
// Swallow
e.printStackTrace();
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java
index d34c063e..96745909 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java
@@ -26,9 +26,9 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.UUID;
-import net.minecraft.server.v1_7_R4.AttributeModifier;
-import net.minecraft.server.v1_7_R4.AttributeSnapshot;
-import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
+import net.minecraft.server.v1_8_R1.AttributeModifier;
+import net.minecraft.server.v1_8_R1.AttributeSnapshot;
+import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes;
import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -36,7 +36,7 @@ import org.apache.commons.lang.builder.ToStringStyle;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.WorldType;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemFactory;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java
index 168412c8..d2c79311 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java
@@ -4,12 +4,12 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import net.minecraft.server.v1_7_R4.ChatComponentText;
-import net.minecraft.server.v1_7_R4.ChatSerializer;
-import net.minecraft.server.v1_7_R4.IChatBaseComponent;
-import net.minecraft.server.v1_7_R4.ServerPing;
-import net.minecraft.server.v1_7_R4.ServerPingPlayerSample;
-import net.minecraft.server.v1_7_R4.ServerPingServerData;
+import net.minecraft.server.v1_8_R1.ChatComponentText;
+import net.minecraft.server.v1_8_R1.ChatSerializer;
+import net.minecraft.server.v1_8_R1.IChatBaseComponent;
+import net.minecraft.server.v1_8_R1.ServerPing;
+import net.minecraft.server.v1_8_R1.ServerPingPlayerSample;
+import net.minecraft.server.v1_8_R1.ServerPingServerData;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/utility/StreamSerializerTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/utility/StreamSerializerTest.java
index 3686eaa3..2bad5584 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/utility/StreamSerializerTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/utility/StreamSerializerTest.java
@@ -8,10 +8,10 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import net.minecraft.server.v1_7_R4.IntHashMap;
+import net.minecraft.server.v1_8_R1.IntHashMap;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemFactory;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/ChunkCoordIntPairTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/ChunkCoordIntPairTest.java
index a28fe23f..942370a8 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/ChunkCoordIntPairTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/ChunkCoordIntPairTest.java
@@ -15,15 +15,15 @@ public class ChunkCoordIntPairTest {
@Test
public void test() {
- net.minecraft.server.v1_7_R4.ChunkCoordIntPair pair = new net.minecraft.server.v1_7_R4.ChunkCoordIntPair(1, 2);
+ net.minecraft.server.v1_8_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_8_R1.ChunkCoordIntPair(1, 2);
ChunkCoordIntPair specific = ChunkCoordIntPair.getConverter().getSpecific(pair);
assertEquals(1, specific.getChunkX());
assertEquals(2, specific.getChunkZ());
- net.minecraft.server.v1_7_R4.ChunkCoordIntPair roundtrip =
- (net.minecraft.server.v1_7_R4.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
- getGeneric(net.minecraft.server.v1_7_R4.ChunkCoordIntPair.class, specific);
+ net.minecraft.server.v1_8_R1.ChunkCoordIntPair roundtrip =
+ (net.minecraft.server.v1_8_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
+ getGeneric(net.minecraft.server.v1_8_R1.ChunkCoordIntPair.class, specific);
assertEquals(1, roundtrip.x);
assertEquals(2, roundtrip.z);
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java
index 3e2d0561..3e89d0c8 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java
@@ -1,12 +1,12 @@
package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals;
-import net.minecraft.server.v1_7_R4.EnumChatVisibility;
-import net.minecraft.server.v1_7_R4.EnumClientCommand;
-import net.minecraft.server.v1_7_R4.EnumDifficulty;
-import net.minecraft.server.v1_7_R4.EnumEntityUseAction;
-import net.minecraft.server.v1_7_R4.EnumGamemode;
-import net.minecraft.server.v1_7_R4.EnumProtocol;
+import net.minecraft.server.v1_8_R1.EnumChatVisibility;
+import net.minecraft.server.v1_8_R1.EnumClientCommand;
+import net.minecraft.server.v1_8_R1.EnumDifficulty;
+import net.minecraft.server.v1_8_R1.EnumEntityUseAction;
+import net.minecraft.server.v1_8_R1.EnumGamemode;
+import net.minecraft.server.v1_8_R1.EnumProtocol;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedAttributeTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedAttributeTest.java
index 77c4e59d..ee3073eb 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedAttributeTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedAttributeTest.java
@@ -6,9 +6,9 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
-import net.minecraft.server.v1_7_R4.AttributeModifier;
-import net.minecraft.server.v1_7_R4.AttributeSnapshot;
-import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
+import net.minecraft.server.v1_8_R1.AttributeModifier;
+import net.minecraft.server.v1_8_R1.AttributeSnapshot;
+import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedWatchableObjectTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedWatchableObjectTest.java
index 70c5ae3c..811c9b43 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedWatchableObjectTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/WrappedWatchableObjectTest.java
@@ -3,7 +3,7 @@ package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemFactory;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtFactoryTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtFactoryTest.java
index 7a65445b..078f20e0 100644
--- a/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtFactoryTest.java
+++ b/ProtocolLib/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtFactoryTest.java
@@ -27,7 +27,7 @@ import java.io.DataOutput;
import java.io.DataOutputStream;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemFactory;
+import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass;
import org.junit.Test;