diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java b/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java index b1a02e4d..6cf5147c 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java @@ -32,7 +32,6 @@ import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.injector.PrioritizedListener; import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FuzzyReflection; -import com.google.common.base.Objects; import com.google.common.primitives.Longs; /** @@ -454,12 +453,10 @@ public class AsyncMarker implements Serializable, Comparable { // Standard equals if (other == this) return true; - if (other == null) - return false; if (other instanceof AsyncMarker) - return Objects.equal(getNewSendingIndex(), ((AsyncMarker) other).getNewSendingIndex()); - - return false; + return getNewSendingIndex() == ((AsyncMarker) other).getNewSendingIndex(); + else + return false; } @Override diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java b/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java index da0ed7e8..5dce81a9 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java @@ -20,6 +20,7 @@ package com.comphenix.protocol.async; import com.comphenix.protocol.events.PacketEvent; import com.google.common.base.Preconditions; import com.google.common.collect.ComparisonChain; +import com.google.common.primitives.Longs; /** * Provides a comparable to a packet event. @@ -56,4 +57,20 @@ class PacketEventHolder implements Comparable { compare(sendingIndex, other.sendingIndex). result(); } + + @Override + public boolean equals(Object other) { + // Standard equals + if (other == this) + return true; + if (other instanceof PacketEventHolder) + return sendingIndex == ((PacketEventHolder) other).sendingIndex; + else + return false; + } + + @Override + public int hashCode() { + return Longs.hashCode(sendingIndex); + } } diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/InjectedArrayList.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/InjectedArrayList.java index aa50212f..fd5a0b80 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/InjectedArrayList.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/player/InjectedArrayList.java @@ -42,9 +42,9 @@ class InjectedArrayList extends ArrayList { */ private static final long serialVersionUID = -1173865905404280990L; - private PlayerInjector injector; - private Set ignoredPackets; - private ClassLoader classLoader; + private transient PlayerInjector injector; + private transient Set ignoredPackets; + private transient ClassLoader classLoader; public InjectedArrayList(ClassLoader classLoader, PlayerInjector injector, Set ignoredPackets) { this.classLoader = classLoader; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java index 81599064..87a309fa 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java @@ -400,7 +400,7 @@ public class StructureModifier { if (a == null) return b == null; else if (b == null) - return a == null; + return false; else return a.getSpecificType().equals(b.getSpecificType()); } diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java index ac49f45b..0c33b847 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java @@ -94,7 +94,7 @@ public final class StructureCompiler { // Used to store generated classes of different types @SuppressWarnings("rawtypes") - private class StructureKey { + private static class StructureKey { private Class targetType; private Class fieldType; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java index 674565dc..1e350ad7 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java @@ -47,7 +47,7 @@ public class CollectionGenerator implements InstanceProvider { @Override public Object create(@Nullable Class type) { // Standard collection types - if (type.isInterface()) { + if (type != null && type.isInterface()) { if (type.equals(Collection.class) || type.equals(List.class)) return new ArrayList(); else if (type.equals(Set.class)) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java index 956ee71f..43527d17 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java @@ -119,7 +119,6 @@ public class ExistingGenerator implements InstanceProvider { @Override public Object create(@Nullable Class type) { - Object value = existingValues.get(type.getName()); // NULL values indicate that the generator failed diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java index 5563acc6..aaaf19ca 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java @@ -57,8 +57,9 @@ public class PrimitiveGenerator implements InstanceProvider { @Override public Object create(@Nullable Class type) { - - if (type.isPrimitive()) { + if (type == null) { + return null; + } else if (type.isPrimitive()) { return Defaults.defaultValue(type); } else if (Primitives.isWrapperType(type)) { return Defaults.defaultValue(Primitives.unwrap(type)); diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/injector/SortedCopyOnWriteArrayTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/injector/SortedCopyOnWriteArrayTest.java index 85821ffa..775a197e 100644 --- a/ProtocolLib/src/test/java/com/comphenix/protocol/injector/SortedCopyOnWriteArrayTest.java +++ b/ProtocolLib/src/test/java/com/comphenix/protocol/injector/SortedCopyOnWriteArrayTest.java @@ -58,7 +58,7 @@ public class SortedCopyOnWriteArrayTest { assertEquals(3, test.get(1).id); } - private class PriorityStuff implements Comparable { + private static class PriorityStuff implements Comparable { public ListenerPriority priority; public int id;