From fa55e2cb2771388546961f16b56e4760bfff6b26 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sat, 7 Dec 2013 19:52:02 +0100 Subject: [PATCH] Remove any references to Guava in Minecraft. --- .../src/main/java/com/comphenix/protocol/PacketType.java | 8 +++----- .../com/comphenix/protocol/concurrency/PacketTypeSet.java | 3 +-- .../java/com/comphenix/protocol/events/PacketAdapter.java | 3 +-- .../comphenix/protocol/injector/PacketFilterManager.java | 2 +- .../comphenix/protocol/injector/netty/ChannelProxy.java | 2 +- .../com/comphenix/protocol/reflect/FuzzyReflection.java | 5 ++--- .../com/comphenix/protocol/reflect/VolatileField.java | 2 +- .../com/comphenix/protocol/wrappers/nbt/NameProperty.java | 3 +-- .../protocol/utility/MinecraftReflectionTest.java | 3 +-- 9 files changed, 12 insertions(+), 19 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java b/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java index 31d1429b..664b9f84 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java @@ -8,7 +8,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.Future; import org.bukkit.Bukkit; - import com.comphenix.protocol.events.ConnectionSide; import com.comphenix.protocol.injector.packet.PacketRegistry; import com.comphenix.protocol.reflect.ObjectEnum; @@ -731,17 +730,16 @@ public class PacketType implements Serializable { /** * Retrieve the equivalent packet class. - * @return The packet class. + * @return The packet class, or NULL if not found. */ public Class getPacketClass() { try { return PacketRegistry.getPacketClassFromType(this); } catch (Exception e) { - e.printStackTrace(); return null; } } - + /** * Retrieve the Minecraft version for the current ID. * @return The Minecraft version. @@ -782,7 +780,7 @@ public class PacketType implements Serializable { @Override public String toString() { - Class clazz = getPacketClass(); + Class clazz = getPacketClass();; return (clazz != null ? clazz.getSimpleName() : "UNREGISTERED") + " [" + protocol + ", " + sender + ", " + currentId + ", legacy: " + legacyId + "]"; } diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java b/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java index 3598c4ce..c41cf89a 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java @@ -7,8 +7,7 @@ import java.util.Set; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.injector.packet.PacketRegistry; import com.google.common.base.Preconditions; - -import net.minecraft.util.com.google.common.collect.Maps; +import com.google.common.collect.Maps; /** * Represents a concurrent set of packet types. diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java index 26e5383a..26639887 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java @@ -22,8 +22,6 @@ import java.util.Set; import javax.annotation.Nonnull; -import net.minecraft.util.com.google.common.collect.Sets; - import org.bukkit.plugin.Plugin; import com.comphenix.protocol.PacketType; @@ -32,6 +30,7 @@ import com.comphenix.protocol.injector.packet.PacketRegistry; import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; /** * Represents a packet listener with useful constructors. diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java index 05f95f97..02ef0eeb 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java @@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Nullable; -import net.minecraft.util.com.google.common.collect.Sets; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; @@ -75,6 +74,7 @@ import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; public final class PacketFilterManager implements ProtocolManager, ListenerInvoker, InternalManager { 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 892a1c04..66798a80 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 @@ -6,8 +6,8 @@ import java.util.concurrent.Callable; import com.comphenix.protocol.reflect.FuzzyReflection; import com.comphenix.protocol.reflect.FuzzyReflection.FieldAccessor; +import com.google.common.collect.Maps; -import net.minecraft.util.com.google.common.collect.Maps; import net.minecraft.util.io.netty.buffer.ByteBufAllocator; import net.minecraft.util.io.netty.channel.Channel; import net.minecraft.util.io.netty.channel.ChannelConfig; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java index 9b93a0b3..47509f8b 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java @@ -30,13 +30,12 @@ import java.util.Map; import java.util.Set; import java.util.regex.Pattern; -import net.minecraft.util.com.google.common.base.Joiner; -import net.minecraft.util.com.google.common.collect.Sets; - import com.comphenix.protocol.reflect.fuzzy.AbstractFuzzyMatcher; import com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract; +import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; /** * Retrieves fields and methods by signature, not just name. diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java index 0dd50d75..1752c87c 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java @@ -19,7 +19,7 @@ package com.comphenix.protocol.reflect; import java.lang.reflect.Field; -import net.minecraft.util.com.google.common.base.Objects; +import com.google.common.base.Objects; /** * Represents a field that will revert to its original state when this class is garbaged collected. diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java index 645be3c6..9d22d4bf 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java @@ -2,9 +2,8 @@ package com.comphenix.protocol.wrappers.nbt; import java.util.Map; -import net.minecraft.util.com.google.common.collect.Maps; - import com.comphenix.protocol.reflect.StructureModifier; +import com.google.common.collect.Maps; public abstract class NameProperty { private static final Map, StructureModifier> MODIFIERS = Maps.newConcurrentMap(); 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 47317ed6..b2473478 100644 --- a/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java +++ b/ProtocolLib/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java @@ -3,14 +3,13 @@ package com.comphenix.protocol.utility; import static org.junit.Assert.*; import net.minecraft.server.v1_7_R1.NBTCompressedStreamTools; -import net.minecraft.util.com.google.common.collect.Maps; -import net.minecraft.util.com.mojang.authlib.GameProfile; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import com.comphenix.protocol.BukkitInitialization; +import com.google.common.collect.Maps; public class MinecraftReflectionTest { @BeforeClass