From b4c0cc5a27086d2f44e8b12a9a1b60bfd2ab0cf4 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 19 Mar 2016 16:01:38 -0400 Subject: [PATCH] Split API off into a separate module --- .travis.yml | 4 +- ProtocolLib/.gitignore | 167 ---- .../protocol/compat/guava/Guava.java | 67 -- .../protocol/compat/guava/Guava17.java | 76 -- .../protocol/compat/guava/GuavaCompat.java | 38 - .../compat/netty/ChannelInjector.java | 28 - .../compat/netty/LegacyProtocolRegistry.java | 103 -- .../protocol/compat/netty/Netty.java | 99 -- .../protocol/compat/netty/NettyCompat.java | 55 -- .../compat/netty/ProtocolInjector.java | 38 - .../protocol/compat/netty/WrappedByteBuf.java | 46 - .../protocol/compat/netty/WrappedChannel.java | 26 - .../netty/independent/IndependentNetty.java | 105 -- .../netty/independent/NettyByteBuf.java | 83 -- .../netty/independent/NettyChannel.java | 38 - modules/{v1_7_R4 => API}/pom.xml | 124 +-- .../protocol/AsynchronousManager.java | 0 .../com/comphenix/protocol/PacketStream.java | 0 .../com/comphenix/protocol/PacketType.java | 2 +- .../comphenix/protocol/PacketTypeLookup.java | 0 .../java/com/comphenix/protocol/Packets.java | 50 +- .../comphenix/protocol/ProtocolConfig.java | 2 +- .../comphenix/protocol/ProtocolLibrary.java | 96 ++ .../comphenix/protocol/ProtocolManager.java | 3 + .../protocol/async/AsyncFilterManager.java | 5 +- .../protocol/async/AsyncListenerHandler.java | 0 .../comphenix/protocol/async/AsyncMarker.java | 0 .../protocol/async/AsyncRunnable.java | 0 .../protocol/async/NullPacketListener.java | 0 .../protocol/async/PacketEventHolder.java | 0 .../protocol/async/PacketProcessingQueue.java | 0 .../protocol/async/PacketSendingQueue.java | 0 .../protocol/async/PlayerSendingHandler.java | 0 .../protocol/async/Synchronization.java | 0 .../protocol/collections/ExpireHashMap.java | 0 .../protocol/collections/IntegerMap.java | 0 .../AbstractConcurrentListenerMultimap.java | 0 .../concurrency/AbstractIntervalTree.java | 3 +- .../protocol/concurrency/BlockingHashMap.java | 0 .../concurrency/ConcurrentPlayerMap.java | 0 .../protocol/concurrency/IntegerSet.java | 0 .../protocol/concurrency/PacketTypeSet.java | 0 .../concurrency/SortedCopyOnWriteArray.java | 0 .../protocol/error/BasicErrorReporter.java | 0 .../error/DelegatedErrorReporter.java | 0 .../protocol/error/DetailedErrorReporter.java | 0 .../protocol/error/ErrorReporter.java | 0 .../protocol/error/PluginContext.java | 0 .../com/comphenix/protocol/error/Report.java | 0 .../comphenix/protocol/error/ReportType.java | 0 .../protocol/error/RethrowErrorReporter.java | 0 .../protocol/events/ConnectionSide.java | 0 .../protocol/events/ListenerOptions.java | 1 + .../protocol/events/ListenerPriority.java | 0 .../protocol/events/ListeningWhitelist.java | 0 .../protocol/events/MonitorAdapter.java | 0 .../protocol/events/NetworkMarker.java | 0 .../protocol/events/PacketAdapter.java | 0 .../protocol/events/PacketContainer.java | 24 +- .../protocol/events/PacketEvent.java | 4 +- .../protocol/events/PacketListener.java | 0 .../protocol/events/PacketOutputAdapter.java | 0 .../protocol/events/PacketOutputHandler.java | 0 .../protocol/events/PacketPostAdapter.java | 0 .../protocol/events/PacketPostListener.java | 0 .../protocol/events/ScheduledPacket.java | 0 .../events/SerializedOfflinePlayer.java | 0 .../protocol/injector/BukkitUnwrapper.java | 0 .../protocol/injector/GamePhase.java | 0 .../protocol/injector/PacketConstructor.java | 0 .../protocol/injector/PlayerInjectHooks.java | 31 + .../injector/PlayerLoggedOutException.java | 0 .../injector/PrioritizedListener.java | 0 .../injector/SortedPacketListenerList.java | 0 .../protocol/injector/StructureCache.java | 0 .../injector/netty}/NettyByteBufAdapter.java | 2 +- .../netty}/NettyProtocolRegistry.java | 2 +- .../injector/netty/ProtocolRegistry.java | 0 .../protocol/injector/netty/WirePacket.java | 6 +- .../injector/packet/MapContainer.java | 0 .../injector/packet/PacketRegistry.java | 223 ++--- .../protocol/reflect/ClassAnalyser.java | 0 .../protocol/reflect/EquivalentConverter.java | 0 .../protocol/reflect/ExactReflection.java | 0 .../reflect/FieldAccessException.java | 0 .../protocol/reflect/FieldUtils.java | 0 .../protocol/reflect/FuzzyReflection.java | 0 .../comphenix/protocol/reflect/IntEnum.java | 0 .../protocol/reflect/MethodInfo.java | 0 .../protocol/reflect/MethodUtils.java | 0 .../protocol/reflect/ObjectEnum.java | 0 .../protocol/reflect/ObjectWriter.java | 0 .../protocol/reflect/PrettyPrinter.java | 0 .../protocol/reflect/StructureModifier.java | 0 .../protocol/reflect/VolatileField.java | 0 .../protocol/reflect/accessors/Accessors.java | 0 .../accessors/ConstructorAccessor.java | 0 .../accessors/DefaultConstrutorAccessor.java | 0 .../accessors/DefaultFieldAccessor.java | 0 .../accessors/DefaultMethodAccessor.java | 0 .../reflect/accessors/FieldAccessor.java | 0 .../reflect/accessors/MethodAccessor.java | 0 .../accessors/ReadOnlyFieldAccessor.java | 0 .../reflect/cloning/AggregateCloner.java | 0 .../reflect/cloning/BukkitCloner.java | 0 .../protocol/reflect/cloning/Cloner.java | 0 .../reflect/cloning/CollectionCloner.java | 0 .../protocol/reflect/cloning/FieldCloner.java | 0 .../reflect/cloning/ImmutableDetector.java | 0 .../reflect/cloning/NullableCloner.java | 0 .../reflect/cloning/OptionalCloner.java | 0 .../reflect/cloning/SerializableCloner.java | 0 .../reflect/compiler/BackgroundCompiler.java | 0 .../reflect/compiler/BoxingHelper.java | 0 .../reflect/compiler/CompileListener.java | 0 .../compiler/CompiledStructureModifier.java | 0 .../reflect/compiler/EmptyClassVisitor.java | 0 .../reflect/compiler/EmptyMethodVisitor.java | 0 .../reflect/compiler/MethodDescriptor.java | 0 .../reflect/compiler/StructureCompiler.java | 0 .../reflect/fuzzy/AbstractFuzzyMatcher.java | 0 .../reflect/fuzzy/AbstractFuzzyMember.java | 0 .../reflect/fuzzy/ClassExactMatcher.java | 0 .../reflect/fuzzy/ClassRegexMatcher.java | 0 .../reflect/fuzzy/ClassSetMatcher.java | 0 .../reflect/fuzzy/FuzzyClassContract.java | 0 .../reflect/fuzzy/FuzzyFieldContract.java | 0 .../protocol/reflect/fuzzy/FuzzyMatchers.java | 0 .../reflect/fuzzy/FuzzyMethodContract.java | 0 .../reflect/instances/BannedGenerator.java | 0 .../instances/CollectionGenerator.java | 0 .../reflect/instances/DefaultInstances.java | 0 .../reflect/instances/ExistingGenerator.java | 0 .../reflect/instances/InstanceProvider.java | 0 .../instances/NotConstructableException.java | 0 .../reflect/instances/PrimitiveGenerator.java | 0 .../protocol/timing/HistogramStream.java | 0 .../protocol/timing/OnlineComputation.java | 0 .../protocol/timing/StatisticsStream.java | 0 .../protocol/timing/TimedListenerManager.java | 0 .../protocol/timing/TimedTracker.java | 0 .../timing/TimingReportGenerator.java | 0 .../utility/ByteBufferInputStream.java | 0 .../utility/ByteBufferOutputStream.java | 0 .../protocol/utility/CachedPackage.java | 0 .../protocol/utility/ChatExtensions.java | 0 .../protocol/utility/ClassSource.java | 0 .../comphenix/protocol/utility/Closer.java | 0 .../comphenix/protocol/utility/Constants.java | 0 .../protocol/utility/EnhancerFactory.java | 0 .../comphenix/protocol/utility/HexDumper.java | 0 .../protocol/utility/MinecraftFields.java | 0 .../protocol/utility/MinecraftMethods.java | 11 +- .../utility/MinecraftProtocolVersion.java | 0 .../protocol/utility/MinecraftReflection.java | 0 .../protocol/utility/MinecraftVersion.java | 0 .../protocol/utility/RemappedClassSource.java | 0 .../protocol/utility/SafeCacheBuilder.java | 0 .../protocol/utility/SnapshotVersion.java | 0 .../protocol/utility/StreamSerializer.java | 35 +- .../com/comphenix/protocol/utility/Util.java | 0 .../protocol/utility/WrappedScheduler.java | 0 .../protocol/wrappers/AbstractWrapper.java | 0 .../protocol/wrappers/BlockPosition.java | 0 .../protocol/wrappers/BukkitConverters.java | 0 .../protocol/wrappers/ChunkCoordIntPair.java | 0 .../protocol/wrappers/ChunkPosition.java | 0 .../protocol/wrappers/ComponentConverter.java | 0 .../protocol/wrappers/EnumWrappers.java | 0 .../protocol/wrappers/GuavaReflection.java | 0 .../protocol/wrappers/GuavaWrappers.java | 0 .../protocol/wrappers/MinecraftKey.java | 0 .../wrappers/MultiBlockChangeInfo.java | 0 .../protocol/wrappers/PlayerInfoData.java | 0 .../protocol/wrappers/TroveWrapper.java | 0 .../protocol/wrappers/WrappedAttribute.java | 0 .../wrappers/WrappedAttributeModifier.java | 0 .../protocol/wrappers/WrappedBlockData.java | 0 .../wrappers/WrappedChatComponent.java | 0 .../wrappers/WrappedChunkCoordinate.java | 0 .../protocol/wrappers/WrappedDataWatcher.java | 0 .../protocol/wrappers/WrappedGameProfile.java | 0 .../protocol/wrappers/WrappedIntHashMap.java | 0 .../protocol/wrappers/WrappedServerPing.java | 12 +- .../wrappers/WrappedSignedProperty.java | 0 .../protocol/wrappers/WrappedStatistic.java | 0 .../wrappers/WrappedWatchableObject.java | 0 .../collection/AbstractConverted.java | 0 .../wrappers/collection/BiFunction.java | 0 .../wrappers/collection/CachedCollection.java | 0 .../wrappers/collection/CachedSet.java | 0 .../collection/ConvertedCollection.java | 0 .../wrappers/collection/ConvertedList.java | 0 .../wrappers/collection/ConvertedMap.java | 0 .../collection/ConvertedMultimap.java | 0 .../wrappers/collection/ConvertedSet.java | 0 .../protocol/wrappers/nbt/MemoryElement.java | 0 .../protocol/wrappers/nbt/NameProperty.java | 0 .../protocol/wrappers/nbt/NbtBase.java | 0 .../protocol/wrappers/nbt/NbtCompound.java | 0 .../protocol/wrappers/nbt/NbtFactory.java | 0 .../protocol/wrappers/nbt/NbtList.java | 0 .../protocol/wrappers/nbt/NbtType.java | 0 .../protocol/wrappers/nbt/NbtVisitor.java | 0 .../protocol/wrappers/nbt/NbtWrapper.java | 0 .../wrappers/nbt/TileEntityAccessor.java | 0 .../wrappers/nbt/WrappedCompound.java | 0 .../protocol/wrappers/nbt/WrappedElement.java | 0 .../protocol/wrappers/nbt/WrappedList.java | 0 .../wrappers/nbt/io/NbtBinarySerializer.java | 0 .../nbt/io/NbtConfigurationSerializer.java | 0 .../wrappers/nbt/io/NbtTextSerializer.java | 0 modules/ItemDisguise/pom.xml | 78 -- .../HideEnchantmentsListener.java | 111 --- .../itemdisguise/ItemDisguiseMod.java | 92 -- modules/ItemDisguise/src/main/java/plugin.yml | 14 - {ProtocolLib => modules/ProtocolLib}/pom.xml | 11 +- .../com/comphenix/protocol/Application.java | 0 .../protocol/CleanupStaticMembers.java | 0 .../com/comphenix/protocol/CommandBase.java | 0 .../com/comphenix/protocol/CommandFilter.java | 0 .../com/comphenix/protocol/CommandPacket.java | 0 .../comphenix/protocol/CommandProtocol.java | 0 .../protocol/MultipleLinesPrompt.java | 0 .../comphenix/protocol/PacketTypeParser.java | 7 +- .../com/comphenix/protocol/ProtocolLib.java | 31 +- .../com/comphenix/protocol/RangeParser.java | 11 +- .../injector/DelayedPacketManager.java | 14 +- .../protocol/injector/DelayedSingleTask.java | 0 .../protocol/injector/EntityUtilities.java | 0 .../protocol/injector/InternalManager.java | 1 - .../protocol/injector/ListenerInvoker.java | 0 .../protocol/injector/LoginPackets.java | 0 .../protocol/injector/NetworkProcessor.java | 0 .../injector/PacketFilterBuilder.java | 0 .../injector/PacketFilterManager.java | 43 +- .../protocol/injector/PluginVerifier.java | 0 .../injector/netty/BootstrapList.java | 6 +- .../injector/netty/ChannelInjector.java | 50 +- .../injector/netty/ChannelListener.java | 0 .../protocol/injector/netty/ChannelProxy.java | 12 +- .../injector/netty/ClosedInjector.java | 0 .../injector/netty/EventLoopProxy.java | 4 +- .../injector/netty/InjectionFactory.java | 21 +- .../protocol/injector/netty/Injector.java | 0 .../injector/netty/NettyNetworkMarker.java | 0 .../injector/netty/PipelineProxy.java | 6 +- .../injector/netty/ProtocolInjector.java | 37 +- .../injector/netty/SocketAdapter.java | 12 +- .../injector/packet/CaptureInputStream.java | 0 .../injector/packet/InterceptWritePacket.java | 0 .../protocol/injector/packet/InverseMaps.java | 0 .../injector/packet/LegacyNetworkMarker.java | 26 +- .../injector/packet/LegacyPacketRegistry.java | 0 .../injector/packet/PacketInjector.java | 0 .../packet/PacketInjectorBuilder.java | 0 .../injector/packet/ProxyPacketInjector.java | 0 .../injector/packet/ReadPacketModifier.java | 0 .../injector/packet/WritePacketModifier.java | 0 .../injector/player/InjectedArrayList.java | 0 .../player/InjectedServerConnection.java | 0 .../injector/player/NetLoginInjector.java | 0 .../injector/player/NetworkFieldInjector.java | 2 +- .../player/NetworkObjectInjector.java | 2 +- .../player/NetworkServerInjector.java | 2 +- .../player/PlayerInjectionHandler.java | 7 +- .../injector/player/PlayerInjector.java | 2 +- .../player/PlayerInjectorBuilder.java | 0 .../player/ProxyPlayerInjectionHandler.java | 7 +- .../injector/player/ReplacedArrayList.java | 0 .../injector/player/UnsupportedListener.java | 0 .../server/AbstractInputStreamLookup.java | 0 .../injector/server/BukkitSocketInjector.java | 0 .../injector/server/InjectorContainer.java | 0 .../server/InputStreamLookupBuilder.java | 0 .../server/InputStreamReflectLookup.java | 0 .../injector/server/QueuedSendPacket.java | 0 .../injector/server/SocketInjector.java | 0 .../server/TemporaryPlayerFactory.java | 0 .../spigot/AbstractPacketInjector.java | 0 .../spigot/AbstractPlayerHandler.java | 2 +- .../injector/spigot/DummyPacketInjector.java | 0 .../injector/spigot/DummyPlayerHandler.java | 5 +- .../injector/spigot/SpigotPacketInjector.java | 0 .../injector/spigot/SpigotPacketListener.java | 0 .../comphenix/protocol/metrics/Metrics.java | 0 .../protocol/metrics/Statistics.java | 0 .../com/comphenix/protocol/package-info.java | 0 .../protocol/updater/BukkitUpdater.java | 0 .../protocol/updater/SpigotUpdater.java | 4 +- .../comphenix/protocol/updater/Updater.java | 8 +- .../protocol/SimpleCraftBukkitITCase.java | 2 +- .../protocol/SimpleMinecraftClient.java | 1 - .../integration/protocol/TestPingPacket.java | 0 .../protocol/BukkitInitialization.java | 0 .../protocol/MinecraftVersionTest.java | 0 .../comphenix/protocol/PacketTypeTest.java | 2 +- .../concurrency/BlockingHashMapTest.java | 0 .../protocol/events/PacketContainerTest.java | 0 .../protocol/injector/PluginVerifierTest.java | 0 .../injector/SortedCopyOnWriteArrayTest.java | 0 .../reflect/accessors/AccessorsTest.java | 0 .../reflect/cloning/AggregateClonerTest.java | 0 .../protocol/updater/UpdaterTest.java | 0 .../utility/MinecraftMethodsTest.java | 0 .../utility/MinecraftReflectionTest.java | 0 .../protocol/utility/SnapshotVersionTest.java | 0 .../utility/StreamSerializerTest.java | 0 .../wrappers/ChunkCoordIntPairTest.java | 0 .../protocol/wrappers/CloningTest.java | 0 .../protocol/wrappers/EnumWrappersTest.java | 0 .../wrappers/MultiBlockChangeTest.java | 0 .../protocol/wrappers/PlayerInfoDataTest.java | 0 .../wrappers/WrappedAttributeTest.java | 0 .../wrappers/WrappedBlockDataTest.java | 0 .../wrappers/WrappedChatComponentTest.java | 0 .../wrappers/WrappedDataWatcherTest.java | 0 .../wrappers/WrappedGameProfileTest.java | 0 .../wrappers/WrappedIntHashMapTest.java | 0 .../wrappers/WrappedServerPingTest.java | 0 .../wrappers/WrappedWatchableObjectTest.java | 0 .../wrappers/nbt/NbtCompoundTest.java | 0 .../protocol/wrappers/nbt/NbtFactoryTest.java | 0 .../io/NbtConfigurationSerializerTest.java | 0 .../ProtocolLib}/src/test/resources/tux.png | Bin .../protocol/compat/guava/Guava10.java | 78 -- .../netty/shaded/ShadedBootstrapList.java | 234 ----- .../compat/netty/shaded/ShadedByteBuf.java | 83 -- .../netty/shaded/ShadedByteBufAdapter.java | 393 -------- .../compat/netty/shaded/ShadedChannel.java | 38 - .../netty/shaded/ShadedChannelInjector.java | 931 ------------------ .../netty/shaded/ShadedChannelProxy.java | 334 ------- .../netty/shaded/ShadedEventLoopProxy.java | 259 ----- .../netty/shaded/ShadedInjectionFactory.java | 239 ----- .../compat/netty/shaded/ShadedNetty.java | 105 -- .../netty/shaded/ShadedPipelineProxy.java | 371 ------- .../netty/shaded/ShadedProtocolInjector.java | 438 -------- .../netty/shaded/ShadedSocketAdapter.java | 265 ----- pom.xml | 6 +- .../src => src}/main/resources/config.yml | 0 .../src => src}/main/resources/plugin.yml | 0 341 files changed, 462 insertions(+), 5554 deletions(-) delete mode 100644 ProtocolLib/.gitignore delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava17.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/GuavaCompat.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ChannelInjector.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/LegacyProtocolRegistry.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/Netty.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/NettyCompat.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ProtocolInjector.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedByteBuf.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedChannel.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBuf.java delete mode 100644 ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannel.java rename modules/{v1_7_R4 => API}/pom.xml (69%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/AsynchronousManager.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/PacketStream.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/PacketType.java (99%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/PacketTypeLookup.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/Packets.java (83%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/ProtocolConfig.java (99%) create mode 100644 modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/ProtocolManager.java (98%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java (98%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/AsyncListenerHandler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/AsyncMarker.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/AsyncRunnable.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/NullPacketListener.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/PacketProcessingQueue.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/PacketSendingQueue.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/PlayerSendingHandler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/async/Synchronization.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/collections/ExpireHashMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/collections/IntegerMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/AbstractConcurrentListenerMultimap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java (99%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/BlockingHashMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/ConcurrentPlayerMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/IntegerSet.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/BasicErrorReporter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/DelegatedErrorReporter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/ErrorReporter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/PluginContext.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/Report.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/ReportType.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/error/RethrowErrorReporter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/ConnectionSide.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/ListenerOptions.java (99%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/ListenerPriority.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/ListeningWhitelist.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/MonitorAdapter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/NetworkMarker.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketAdapter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketContainer.java (98%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketEvent.java (99%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketListener.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketOutputAdapter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketOutputHandler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketPostAdapter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/PacketPostListener.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/ScheduledPacket.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/events/SerializedOfflinePlayer.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/BukkitUnwrapper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/GamePhase.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/PacketConstructor.java (100%) create mode 100644 modules/API/src/main/java/com/comphenix/protocol/injector/PlayerInjectHooks.java rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/PlayerLoggedOutException.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/PrioritizedListener.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/SortedPacketListenerList.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/StructureCache.java (100%) rename {ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent => modules/API/src/main/java/com/comphenix/protocol/injector/netty}/NettyByteBufAdapter.java (99%) rename {ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent => modules/API/src/main/java/com/comphenix/protocol/injector/netty}/NettyProtocolRegistry.java (96%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/netty/ProtocolRegistry.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java (86%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/packet/MapContainer.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java (62%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/ClassAnalyser.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/ExactReflection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/FieldAccessException.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/FieldUtils.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/IntEnum.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/MethodInfo.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/MethodUtils.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/ObjectEnum.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/ObjectWriter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/PrettyPrinter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/VolatileField.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/Accessors.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/ConstructorAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultConstrutorAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultMethodAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/FieldAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/MethodAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/accessors/ReadOnlyFieldAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/AggregateCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/BukkitCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/Cloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/CollectionCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/FieldCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/ImmutableDetector.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/NullableCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/OptionalCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/cloning/SerializableCloner.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/BackgroundCompiler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/CompileListener.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyClassVisitor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyMethodVisitor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/MethodDescriptor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMatcher.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMember.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassExactMatcher.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassRegexMatcher.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassSetMatcher.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyClassContract.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyFieldContract.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMatchers.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMethodContract.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/BannedGenerator.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/InstanceProvider.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/NotConstructableException.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/HistogramStream.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/OnlineComputation.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/StatisticsStream.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/TimedListenerManager.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/TimedTracker.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/ByteBufferInputStream.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/ByteBufferOutputStream.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/CachedPackage.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/ChatExtensions.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/ClassSource.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/Closer.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/Constants.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/EnhancerFactory.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/HexDumper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/MinecraftFields.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java (95%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/MinecraftProtocolVersion.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/RemappedClassSource.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/SafeCacheBuilder.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/SnapshotVersion.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java (95%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/Util.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/utility/WrappedScheduler.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/AbstractWrapper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/ChunkCoordIntPair.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/ChunkPosition.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/ComponentConverter.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/GuavaReflection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/MultiBlockChangeInfo.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/TroveWrapper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedAttribute.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedBlockData.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedChunkCoordinate.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedIntHashMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java (98%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedStatistic.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/AbstractConverted.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/BiFunction.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/CachedCollection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/CachedSet.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedCollection.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedList.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMultimap.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedSet.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/MemoryElement.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtBase.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtCompound.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtList.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtType.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtVisitor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtWrapper.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/TileEntityAccessor.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedCompound.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedElement.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedList.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtBinarySerializer.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializer.java (100%) rename {ProtocolLib => modules/API}/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java (100%) delete mode 100644 modules/ItemDisguise/pom.xml delete mode 100644 modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/HideEnchantmentsListener.java delete mode 100644 modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/ItemDisguiseMod.java delete mode 100644 modules/ItemDisguise/src/main/java/plugin.yml rename {ProtocolLib => modules/ProtocolLib}/pom.xml (96%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/Application.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/CleanupStaticMembers.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/CommandBase.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/CommandFilter.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/CommandPacket.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/CommandProtocol.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/MultipleLinesPrompt.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/PacketTypeParser.java (93%) rename ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLib.java (96%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/RangeParser.java (92%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/DelayedPacketManager.java (97%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/DelayedSingleTask.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/InternalManager.java (94%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/ListenerInvoker.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/LoginPackets.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/NetworkProcessor.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/PacketFilterBuilder.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java (97%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/PluginVerifier.java (100%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyBootstrapList.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/BootstrapList.java (96%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelInjector.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java (93%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/netty/ChannelListener.java (100%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelProxy.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelProxy.java (96%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/netty/ClosedInjector.java (100%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyEventLoopProxy.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/EventLoopProxy.java (98%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyInjectionFactory.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/InjectionFactory.java (88%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/netty/Injector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/netty/NettyNetworkMarker.java (100%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyPipelineProxy.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/PipelineProxy.java (93%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyProtocolInjector.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ProtocolInjector.java (90%) rename ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettySocketAdapter.java => modules/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/SocketAdapter.java (95%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/CaptureInputStream.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/InterceptWritePacket.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/InverseMaps.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/LegacyNetworkMarker.java (63%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/LegacyPacketRegistry.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/PacketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/PacketInjectorBuilder.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/ProxyPacketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/ReadPacketModifier.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/packet/WritePacketModifier.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/InjectedArrayList.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/InjectedServerConnection.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/NetLoginInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/NetworkFieldInjector.java (98%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/NetworkObjectInjector.java (98%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/NetworkServerInjector.java (99%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/PlayerInjectionHandler.java (97%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/PlayerInjector.java (99%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/PlayerInjectorBuilder.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/ProxyPlayerInjectionHandler.java (99%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/ReplacedArrayList.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/player/UnsupportedListener.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/AbstractInputStreamLookup.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/BukkitSocketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/InjectorContainer.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/InputStreamLookupBuilder.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/InputStreamReflectLookup.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/QueuedSendPacket.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/SocketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/server/TemporaryPlayerFactory.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/AbstractPacketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/AbstractPlayerHandler.java (96%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/DummyPacketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/DummyPlayerHandler.java (95%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/SpigotPacketInjector.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/injector/spigot/SpigotPacketListener.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/metrics/Metrics.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/metrics/Statistics.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/package-info.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/updater/BukkitUpdater.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/updater/SpigotUpdater.java (94%) rename {ProtocolLib => modules/ProtocolLib}/src/main/java/com/comphenix/protocol/updater/Updater.java (94%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/integration/protocol/SimpleCraftBukkitITCase.java (99%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/integration/protocol/SimpleMinecraftClient.java (99%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/integration/protocol/TestPingPacket.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/BukkitInitialization.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/MinecraftVersionTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/PacketTypeTest.java (94%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/concurrency/BlockingHashMapTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/injector/PluginVerifierTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/injector/SortedCopyOnWriteArrayTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/reflect/accessors/AccessorsTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/reflect/cloning/AggregateClonerTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/updater/UpdaterTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/utility/MinecraftMethodsTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/utility/SnapshotVersionTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/utility/StreamSerializerTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/ChunkCoordIntPairTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/CloningTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/MultiBlockChangeTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/PlayerInfoDataTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedAttributeTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedBlockDataTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedChatComponentTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedDataWatcherTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedGameProfileTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedIntHashMapTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedServerPingTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/WrappedWatchableObjectTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtCompoundTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/nbt/NbtFactoryTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializerTest.java (100%) rename {ProtocolLib => modules/ProtocolLib}/src/test/resources/tux.png (100%) delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/guava/Guava10.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedBootstrapList.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedByteBuf.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedByteBufAdapter.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedChannel.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedChannelInjector.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedChannelProxy.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedEventLoopProxy.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedInjectionFactory.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedNetty.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedPipelineProxy.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedProtocolInjector.java delete mode 100644 modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedSocketAdapter.java rename {ProtocolLib/src => src}/main/resources/config.yml (100%) rename {ProtocolLib/src => src}/main/resources/plugin.yml (100%) diff --git a/.travis.yml b/.travis.yml index 0912103c..5b0372e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: java jdk: - oraclejdk8 - oraclejdk7 -script: mvn clean test -U -before_install: cd ProtocolLib +script: mvn clean test +#before_install: cd ProtocolLib install: true notifications: email: diff --git a/ProtocolLib/.gitignore b/ProtocolLib/.gitignore deleted file mode 100644 index fdd8d4c3..00000000 --- a/ProtocolLib/.gitignore +++ /dev/null @@ -1,167 +0,0 @@ -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath -target/ -.gitignore - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store -/target -/target diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava.java deleted file mode 100644 index fdacf25f..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.guava; - -import java.io.DataInputStream; -import java.util.Set; -import java.util.logging.Level; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.google.common.collect.Range; - -/** - * @author dmulloy2 - */ - -public class Guava { - private static GuavaCompat compat; - - static { - try { - Range.closed(1, 2); - compat = new Guava17(); - } catch (Throwable ex) { - try { - Class clazz = Class.forName("com.comphenix.protocol.compat.guava.Guava10"); - compat = (GuavaCompat) clazz.newInstance(); - } catch (Throwable ex1) { - ProtocolLibrary.log(Level.SEVERE, "Failed to create Guava 10 compat:", ex1); - } - } - } - - private static GuavaCompat getCompat() { - return compat; - } - - public static > Range closedRange(C lower, C upper) { - return getCompat().closedRange(lower, upper); - } - - public static > Range singleton(C singleton) { - return getCompat().singletonRange(singleton); - } - - public static Set toSet(Range range) { - return getCompat().toSet(range); - } - - public static DataInputStream addHeader(DataInputStream input, PacketType type) { - return getCompat().addHeader(input, type); - } -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava17.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava17.java deleted file mode 100644 index 2c7bbb54..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/Guava17.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.guava; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Set; - -import com.comphenix.protocol.PacketType; -import com.google.common.collect.ContiguousSet; -import com.google.common.collect.DiscreteDomain; -import com.google.common.collect.Range; -import com.google.common.io.ByteSource; - -/** - * @author dmulloy2 - */ - -public class Guava17 implements GuavaCompat { - - @Override - public > Range closedRange(C lower, C upper) { - return Range.closed(lower, upper); - } - - @Override - public > Range singletonRange(C singleton) { - return Range.singleton(singleton); - } - - @Override - public Set toSet(Range range) { - return ContiguousSet.create(range, DiscreteDomain.integers()); - } - - @Override - public DataInputStream addHeader(final DataInputStream input, final PacketType type) { - ByteSource header = new ByteSource() { - @Override - public InputStream openStream() throws IOException { - byte[] data = new byte[] { (byte) type.getLegacyId() }; - return new ByteArrayInputStream(data); - } - }; - - ByteSource data = new ByteSource() { - @Override - public InputStream openStream() throws IOException { - return input; - } - }; - - // Combine them into a single stream - try { - return new DataInputStream(ByteSource.concat(header, data).openStream()); - } catch (IOException e) { - throw new RuntimeException("Cannot add header.", e); - } - } -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/GuavaCompat.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/GuavaCompat.java deleted file mode 100644 index a247cfb1..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/guava/GuavaCompat.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.guava; - -import java.io.DataInputStream; -import java.util.Set; - -import com.comphenix.protocol.PacketType; -import com.google.common.collect.Range; - -/** - * @author dmulloy2 - */ - -public interface GuavaCompat { - - > Range closedRange(C lower, C upper); - - > Range singletonRange(C singleton); - - Set toSet(Range range); - - DataInputStream addHeader(DataInputStream input, PacketType type); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ChannelInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ChannelInjector.java deleted file mode 100644 index 8311fb41..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ChannelInjector.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import com.comphenix.protocol.injector.netty.Injector; - -/** - * @author dmulloy2 - */ - -public interface ChannelInjector extends Injector { - - WrappedChannel getChannel(); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/LegacyProtocolRegistry.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/LegacyProtocolRegistry.java deleted file mode 100644 index f78ff44b..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/LegacyProtocolRegistry.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.PacketType.Protocol; -import com.comphenix.protocol.PacketType.Sender; -import com.comphenix.protocol.injector.netty.ProtocolRegistry; -import com.comphenix.protocol.injector.packet.MapContainer; -import com.comphenix.protocol.reflect.StructureModifier; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -/** - * @author dmulloy2 - */ - -public class LegacyProtocolRegistry extends ProtocolRegistry { - - public LegacyProtocolRegistry() { - super(); - } - - @Override - protected void initialize() { - final Object[] protocols = enumProtocol.getEnumConstants(); - List>> serverMaps = Lists.newArrayList(); - List>> clientMaps = Lists.newArrayList(); - StructureModifier modifier = null; - - // Result - Register result = new Register(); - - for (Object protocol : protocols) { - if (modifier == null) - modifier = new StructureModifier(protocol.getClass().getSuperclass(), false); - StructureModifier>> maps = modifier.withTarget(protocol).withType(Map.class); - - serverMaps.add(maps.read(0)); - clientMaps.add(maps.read(1)); - } - // Maps we have to occationally check have changed - for (Map> map : Iterables.concat(serverMaps, clientMaps)) { - result.containers.add(new MapContainer(map)); - } - - // Heuristic - there are more server packets than client packets - if (sum(clientMaps) > sum(serverMaps)) { - // Swap if this is violated - List>> temp = serverMaps; - serverMaps = clientMaps; - clientMaps = temp; - } - - for (int i = 0; i < protocols.length; i++) { - Enum enumProtocol = (Enum) protocols[i]; - Protocol equivalent = Protocol.fromVanilla(enumProtocol); - - // Associate known types - associatePackets(result, serverMaps.get(i), equivalent, Sender.SERVER); - associatePackets(result, clientMaps.get(i), equivalent, Sender.CLIENT); - } - - // Exchange (thread safe, as we have only one writer) - this.register = result; - } - - @Override - protected void associatePackets(Register register, Map> lookup, Protocol protocol, Sender sender) { - for (Entry> entry : lookup.entrySet()) { - PacketType type = PacketType.fromID(protocol, sender, entry.getKey(), entry.getValue()); - - try { - register.typeToClass.put(type, entry.getValue()); - - if (sender == Sender.SERVER) - register.serverPackets.add(type); - if (sender == Sender.CLIENT) - register.clientPackets.add(type); - } catch (IllegalArgumentException ex) { - // Sometimes this happens with fake packets, just ignore it - } - } - } -} diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/Netty.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/Netty.java deleted file mode 100644 index 32548234..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/Netty.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.util.logging.Level; - -import org.bukkit.plugin.Plugin; - -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.compat.netty.independent.IndependentNetty; -import com.comphenix.protocol.error.ErrorReporter; -import com.comphenix.protocol.injector.PacketFilterManager; -import com.comphenix.protocol.wrappers.WrappedServerPing.CompressedImage; - -/** - * @author dmulloy2 - */ - -public class Netty { - private static NettyCompat compat; - - static { - try { - Class.forName("io.netty.buffer.ByteBuf"); - compat = new IndependentNetty(); - } catch (ClassNotFoundException ex) { - try { - Class clazz = Class.forName("com.comphenix.protocol.compat.netty.shaded.ShadedNetty"); - compat = (NettyCompat) clazz.newInstance(); - } catch (Exception ex1) { - ProtocolLibrary.log(Level.SEVERE, "Failed to create legacy netty compat:", ex1); - } - } - } - - private static NettyCompat getCompat() { - return compat; - } - - public static boolean isIndependent() { - return compat instanceof IndependentNetty; - } - - public static WrappedByteBuf createPacketBuffer() { - return getCompat().createPacketBuffer(); - } - - public static Class getGenericFutureListenerArray() { - return getCompat().getGenericFutureListenerArray(); - } - - public static Class getChannelHandlerContext() { - return getCompat().getChannelHandlerContext(); - } - - public static String toEncodedText(CompressedImage image) { - return getCompat().toEncodedText(image); - } - - public static WrappedByteBuf decode(byte[] encoded) { - return getCompat().decode(encoded); - } - - public static ProtocolInjector getProtocolInjector(Plugin library, PacketFilterManager packetFilterManager, ErrorReporter reporter) { - return getCompat().getProtocolInjector(library, packetFilterManager, reporter); - } - - public static WrappedByteBuf packetReader(DataInputStream input) { - return getCompat().packetReader(input); - } - - public static WrappedByteBuf packetWriter(DataOutputStream output) { - return getCompat().packetWriter(output); - } - - public static WrappedByteBuf copiedBuffer(byte[] array) { - return getCompat().copiedBuffer(array); - } - - public static WrappedByteBuf buffer() { - return getCompat().buffer(); - } -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/NettyCompat.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/NettyCompat.java deleted file mode 100644 index b9e40c01..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/NettyCompat.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import java.io.DataInputStream; -import java.io.DataOutputStream; - -import org.bukkit.plugin.Plugin; - -import com.comphenix.protocol.error.ErrorReporter; -import com.comphenix.protocol.injector.ListenerInvoker; -import com.comphenix.protocol.wrappers.WrappedServerPing.CompressedImage; - - -/** - * @author dmulloy2 - */ - -// TODO: Sort out packet readers/writers -public interface NettyCompat { - - WrappedByteBuf createPacketBuffer(); - - WrappedByteBuf copiedBuffer(byte[] array); - - WrappedByteBuf buffer(); - - Class getGenericFutureListenerArray(); - - Class getChannelHandlerContext(); - - String toEncodedText(CompressedImage image); - - WrappedByteBuf decode(byte[] encoded); - - ProtocolInjector getProtocolInjector(Plugin plugin, ListenerInvoker invoker, ErrorReporter reporter); - - WrappedByteBuf packetReader(DataInputStream input); - - WrappedByteBuf packetWriter(DataOutputStream output); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ProtocolInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ProtocolInjector.java deleted file mode 100644 index 6415d17d..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/ProtocolInjector.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import com.comphenix.protocol.injector.netty.ChannelListener; -import com.comphenix.protocol.injector.packet.PacketInjector; -import com.comphenix.protocol.injector.player.PlayerInjectionHandler; - -/** - * @author dmulloy2 - */ - -public interface ProtocolInjector extends ChannelListener { - - PlayerInjectionHandler getPlayerInjector(); - - PacketInjector getPacketInjector(); - - void setDebug(boolean debug); - - void inject(); - - void close(); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedByteBuf.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedByteBuf.java deleted file mode 100644 index 30924b1c..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedByteBuf.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -/** - * @author dmulloy2 - */ - -public interface WrappedByteBuf { - - void writeBytes(ObjectInputStream input, int id) throws IOException; - - Object getHandle(); - - int readableBytes(); - - void readBytes(ObjectOutputStream output, int readableBytes) throws IOException; - - void readBytes(byte[] data); - - void writeByte(byte b); - - void writeByte(int i); - - void writeBytes(byte[] bytes); - - byte[] array(); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedChannel.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedChannel.java deleted file mode 100644 index 648d0fa1..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/WrappedChannel.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty; - -/** - * @author dmulloy2 - */ - -public interface WrappedChannel { - - void writeAndFlush(Object packet); -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java deleted file mode 100644 index 43254048..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty.independent; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.buffer.UnpooledByteBufAllocator; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.base64.Base64; -import io.netty.util.concurrent.GenericFutureListener; - -import java.io.DataInputStream; -import java.io.DataOutputStream; - -import org.bukkit.plugin.Plugin; - -import com.comphenix.protocol.compat.netty.NettyCompat; -import com.comphenix.protocol.compat.netty.ProtocolInjector; -import com.comphenix.protocol.compat.netty.WrappedByteBuf; -import com.comphenix.protocol.error.ErrorReporter; -import com.comphenix.protocol.injector.ListenerInvoker; -import com.comphenix.protocol.utility.MinecraftReflection; -import com.comphenix.protocol.wrappers.WrappedServerPing.CompressedImage; -import com.google.common.base.Charsets; - -/** - * @author dmulloy2 - */ - -public class IndependentNetty implements NettyCompat { - - @Override - public WrappedByteBuf createPacketBuffer() { - ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer(); - Class packetSerializer = MinecraftReflection.getPacketDataSerializerClass(); - - try { - return new NettyByteBuf((ByteBuf) packetSerializer.getConstructor(ByteBuf.class).newInstance(buffer)); - } catch (Exception e) { - throw new RuntimeException("Cannot construct packet serializer.", e); - } - } - - @Override - public Class getGenericFutureListenerArray() { - return GenericFutureListener[].class; - } - - @Override - public Class getChannelHandlerContext() { - return ChannelHandlerContext.class; - } - - @Override - public String toEncodedText(CompressedImage image) { - final ByteBuf buffer = Unpooled.wrappedBuffer(image.getDataCopy()); - String computed = "data:" + image.getMime() + ";base64," + - Base64.encode(buffer).toString(Charsets.UTF_8); - return computed; - } - - @Override - public WrappedByteBuf decode(byte[] encoded) { - return new NettyByteBuf(Base64.decode(Unpooled.wrappedBuffer(encoded))); - } - - @Override - public ProtocolInjector getProtocolInjector(Plugin plugin, ListenerInvoker invoker, ErrorReporter reporter) { - return new NettyProtocolInjector(plugin, invoker, reporter); - } - - @Override - public WrappedByteBuf packetReader(DataInputStream input) { - return new NettyByteBuf(NettyByteBufAdapter.packetReader(input)); - } - - @Override - public WrappedByteBuf packetWriter(DataOutputStream output) { - return new NettyByteBuf(NettyByteBufAdapter.packetWriter(output)); - } - - @Override - public WrappedByteBuf copiedBuffer(byte[] array) { - return new NettyByteBuf(Unpooled.copiedBuffer(array)); - } - - @Override - public WrappedByteBuf buffer() { - return new NettyByteBuf(Unpooled.buffer()); - } -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBuf.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBuf.java deleted file mode 100644 index 564be26f..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBuf.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty.independent; - -import io.netty.buffer.ByteBuf; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.ref.WeakReference; - -import com.comphenix.protocol.compat.netty.WrappedByteBuf; - -/** - * @author dmulloy2 - */ - -public class NettyByteBuf implements WrappedByteBuf { - private WeakReference handle; - - public NettyByteBuf(ByteBuf handle) { - this.handle = new WeakReference(handle); - } - - @Override - public void writeBytes(ObjectInputStream input, int id) throws IOException { - handle.get().writeBytes(input, id); - } - - @Override - public Object getHandle() { - return handle.get(); - } - - @Override - public int readableBytes() { - return handle.get().readableBytes(); - } - - @Override - public void readBytes(ObjectOutputStream output, int readableBytes) throws IOException { - handle.get().readBytes(output, readableBytes); - } - - @Override - public void readBytes(byte[] data) { - handle.get().readBytes(data); - } - - @Override - public void writeByte(byte b) { - handle.get().writeByte(b); - } - - @Override - public void writeByte(int i) { - handle.get().writeByte(i); - } - - @Override - public void writeBytes(byte[] bytes) { - handle.get().writeBytes(bytes); - } - - @Override - public byte[] array() { - return handle.get().array(); - } -} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannel.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannel.java deleted file mode 100644 index dd95f04a..00000000 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannel.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2015 dmulloy2 - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.compat.netty.independent; - -import io.netty.channel.Channel; - -import com.comphenix.protocol.compat.netty.WrappedChannel; - -/** - * @author dmulloy2 - */ - -public class NettyChannel implements WrappedChannel { - private final Channel channel; - - public NettyChannel(Channel channel) { - this.channel = channel; - } - - @Override - public void writeAndFlush(Object packet) { - channel.writeAndFlush(packet); - } -} \ No newline at end of file diff --git a/modules/v1_7_R4/pom.xml b/modules/API/pom.xml similarity index 69% rename from modules/v1_7_R4/pom.xml rename to modules/API/pom.xml index 7ee387f5..d55d7255 100644 --- a/modules/v1_7_R4/pom.xml +++ b/modules/API/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - ProtocolLib-v1_7_R4 - ProtocolLib-v1_7_R4 - 3.7.0-SNAPSHOT + ProtocolLib-API + ProtocolLib-API + 4.0-SNAPSHOT Provides read/write access to the Minecraft protocol. http://www.spigotmc.org/resources/protocollib.1997/ @@ -12,7 +12,7 @@ com.comphenix.protocol ProtocolLib-Parent - v3-SNAPSHOT + v4-SNAPSHOT ../../ @@ -21,13 +21,6 @@ - - - md_5-repo - http://repo.md-5.net/content/groups/public/ - - - clean install src/main/java @@ -43,39 +36,6 @@ - - org.apache.maven.plugins - maven-shade-plugin - 2.4.3 - - - package - - shade - - - false - false - - - - net.sf - com.comphenix.net.sf - - - - - - org.spigotmc:spigot - org.spigotmc:spigot-api - junit:junit - - - - - - - maven-compiler-plugin 3.5.1 @@ -99,40 +59,24 @@ ProtocolLib - ../../target/ - maven-javadoc-plugin - 2.10.3 - - - package - attach-javadocs - - + org.apache.maven.plugins + maven-surefire-plugin + 2.10 - true - - - - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - 2.5.2 - - High - Default + + + projectVersion + ${project.version} + + - + @@ -242,23 +186,25 @@ + org.spigotmc spigot-api - 1.7.10-R0.1-SNAPSHOT + 1.9-R0.1-SNAPSHOT provided org.spigotmc spigot - 1.7.10-R0.1-SNAPSHOT + 1.9-R0.1-SNAPSHOT provided - - com.comphenix.protocol - ProtocolLib - ${project.version} - cglib cglib-nodep @@ -271,5 +217,29 @@ 1.1-SNAPSHOT compile + + junit + junit + 4.10 + test + + + org.mockito + mockito-all + 1.8.4 + test + + + org.powermock + powermock-module-junit4 + 1.5 + test + + + org.powermock + powermock-api-mockito + 1.5 + test + \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/AsynchronousManager.java b/modules/API/src/main/java/com/comphenix/protocol/AsynchronousManager.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/AsynchronousManager.java rename to modules/API/src/main/java/com/comphenix/protocol/AsynchronousManager.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketStream.java b/modules/API/src/main/java/com/comphenix/protocol/PacketStream.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/PacketStream.java rename to modules/API/src/main/java/com/comphenix/protocol/PacketStream.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java b/modules/API/src/main/java/com/comphenix/protocol/PacketType.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java rename to modules/API/src/main/java/com/comphenix/protocol/PacketType.java index 45abe7bf..5989ebb6 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java +++ b/modules/API/src/main/java/com/comphenix/protocol/PacketType.java @@ -844,7 +844,7 @@ public class PacketType implements Serializable, Comparable { }; // Execute in the main thread if possible - if (Bukkit.getServer() == null || Application.isPrimaryThread()) { + if (Bukkit.getServer() == null || Bukkit.isPrimaryThread()) { try { return Futures.immediateFuture(callable.call()); } catch (Exception e) { diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/PacketTypeLookup.java b/modules/API/src/main/java/com/comphenix/protocol/PacketTypeLookup.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/PacketTypeLookup.java rename to modules/API/src/main/java/com/comphenix/protocol/PacketTypeLookup.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/Packets.java b/modules/API/src/main/java/com/comphenix/protocol/Packets.java similarity index 83% rename from ProtocolLib/src/main/java/com/comphenix/protocol/Packets.java rename to modules/API/src/main/java/com/comphenix/protocol/Packets.java index b361ec0b..8610979d 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/Packets.java +++ b/modules/API/src/main/java/com/comphenix/protocol/Packets.java @@ -17,10 +17,6 @@ package com.comphenix.protocol; -import java.util.Set; - -import com.comphenix.protocol.injector.PacketFilterManager; -import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.IntEnum; /** @@ -165,30 +161,7 @@ public final class Packets { public static Server getRegistry() { return INSTANCE; } - - /** - * Determine if the given packet is a valid server packet in the current version of Minecraft. - *

- * Use {@link PacketType#isSupported()} instead. - * @param packetID - the packet to test. - * @return TRUE if this packet is supported, FALSE otherwise. - * @throws FieldAccessException If we're unable to retrieve the server packet data from Minecraft. - */ - @Deprecated - public static boolean isSupported(int packetID) throws FieldAccessException { - return PacketFilterManager.getServerPackets().contains(packetID); - } - - /** - * Retrieve every client packet the current version of Minecraft is aware of. - * @return Every supported server packet. - * @throws FieldAccessException If we're unable to retrieve the server packet data from Minecraft. - */ - @Deprecated - public static Set getSupported() throws FieldAccessException { - return PacketFilterManager.getServerPackets(); - } - + // We only allow a single instance of this class private Server() { super(); @@ -262,26 +235,7 @@ public final class Packets { public static Client getRegistry() { return INSTANCE; } - - /** - * Determine if the given packet is a valid client packet in the current version of Minecraft. - * @param packetID - the packet to test. - * @return TRUE if this packet is supported, FALSE otherwise. - * @throws FieldAccessException If we're unable to retrieve the client packet data from Minecraft. - */ - public static boolean isSupported(int packetID) throws FieldAccessException { - return PacketFilterManager.getClientPackets().contains(packetID); - } - - /** - * Retrieve every client packet the current version of Minecraft is aware of. - * @return Every supported client packet. - * @throws FieldAccessException If we're unable to retrieve the client packet data from Minecraft. - */ - public static Set getSupported() throws FieldAccessException { - return PacketFilterManager.getClientPackets(); - } - + // Like above private Client() { super(); diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolConfig.java b/modules/API/src/main/java/com/comphenix/protocol/ProtocolConfig.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolConfig.java rename to modules/API/src/main/java/com/comphenix/protocol/ProtocolConfig.java index 999f3567..2eba66ae 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolConfig.java +++ b/modules/API/src/main/java/com/comphenix/protocol/ProtocolConfig.java @@ -25,7 +25,7 @@ import org.bukkit.configuration.Configuration; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.plugin.Plugin; -import com.comphenix.protocol.injector.PacketFilterManager.PlayerInjectHooks; +import com.comphenix.protocol.injector.PlayerInjectHooks; import com.google.common.base.Charsets; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; diff --git a/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java new file mode 100644 index 00000000..4d193dd9 --- /dev/null +++ b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -0,0 +1,96 @@ +package com.comphenix.protocol; + +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.List; +import java.util.logging.Level; + +import org.bukkit.plugin.Plugin; + +import com.comphenix.protocol.error.BasicErrorReporter; +import com.comphenix.protocol.error.ErrorReporter; +import com.google.common.util.concurrent.ListeningScheduledExecutorService; + +public class ProtocolLibrary { + public static final long MILLI_PER_SECOND = 1000; + public static final List INCOMPATIBLE = Arrays.asList("TagAPI"); + + /** + * The minimum version ProtocolLib has been tested with. + */ + public static final String MINIMUM_MINECRAFT_VERSION = "1.9"; + + /** + * The maximum version ProtocolLib has been tested with, + */ + public static final String MAXIMUM_MINECRAFT_VERSION = "1.9"; + + /** + * The date (with ISO 8601 or YYYY-MM-DD) when the most recent version (1.9) was released. + */ + public static final String MINECRAFT_LAST_RELEASE_DATE = "2016-02-29"; + + private static Plugin plugin; + private static ProtocolConfig config; + private static ProtocolManager manager; + private static ErrorReporter reporter = new BasicErrorReporter(); + + private static ListeningScheduledExecutorService executorAsync; + private static ListeningScheduledExecutorService executorSync; + + private static boolean updatesDisabled; + + protected static void init(Plugin plugin, ProtocolConfig config, ProtocolManager manager, ErrorReporter reporter, + ListeningScheduledExecutorService executorAsync, ListeningScheduledExecutorService executorSync) { + ProtocolLibrary.plugin = plugin; + ProtocolLibrary.config = config; + ProtocolLibrary.manager = manager; + ProtocolLibrary.reporter = reporter; + ProtocolLibrary.executorAsync = executorAsync; + ProtocolLibrary.executorSync = executorSync; + } + + public static Plugin getPlugin() { + return plugin; + } + + public static ProtocolConfig getConfig() { + return config; + } + + public static ProtocolManager getProtocolManager() { + return manager; + } + + public static ErrorReporter getErrorReporter() { + return reporter; + } + + public static void disableUpdates() { + updatesDisabled = true; + } + + public static boolean updatesDisabled() { + return updatesDisabled; + } + + public static ListeningScheduledExecutorService getExecutorAsync() { + return executorAsync; + } + + public static ListeningScheduledExecutorService getExecutorSync() { + return executorSync; + } + + public static void log(Level level, String message, Object... args) { + plugin.getLogger().log(level, MessageFormat.format(message, args)); + } + + public static void log(String message, Object... args) { + log(Level.INFO, message, args); + } + + public static void log(Level level, String message, Throwable ex) { + plugin.getLogger().log(level, message, ex); + } +} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolManager.java b/modules/API/src/main/java/com/comphenix/protocol/ProtocolManager.java similarity index 98% rename from ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolManager.java rename to modules/API/src/main/java/com/comphenix/protocol/ProtocolManager.java index 8e4796c1..0283e0d7 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolManager.java +++ b/modules/API/src/main/java/com/comphenix/protocol/ProtocolManager.java @@ -29,6 +29,7 @@ import org.bukkit.plugin.Plugin; import com.comphenix.protocol.async.AsyncMarker; import com.comphenix.protocol.events.ListenerPriority; +import com.comphenix.protocol.events.ListeningWhitelist; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketListener; import com.comphenix.protocol.injector.PacketConstructor; @@ -279,4 +280,6 @@ public interface ProtocolManager extends PacketStream { * @return Asynchronous packet manager. */ public AsynchronousManager getAsynchronousManager(); + + public void verifyWhitelist(PacketListener listener, ListeningWhitelist whitelist); } \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java similarity index 98% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java rename to modules/API/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java index 22018be7..dedd5577 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java +++ b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncFilterManager.java @@ -35,7 +35,6 @@ import com.comphenix.protocol.error.ErrorReporter; import com.comphenix.protocol.events.ListeningWhitelist; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketListener; -import com.comphenix.protocol.injector.PacketFilterManager; import com.comphenix.protocol.injector.PrioritizedListener; import com.comphenix.protocol.injector.SortedPacketListenerList; import com.comphenix.protocol.injector.packet.PacketRegistry; @@ -181,11 +180,11 @@ public class AsyncFilterManager implements AsynchronousManager { // Add listener to either or both processing queue if (hasValidWhitelist(sendingWhitelist)) { - PacketFilterManager.verifyWhitelist(listener, sendingWhitelist); + manager.verifyWhitelist(listener, sendingWhitelist); serverProcessingQueue.addListener(handler, sendingWhitelist); } if (hasValidWhitelist(receivingWhitelist)) { - PacketFilterManager.verifyWhitelist(listener, receivingWhitelist); + manager.verifyWhitelist(listener, receivingWhitelist); clientProcessingQueue.addListener(handler, receivingWhitelist); } diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncListenerHandler.java b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncListenerHandler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncListenerHandler.java rename to modules/API/src/main/java/com/comphenix/protocol/async/AsyncListenerHandler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java rename to modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncRunnable.java b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncRunnable.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncRunnable.java rename to modules/API/src/main/java/com/comphenix/protocol/async/AsyncRunnable.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/NullPacketListener.java b/modules/API/src/main/java/com/comphenix/protocol/async/NullPacketListener.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/NullPacketListener.java rename to modules/API/src/main/java/com/comphenix/protocol/async/NullPacketListener.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java b/modules/API/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java rename to modules/API/src/main/java/com/comphenix/protocol/async/PacketEventHolder.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketProcessingQueue.java b/modules/API/src/main/java/com/comphenix/protocol/async/PacketProcessingQueue.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketProcessingQueue.java rename to modules/API/src/main/java/com/comphenix/protocol/async/PacketProcessingQueue.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketSendingQueue.java b/modules/API/src/main/java/com/comphenix/protocol/async/PacketSendingQueue.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/PacketSendingQueue.java rename to modules/API/src/main/java/com/comphenix/protocol/async/PacketSendingQueue.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/PlayerSendingHandler.java b/modules/API/src/main/java/com/comphenix/protocol/async/PlayerSendingHandler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/PlayerSendingHandler.java rename to modules/API/src/main/java/com/comphenix/protocol/async/PlayerSendingHandler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/Synchronization.java b/modules/API/src/main/java/com/comphenix/protocol/async/Synchronization.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/async/Synchronization.java rename to modules/API/src/main/java/com/comphenix/protocol/async/Synchronization.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/collections/ExpireHashMap.java b/modules/API/src/main/java/com/comphenix/protocol/collections/ExpireHashMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/collections/ExpireHashMap.java rename to modules/API/src/main/java/com/comphenix/protocol/collections/ExpireHashMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/collections/IntegerMap.java b/modules/API/src/main/java/com/comphenix/protocol/collections/IntegerMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/collections/IntegerMap.java rename to modules/API/src/main/java/com/comphenix/protocol/collections/IntegerMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/AbstractConcurrentListenerMultimap.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/AbstractConcurrentListenerMultimap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/AbstractConcurrentListenerMultimap.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/AbstractConcurrentListenerMultimap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java index 7dd8ec76..06693459 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java +++ b/modules/API/src/main/java/com/comphenix/protocol/concurrency/AbstractIntervalTree.java @@ -23,7 +23,6 @@ import java.util.NavigableMap; import java.util.Set; import java.util.TreeMap; -import com.comphenix.protocol.compat.guava.Guava; import com.google.common.base.Objects; import com.google.common.collect.Range; @@ -68,7 +67,7 @@ public abstract class AbstractIntervalTree, TValue @Override public Range getKey() { - return Guava.closedRange(left.key, right.key); + return Range.closed(left.key, right.key); } @Override diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/BlockingHashMap.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/BlockingHashMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/BlockingHashMap.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/BlockingHashMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/ConcurrentPlayerMap.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/ConcurrentPlayerMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/ConcurrentPlayerMap.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/ConcurrentPlayerMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/IntegerSet.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/IntegerSet.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/IntegerSet.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/IntegerSet.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/PacketTypeSet.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java b/modules/API/src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java rename to modules/API/src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/BasicErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/BasicErrorReporter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/BasicErrorReporter.java rename to modules/API/src/main/java/com/comphenix/protocol/error/BasicErrorReporter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/DelegatedErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/DelegatedErrorReporter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/DelegatedErrorReporter.java rename to modules/API/src/main/java/com/comphenix/protocol/error/DelegatedErrorReporter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java rename to modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/ErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/ErrorReporter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/ErrorReporter.java rename to modules/API/src/main/java/com/comphenix/protocol/error/ErrorReporter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/PluginContext.java b/modules/API/src/main/java/com/comphenix/protocol/error/PluginContext.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/PluginContext.java rename to modules/API/src/main/java/com/comphenix/protocol/error/PluginContext.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/Report.java b/modules/API/src/main/java/com/comphenix/protocol/error/Report.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/Report.java rename to modules/API/src/main/java/com/comphenix/protocol/error/Report.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/ReportType.java b/modules/API/src/main/java/com/comphenix/protocol/error/ReportType.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/ReportType.java rename to modules/API/src/main/java/com/comphenix/protocol/error/ReportType.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/error/RethrowErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/RethrowErrorReporter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/error/RethrowErrorReporter.java rename to modules/API/src/main/java/com/comphenix/protocol/error/RethrowErrorReporter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ConnectionSide.java b/modules/API/src/main/java/com/comphenix/protocol/events/ConnectionSide.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/ConnectionSide.java rename to modules/API/src/main/java/com/comphenix/protocol/events/ConnectionSide.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java b/modules/API/src/main/java/com/comphenix/protocol/events/ListenerOptions.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java rename to modules/API/src/main/java/com/comphenix/protocol/events/ListenerOptions.java index 9bf2f207..59014934 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java +++ b/modules/API/src/main/java/com/comphenix/protocol/events/ListenerOptions.java @@ -2,6 +2,7 @@ package com.comphenix.protocol.events; import com.comphenix.protocol.injector.GamePhase; + /** * Represents additional options a listener may require. * diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerPriority.java b/modules/API/src/main/java/com/comphenix/protocol/events/ListenerPriority.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerPriority.java rename to modules/API/src/main/java/com/comphenix/protocol/events/ListenerPriority.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListeningWhitelist.java b/modules/API/src/main/java/com/comphenix/protocol/events/ListeningWhitelist.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/ListeningWhitelist.java rename to modules/API/src/main/java/com/comphenix/protocol/events/ListeningWhitelist.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/MonitorAdapter.java b/modules/API/src/main/java/com/comphenix/protocol/events/MonitorAdapter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/MonitorAdapter.java rename to modules/API/src/main/java/com/comphenix/protocol/events/MonitorAdapter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/NetworkMarker.java b/modules/API/src/main/java/com/comphenix/protocol/events/NetworkMarker.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/NetworkMarker.java rename to modules/API/src/main/java/com/comphenix/protocol/events/NetworkMarker.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketAdapter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketAdapter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketContainer.java similarity index 98% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketContainer.java index f5eb6262..72488d5e 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java +++ b/modules/API/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; @@ -47,8 +50,6 @@ import org.bukkit.util.Vector; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType.Protocol; -import com.comphenix.protocol.compat.netty.Netty; -import com.comphenix.protocol.compat.netty.WrappedByteBuf; import com.comphenix.protocol.injector.StructureCache; import com.comphenix.protocol.reflect.EquivalentConverter; import com.comphenix.protocol.reflect.FuzzyReflection; @@ -930,8 +931,8 @@ public class PacketContainer implements Serializable { try { if (MinecraftReflection.isUsingNetty()) { - WrappedByteBuf buffer = createPacketBuffer(); - MinecraftMethods.getPacketWriteByteBufMethod().invoke(handle, buffer.getHandle()); + ByteBuf buffer = createPacketBuffer(); + MinecraftMethods.getPacketWriteByteBufMethod().invoke(handle, buffer); output.writeInt(buffer.readableBytes()); buffer.readBytes(output, buffer.readableBytes()); @@ -967,10 +968,10 @@ public class PacketContainer implements Serializable { // Call the read method try { if (MinecraftReflection.isUsingNetty()) { - WrappedByteBuf buffer = createPacketBuffer(); + ByteBuf buffer = createPacketBuffer(); buffer.writeBytes(input, input.readInt()); - MinecraftMethods.getPacketReadByteBufMethod().invoke(handle, buffer.getHandle()); + MinecraftMethods.getPacketReadByteBufMethod().invoke(handle, buffer); } else { if (input.readInt() != -1) throw new IllegalArgumentException("Cannot load a packet from 1.7.2 in 1.6.4."); @@ -995,8 +996,15 @@ public class PacketContainer implements Serializable { * Construct a new packet data serializer. * @return The packet data serializer. */ - private WrappedByteBuf createPacketBuffer() { - return Netty.createPacketBuffer(); + private ByteBuf createPacketBuffer() { + ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer(); + Class packetSerializer = MinecraftReflection.getPacketDataSerializerClass(); + + try { + return (ByteBuf) packetSerializer.getConstructor(ByteBuf.class).newInstance(buffer); + } catch (Exception e) { + throw new RuntimeException("Cannot construct packet serializer.", e); + } } // ---- Metadata diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketEvent.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketEvent.java index bc8d84be..cae6fdd7 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java +++ b/modules/API/src/main/java/com/comphenix/protocol/events/PacketEvent.java @@ -23,10 +23,10 @@ import java.io.ObjectOutputStream; import java.lang.ref.WeakReference; import java.util.EventObject; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import com.comphenix.protocol.Application; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.async.AsyncMarker; @@ -202,7 +202,7 @@ public class PacketEvent extends EventObject implements Cancellable { * @return TRUE if we are, FALSE otherwise. */ public boolean isAsync() { - return !Application.isPrimaryThread(); + return !Bukkit.isPrimaryThread(); } /** diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketListener.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketListener.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketListener.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketListener.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketOutputAdapter.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketOutputAdapter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketOutputAdapter.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketOutputAdapter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketOutputHandler.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketOutputHandler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketOutputHandler.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketOutputHandler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketPostAdapter.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketPostAdapter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketPostAdapter.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketPostAdapter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketPostListener.java b/modules/API/src/main/java/com/comphenix/protocol/events/PacketPostListener.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketPostListener.java rename to modules/API/src/main/java/com/comphenix/protocol/events/PacketPostListener.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ScheduledPacket.java b/modules/API/src/main/java/com/comphenix/protocol/events/ScheduledPacket.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/ScheduledPacket.java rename to modules/API/src/main/java/com/comphenix/protocol/events/ScheduledPacket.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/SerializedOfflinePlayer.java b/modules/API/src/main/java/com/comphenix/protocol/events/SerializedOfflinePlayer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/events/SerializedOfflinePlayer.java rename to modules/API/src/main/java/com/comphenix/protocol/events/SerializedOfflinePlayer.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/BukkitUnwrapper.java b/modules/API/src/main/java/com/comphenix/protocol/injector/BukkitUnwrapper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/BukkitUnwrapper.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/BukkitUnwrapper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/GamePhase.java b/modules/API/src/main/java/com/comphenix/protocol/injector/GamePhase.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/GamePhase.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/GamePhase.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketConstructor.java b/modules/API/src/main/java/com/comphenix/protocol/injector/PacketConstructor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketConstructor.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/PacketConstructor.java diff --git a/modules/API/src/main/java/com/comphenix/protocol/injector/PlayerInjectHooks.java b/modules/API/src/main/java/com/comphenix/protocol/injector/PlayerInjectHooks.java new file mode 100644 index 00000000..1308c264 --- /dev/null +++ b/modules/API/src/main/java/com/comphenix/protocol/injector/PlayerInjectHooks.java @@ -0,0 +1,31 @@ +package com.comphenix.protocol.injector; + +/** + * Sets the inject hook type. Different types allow for maximum compatibility. + * @author Kristian + */ +public enum PlayerInjectHooks { + /** + * The injection hook that does nothing. Set when every other inject hook fails. + */ + NONE, + + /** + * Override the network handler object itself. Only works in 1.3. + *

+ * Cannot intercept MapChunk packets. + */ + NETWORK_MANAGER_OBJECT, + + /** + * Override the packet queue lists in NetworkHandler. + *

+ * Cannot intercept MapChunk packets. + */ + NETWORK_HANDLER_FIELDS, + + /** + * Override the server handler object. Versatile, but a tad slower. + */ + NETWORK_SERVER_OBJECT; +} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PlayerLoggedOutException.java b/modules/API/src/main/java/com/comphenix/protocol/injector/PlayerLoggedOutException.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/PlayerLoggedOutException.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/PlayerLoggedOutException.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PrioritizedListener.java b/modules/API/src/main/java/com/comphenix/protocol/injector/PrioritizedListener.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/PrioritizedListener.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/PrioritizedListener.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/SortedPacketListenerList.java b/modules/API/src/main/java/com/comphenix/protocol/injector/SortedPacketListenerList.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/SortedPacketListenerList.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/SortedPacketListenerList.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/StructureCache.java b/modules/API/src/main/java/com/comphenix/protocol/injector/StructureCache.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/StructureCache.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/StructureCache.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBufAdapter.java b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyByteBufAdapter.java similarity index 99% rename from ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBufAdapter.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyByteBufAdapter.java index 6d6889a5..d31734e2 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyByteBufAdapter.java +++ b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyByteBufAdapter.java @@ -14,7 +14,7 @@ * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA */ -package com.comphenix.protocol.compat.netty.independent; +package com.comphenix.protocol.injector.netty; import io.netty.buffer.AbstractByteBuf; import io.netty.buffer.ByteBuf; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyProtocolRegistry.java b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolRegistry.java similarity index 96% rename from ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyProtocolRegistry.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolRegistry.java index fa80d470..dbb27ab0 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyProtocolRegistry.java +++ b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolRegistry.java @@ -14,7 +14,7 @@ * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA */ -package com.comphenix.protocol.compat.netty.independent; +package com.comphenix.protocol.injector.netty; import java.util.Map; import java.util.Map.Entry; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ProtocolRegistry.java b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/ProtocolRegistry.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ProtocolRegistry.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/netty/ProtocolRegistry.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java similarity index 86% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java index 05adcf9b..34f2102f 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java +++ b/modules/API/src/main/java/com/comphenix/protocol/injector/netty/WirePacket.java @@ -16,7 +16,7 @@ */ package com.comphenix.protocol.injector.netty; -import com.comphenix.protocol.compat.netty.WrappedByteBuf; +import io.netty.buffer.ByteBuf; /** * @author dmulloy2 @@ -39,7 +39,7 @@ public class WirePacket { return bytes; } - public void writeId(WrappedByteBuf output) { + public void writeId(ByteBuf output) { int i = id; while ((i & -128) != 0) { output.writeByte(i & 127 | 128); @@ -49,7 +49,7 @@ public class WirePacket { output.writeByte(i); } - public void writeBytes(WrappedByteBuf output) { + public void writeBytes(ByteBuf output) { output.writeBytes(bytes); } } \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/packet/MapContainer.java b/modules/API/src/main/java/com/comphenix/protocol/injector/packet/MapContainer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/packet/MapContainer.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/packet/MapContainer.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java b/modules/API/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java similarity index 62% rename from ProtocolLib/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java rename to modules/API/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java index 9a30d7bd..9d0d562d 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java +++ b/modules/API/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java @@ -24,17 +24,10 @@ import java.util.Set; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType.Sender; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.compat.netty.LegacyProtocolRegistry; -import com.comphenix.protocol.compat.netty.independent.NettyProtocolRegistry; -import com.comphenix.protocol.error.Report; import com.comphenix.protocol.error.ReportType; +import com.comphenix.protocol.injector.netty.NettyProtocolRegistry; import com.comphenix.protocol.injector.netty.ProtocolRegistry; -import com.comphenix.protocol.injector.packet.LegacyPacketRegistry.InsufficientPacketsException; import com.comphenix.protocol.reflect.FieldAccessException; -import com.comphenix.protocol.utility.MinecraftReflection; -import com.comphenix.protocol.utility.MinecraftVersion; -import com.comphenix.protocol.wrappers.TroveWrapper.CannotFindTroveNoEntryValue; import com.google.common.base.Function; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -51,13 +44,8 @@ public class PacketRegistry { public static final ReportType REPORT_INSUFFICIENT_CLIENT_PACKETS = new ReportType("Too few client packets detected: %s"); // Two different packet registry - private static volatile LegacyPacketRegistry LEGACY; private static volatile ProtocolRegistry NETTY; - - // Cached for legacy - private static volatile Set NETTY_SERVER_PACKETS; - private static volatile Set NETTY_CLIENT_PACKETS; - + // Cached for Netty private static volatile Set LEGACY_SERVER_PACKETS; private static volatile Set LEGACY_CLIENT_PACKETS; @@ -72,23 +60,13 @@ public class PacketRegistry { private static void initialize() { if (INITIALIZED) { // Make sure they were initialized - if (NETTY == null && LEGACY == null) + if (NETTY == null) throw new IllegalStateException("No initialized registry."); return; } - + // Check for netty - if (MinecraftReflection.isUsingNetty()) { - if (NETTY == null) { - if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.BOUNTIFUL_UPDATE)) { - NETTY = new NettyProtocolRegistry(); - } else { - NETTY = new LegacyProtocolRegistry(); - } - } - } else { - initializeLegacy(); - } + NETTY = new NettyProtocolRegistry(); } /** @@ -98,41 +76,9 @@ public class PacketRegistry { */ public static boolean isSupported(PacketType type) { initialize(); - - if (NETTY != null) - return NETTY.getPacketTypeLookup().containsKey(type); - - // Look up the correct type - return type.isClient() ? - LEGACY.getClientPackets().contains(type.getLegacyId()) : - LEGACY.getServerPackets().contains(type.getLegacyId()); + return NETTY.getPacketTypeLookup().containsKey(type); } - - /** - * Initialize the legacy packet registry. - */ - private static void initializeLegacy() { - if (LEGACY == null) { - try { - LEGACY = new LegacyPacketRegistry(); - LEGACY.initialize(); - } catch (InsufficientPacketsException e) { - if (e.isClient()) { - ProtocolLibrary.getErrorReporter().reportWarning( - PacketRegistry.class, Report.newBuilder(REPORT_INSUFFICIENT_CLIENT_PACKETS).messageParam(e.getPacketCount()) - ); - } else { - ProtocolLibrary.getErrorReporter().reportWarning( - PacketRegistry.class, Report.newBuilder(REPORT_INSUFFICIENT_SERVER_PACKETS).messageParam(e.getPacketCount()) - ); - } - } catch (CannotFindTroveNoEntryValue e) { - ProtocolLibrary.getErrorReporter().reportWarning(PacketRegistry.class, - Report.newBuilder(REPORT_CANNOT_CORRECT_TROVE_MAP).error(e.getCause())); - } - } - } - + /** * Retrieve a map of every packet class to every ID. *

@@ -142,38 +88,29 @@ public class PacketRegistry { @Deprecated public static Map getPacketToID() { initialize(); - - if (NETTY != null) { - @SuppressWarnings("unchecked") - Map result = (Map)Maps.transformValues(NETTY.getPacketClassLookup(), new Function() { - @Override - public Integer apply(PacketType type) { - return type.getLegacyId(); - }; - }); - return result; - } - return LEGACY.getPacketToID(); + + @SuppressWarnings("unchecked") + Map result = (Map) Maps.transformValues( + NETTY.getPacketClassLookup(), + new Function() { + @Override + public Integer apply(PacketType type) { + return type.getLegacyId(); + }; + }); + return result; } - + /** * Retrieve a map of every packet class to the respective packet type. * @return A map of packet classes and their corresponding packet type. */ public static Map getPacketToType() { initialize(); - - if (NETTY != null) { - @SuppressWarnings("unchecked") - Map result = (Map)NETTY.getPacketClassLookup(); - return result; - } - return Maps.transformValues(LEGACY.getPacketToID(), new Function() { - @Override - public PacketType apply(Integer packetId) { - return PacketType.findLegacy(packetId); - }; - }); + + @SuppressWarnings("unchecked") + Map result = (Map) NETTY.getPacketClassLookup(); + return result; } /** @@ -185,12 +122,9 @@ public class PacketRegistry { @Deprecated public static Map getOverwrittenPackets() { initialize(); - - if (LEGACY != null) - return LEGACY.getOverwrittenPackets(); throw new IllegalStateException("Not supported on Netty."); } - + /** * Retrieve the vanilla classes handling each packet ID. * @return Vanilla classes. @@ -198,22 +132,19 @@ public class PacketRegistry { @Deprecated public static Map getPreviousPackets() { initialize(); - - if (NETTY != null) { - // Construct it first - if (LEGACY_PREVIOUS_PACKETS == null) { - Map map = Maps.newHashMap(); - - for (Entry> entry : NETTY.getPacketTypeLookup().entrySet()) { - map.put(entry.getKey().getLegacyId(), entry.getValue()); - } - LEGACY_PREVIOUS_PACKETS = Collections.unmodifiableMap(map); + + // Construct it first + if (LEGACY_PREVIOUS_PACKETS == null) { + Map map = Maps.newHashMap(); + + for (Entry> entry : NETTY.getPacketTypeLookup().entrySet()) { + map.put(entry.getKey().getLegacyId(), entry.getValue()); } - return LEGACY_PREVIOUS_PACKETS; + LEGACY_PREVIOUS_PACKETS = Collections.unmodifiableMap(map); } - return LEGACY.getPreviousPackets(); + return LEGACY_PREVIOUS_PACKETS; } - + /** * Retrieve every known and supported server packet. *

@@ -224,14 +155,11 @@ public class PacketRegistry { @Deprecated public static Set getServerPackets() throws FieldAccessException { initialize(); - - if (NETTY != null) { - if (LEGACY_SERVER_PACKETS == null) { - LEGACY_SERVER_PACKETS = toLegacy(NETTY.getServerPackets()); - } - return LEGACY_SERVER_PACKETS; + + if (LEGACY_SERVER_PACKETS == null) { + LEGACY_SERVER_PACKETS = toLegacy(NETTY.getServerPackets()); } - return LEGACY.getServerPackets(); + return LEGACY_SERVER_PACKETS; } /** @@ -240,17 +168,9 @@ public class PacketRegistry { */ public static Set getServerPacketTypes() { initialize(); - - if (NETTY != null) { - NETTY.synchronize(); - return NETTY.getServerPackets(); - } - - // Handle legacy - if (NETTY_SERVER_PACKETS == null) { - NETTY_SERVER_PACKETS = toPacketTypes(LEGACY.getServerPackets(), Sender.SERVER); - } - return NETTY_SERVER_PACKETS; + + NETTY.synchronize(); + return NETTY.getServerPackets(); } /** @@ -263,14 +183,11 @@ public class PacketRegistry { @Deprecated public static Set getClientPackets() throws FieldAccessException { initialize(); - - if (NETTY != null) { - if (LEGACY_CLIENT_PACKETS == null) { - LEGACY_CLIENT_PACKETS = toLegacy(NETTY.getClientPackets()); - } - return LEGACY_CLIENT_PACKETS; + + if (LEGACY_CLIENT_PACKETS == null) { + LEGACY_CLIENT_PACKETS = toLegacy(NETTY.getClientPackets()); } - return LEGACY.getClientPackets(); + return LEGACY_CLIENT_PACKETS; } /** @@ -279,17 +196,9 @@ public class PacketRegistry { */ public static Set getClientPacketTypes() { initialize(); - - if (NETTY != null) { - NETTY.synchronize(); - return NETTY.getClientPackets(); - } - - // Handle legacy - if (NETTY_CLIENT_PACKETS == null) { - NETTY_CLIENT_PACKETS = toPacketTypes(LEGACY.getClientPackets(), Sender.CLIENT); - } - return NETTY_CLIENT_PACKETS; + + NETTY.synchronize(); + return NETTY.getClientPackets(); } /** @@ -338,10 +247,7 @@ public class PacketRegistry { @Deprecated public static Class getPacketClassFromID(int packetID) { initialize(); - - if (NETTY != null) - return NETTY.getPacketTypeLookup().get(PacketType.findLegacy(packetID)); - return LEGACY.getPacketClassFromID(packetID); + return NETTY.getPacketTypeLookup().get(PacketType.findLegacy(packetID)); } /** @@ -363,12 +269,9 @@ public class PacketRegistry { */ public static Class getPacketClassFromType(PacketType type, boolean forceVanilla) { initialize(); - - if (NETTY != null) - return NETTY.getPacketTypeLookup().get(type); - return LEGACY.getPacketClassFromID(type.getLegacyId(), forceVanilla); + return NETTY.getPacketTypeLookup().get(type); } - + /** * Retrieves the correct packet class from a given packet ID. *

@@ -380,12 +283,9 @@ public class PacketRegistry { @Deprecated public static Class getPacketClassFromID(int packetID, boolean forceVanilla) { initialize(); - - if (LEGACY != null) - return LEGACY.getPacketClassFromID(packetID, forceVanilla); return getPacketClassFromID(packetID); } - + /** * Retrieve the packet ID of a given packet. *

@@ -397,12 +297,9 @@ public class PacketRegistry { @Deprecated public static int getPacketID(Class packet) { initialize(); - - if (NETTY != null) - return NETTY.getPacketClassLookup().get(packet).getLegacyId(); - return LEGACY.getPacketID(packet); + return NETTY.getPacketClassLookup().get(packet).getLegacyId(); } - + /** * Retrieve the packet type of a given packet. * @param packet - the class of the packet. @@ -420,14 +317,6 @@ public class PacketRegistry { */ public static PacketType getPacketType(Class packet, Sender sender) { initialize(); - - if (NETTY != null) { - return NETTY.getPacketClassLookup().get(packet); - } else { - final int id = LEGACY.getPacketID(packet); - - return PacketType.hasLegacy(id) ? - PacketType.fromLegacy(id, sender) : null; - } + return NETTY.getPacketClassLookup().get(packet); } -} +} \ No newline at end of file diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ClassAnalyser.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/ClassAnalyser.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ClassAnalyser.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/ClassAnalyser.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ExactReflection.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/ExactReflection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ExactReflection.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/ExactReflection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FieldAccessException.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/FieldAccessException.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FieldAccessException.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/FieldAccessException.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FieldUtils.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/FieldUtils.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FieldUtils.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/FieldUtils.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/FuzzyReflection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/IntEnum.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/IntEnum.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/IntEnum.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/IntEnum.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/MethodInfo.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/MethodInfo.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/MethodInfo.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/MethodInfo.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/MethodUtils.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/MethodUtils.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/MethodUtils.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/MethodUtils.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ObjectEnum.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/ObjectEnum.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ObjectEnum.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/ObjectEnum.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ObjectWriter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/ObjectWriter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/ObjectWriter.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/ObjectWriter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/PrettyPrinter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/PrettyPrinter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/PrettyPrinter.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/PrettyPrinter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/VolatileField.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/Accessors.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/Accessors.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/Accessors.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/Accessors.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/ConstructorAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/ConstructorAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/ConstructorAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/ConstructorAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultConstrutorAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultConstrutorAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultConstrutorAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultConstrutorAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultMethodAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultMethodAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultMethodAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultMethodAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/FieldAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/FieldAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/FieldAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/FieldAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/MethodAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/MethodAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/MethodAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/MethodAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/ReadOnlyFieldAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/ReadOnlyFieldAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/accessors/ReadOnlyFieldAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/accessors/ReadOnlyFieldAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/AggregateCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/AggregateCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/AggregateCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/AggregateCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/BukkitCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/BukkitCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/BukkitCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/BukkitCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/Cloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/Cloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/Cloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/Cloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/CollectionCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/CollectionCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/CollectionCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/CollectionCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/FieldCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/FieldCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/FieldCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/FieldCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/ImmutableDetector.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/ImmutableDetector.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/ImmutableDetector.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/ImmutableDetector.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/NullableCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/NullableCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/NullableCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/NullableCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/OptionalCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/OptionalCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/OptionalCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/OptionalCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/SerializableCloner.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/SerializableCloner.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/cloning/SerializableCloner.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/cloning/SerializableCloner.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/BackgroundCompiler.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/BackgroundCompiler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/BackgroundCompiler.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/BackgroundCompiler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/BoxingHelper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/CompileListener.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/CompileListener.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/CompileListener.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/CompileListener.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyClassVisitor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyClassVisitor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyClassVisitor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyClassVisitor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyMethodVisitor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyMethodVisitor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyMethodVisitor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/EmptyMethodVisitor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/MethodDescriptor.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/MethodDescriptor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/MethodDescriptor.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/MethodDescriptor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMatcher.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMatcher.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMatcher.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMatcher.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMember.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMember.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMember.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/AbstractFuzzyMember.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassExactMatcher.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassExactMatcher.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassExactMatcher.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassExactMatcher.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassRegexMatcher.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassRegexMatcher.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassRegexMatcher.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassRegexMatcher.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassSetMatcher.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassSetMatcher.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassSetMatcher.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/ClassSetMatcher.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyClassContract.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyClassContract.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyClassContract.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyClassContract.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyFieldContract.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyFieldContract.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyFieldContract.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyFieldContract.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMatchers.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMatchers.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMatchers.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMatchers.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMethodContract.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMethodContract.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMethodContract.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/fuzzy/FuzzyMethodContract.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/BannedGenerator.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/BannedGenerator.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/BannedGenerator.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/BannedGenerator.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/CollectionGenerator.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/ExistingGenerator.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/InstanceProvider.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/InstanceProvider.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/InstanceProvider.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/InstanceProvider.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/NotConstructableException.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/NotConstructableException.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/NotConstructableException.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/NotConstructableException.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java rename to modules/API/src/main/java/com/comphenix/protocol/reflect/instances/PrimitiveGenerator.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/HistogramStream.java b/modules/API/src/main/java/com/comphenix/protocol/timing/HistogramStream.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/HistogramStream.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/HistogramStream.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/OnlineComputation.java b/modules/API/src/main/java/com/comphenix/protocol/timing/OnlineComputation.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/OnlineComputation.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/OnlineComputation.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/StatisticsStream.java b/modules/API/src/main/java/com/comphenix/protocol/timing/StatisticsStream.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/StatisticsStream.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/StatisticsStream.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimedListenerManager.java b/modules/API/src/main/java/com/comphenix/protocol/timing/TimedListenerManager.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimedListenerManager.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/TimedListenerManager.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimedTracker.java b/modules/API/src/main/java/com/comphenix/protocol/timing/TimedTracker.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimedTracker.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/TimedTracker.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java b/modules/API/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java rename to modules/API/src/main/java/com/comphenix/protocol/timing/TimingReportGenerator.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufferInputStream.java b/modules/API/src/main/java/com/comphenix/protocol/utility/ByteBufferInputStream.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufferInputStream.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/ByteBufferInputStream.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufferOutputStream.java b/modules/API/src/main/java/com/comphenix/protocol/utility/ByteBufferOutputStream.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/ByteBufferOutputStream.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/ByteBufferOutputStream.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/CachedPackage.java b/modules/API/src/main/java/com/comphenix/protocol/utility/CachedPackage.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/CachedPackage.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/CachedPackage.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ChatExtensions.java b/modules/API/src/main/java/com/comphenix/protocol/utility/ChatExtensions.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/ChatExtensions.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/ChatExtensions.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java b/modules/API/src/main/java/com/comphenix/protocol/utility/ClassSource.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/ClassSource.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java b/modules/API/src/main/java/com/comphenix/protocol/utility/Closer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/Closer.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Constants.java b/modules/API/src/main/java/com/comphenix/protocol/utility/Constants.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/Constants.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/Constants.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/EnhancerFactory.java b/modules/API/src/main/java/com/comphenix/protocol/utility/EnhancerFactory.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/EnhancerFactory.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/EnhancerFactory.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/HexDumper.java b/modules/API/src/main/java/com/comphenix/protocol/utility/HexDumper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/HexDumper.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/HexDumper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftFields.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftFields.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftFields.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftFields.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java similarity index 95% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java index e95e0728..095070e6 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java +++ b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftMethods.java @@ -1,5 +1,9 @@ package com.comphenix.protocol.utility; +import io.netty.buffer.Unpooled; +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; @@ -10,7 +14,6 @@ import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.compat.netty.Netty; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.reflect.FuzzyReflection; @@ -94,7 +97,7 @@ public class MinecraftMethods { public static Method getNetworkManagerHandleMethod() { if (networkManagerHandle == null) { networkManagerHandle = FuzzyReflection.fromClass(MinecraftReflection.getNetworkManagerClass(), true). - getMethodByParameters("handle", MinecraftReflection.getPacketClass(), Netty.getGenericFutureListenerArray()); + getMethodByParameters("handle", MinecraftReflection.getPacketClass(), GenericFutureListener[].class); networkManagerHandle.setAccessible(true); } return networkManagerHandle; @@ -109,7 +112,7 @@ public class MinecraftMethods { public static Method getNetworkManagerReadPacketMethod() { if (networkManagerPacketRead == null) { networkManagerPacketRead = FuzzyReflection.fromClass(MinecraftReflection.getNetworkManagerClass(), true). - getMethodByParameters("packetRead", Netty.getChannelHandlerContext(), MinecraftReflection.getPacketClass()); + getMethodByParameters("packetRead", ChannelHandlerContext.class, MinecraftReflection.getPacketClass()); networkManagerPacketRead.setAccessible(true); } return networkManagerPacketRead; @@ -174,7 +177,7 @@ public class MinecraftMethods { // Create our proxy object Object javaProxy = enhancer.create( new Class[] { MinecraftReflection.getByteBufClass() }, - new Object[] { Netty.buffer().getHandle() } + new Object[] { Unpooled.buffer() } ); Object lookPacket = new PacketContainer(PacketType.Play.Client.CLOSE_WINDOW).getHandle(); diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftProtocolVersion.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftProtocolVersion.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftProtocolVersion.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftProtocolVersion.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/RemappedClassSource.java b/modules/API/src/main/java/com/comphenix/protocol/utility/RemappedClassSource.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/RemappedClassSource.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/RemappedClassSource.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/SafeCacheBuilder.java b/modules/API/src/main/java/com/comphenix/protocol/utility/SafeCacheBuilder.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/SafeCacheBuilder.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/SafeCacheBuilder.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/SnapshotVersion.java b/modules/API/src/main/java/com/comphenix/protocol/utility/SnapshotVersion.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/SnapshotVersion.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/SnapshotVersion.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java b/modules/API/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java similarity index 95% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java index 9d4e36ab..91d8ebd0 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java +++ b/modules/API/src/main/java/com/comphenix/protocol/utility/StreamSerializer.java @@ -1,5 +1,8 @@ package com.comphenix.protocol.utility; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInput; @@ -14,8 +17,7 @@ import org.apache.commons.lang.Validate; import org.bukkit.inventory.ItemStack; import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; -import com.comphenix.protocol.compat.netty.Netty; -import com.comphenix.protocol.compat.netty.WrappedByteBuf; +import com.comphenix.protocol.injector.netty.NettyByteBufAdapter; import com.comphenix.protocol.reflect.FuzzyReflection; import com.comphenix.protocol.reflect.accessors.Accessors; import com.comphenix.protocol.reflect.accessors.MethodAccessor; @@ -114,10 +116,10 @@ public class StreamSerializer { ); } - WrappedByteBuf buf = Netty.packetWriter(output); + ByteBuf buf = NettyByteBufAdapter.packetWriter(output); buf.writeByte(NbtType.TAG_COMPOUND.getRawID()); - WRITE_NBT_METHOD.invoke(buf.getHandle(), handle); + WRITE_NBT_METHOD.invoke(buf, handle); } else { if (WRITE_NBT_METHOD == null) { WRITE_NBT_METHOD = Accessors.getMethodAccessor( @@ -156,7 +158,8 @@ public class StreamSerializer { ); } - nmsCompound = READ_NBT_METHOD.invoke(Netty.packetReader(input).getHandle()); + ByteBuf buf = NettyByteBufAdapter.packetReader(input); + nmsCompound = READ_NBT_METHOD.invoke(buf); } else { if (READ_NBT_METHOD == null) { READ_NBT_METHOD = Accessors.getMethodAccessor( @@ -206,7 +209,8 @@ public class StreamSerializer { ); } - WRITE_STRING_METHOD.invoke(Netty.packetWriter(output).getHandle(), text); + ByteBuf buf = NettyByteBufAdapter.packetWriter(output); + WRITE_STRING_METHOD.invoke(buf, text); } else { if (WRITE_STRING_METHOD == null) { WRITE_STRING_METHOD = Accessors.getMethodAccessor( @@ -250,7 +254,8 @@ public class StreamSerializer { ); } - return (String) READ_STRING_METHOD.invoke(Netty.packetReader(input).getHandle(), maximumLength); + ByteBuf buf = NettyByteBufAdapter.packetReader(input); + return (String) READ_STRING_METHOD.invoke(buf, maximumLength); } else { if (READ_STRING_METHOD == null) { READ_STRING_METHOD = Accessors.getMethodAccessor( @@ -282,8 +287,8 @@ public class StreamSerializer { byte[] bytes = null; if (MinecraftReflection.isUsingNetty()) { - WrappedByteBuf buf = Netty.buffer(); - Object serializer = MinecraftReflection.getPacketDataSerializer(buf.getHandle()); + ByteBuf buf = Unpooled.buffer(); + Object serializer = MinecraftReflection.getPacketDataSerializer(buf); if (WRITE_ITEM_METHOD == null) { WRITE_ITEM_METHOD = Accessors.getMethodAccessor( @@ -331,8 +336,8 @@ public class StreamSerializer { byte[] bytes = Base64Coder.decodeLines(input); if (MinecraftReflection.isUsingNetty()) { - WrappedByteBuf buf = Netty.copiedBuffer(bytes); - Object serializer = MinecraftReflection.getPacketDataSerializer(buf.getHandle()); + ByteBuf buf = Unpooled.copiedBuffer(bytes); + Object serializer = MinecraftReflection.getPacketDataSerializer(buf); if (READ_ITEM_METHOD == null) { READ_ITEM_METHOD = Accessors.getMethodAccessor(FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true). @@ -389,8 +394,8 @@ public class StreamSerializer { ); } - WrappedByteBuf buf = Netty.buffer(); - Object serializer = MinecraftReflection.getPacketDataSerializer(buf.getHandle()); + ByteBuf buf = Unpooled.buffer(); + Object serializer = MinecraftReflection.getPacketDataSerializer(buf); WRITE_ITEM_METHOD.invoke(serializer, nmsItem); @@ -438,8 +443,8 @@ public class StreamSerializer { byte[] bytes = new byte[8192]; input.read(bytes); - WrappedByteBuf buf = Netty.copiedBuffer(bytes); - Object serializer = MinecraftReflection.getPacketDataSerializer(buf.getHandle()); + ByteBuf buf = Unpooled.copiedBuffer(bytes); + Object serializer = MinecraftReflection.getPacketDataSerializer(buf); nmsItem = READ_ITEM_METHOD.invoke(serializer); } else { diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Util.java b/modules/API/src/main/java/com/comphenix/protocol/utility/Util.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/Util.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/Util.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/WrappedScheduler.java b/modules/API/src/main/java/com/comphenix/protocol/utility/WrappedScheduler.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/utility/WrappedScheduler.java rename to modules/API/src/main/java/com/comphenix/protocol/utility/WrappedScheduler.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/AbstractWrapper.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/AbstractWrapper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/AbstractWrapper.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/AbstractWrapper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ChunkCoordIntPair.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/ChunkCoordIntPair.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ChunkCoordIntPair.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/ChunkCoordIntPair.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ChunkPosition.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/ChunkPosition.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ChunkPosition.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/ChunkPosition.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ComponentConverter.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/ComponentConverter.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/ComponentConverter.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/ComponentConverter.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaReflection.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/GuavaReflection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaReflection.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/GuavaReflection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/GuavaWrappers.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/MultiBlockChangeInfo.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/MultiBlockChangeInfo.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/MultiBlockChangeInfo.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/MultiBlockChangeInfo.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/TroveWrapper.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/TroveWrapper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/TroveWrapper.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/TroveWrapper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedAttribute.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedAttribute.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedAttribute.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedAttribute.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedAttributeModifier.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedBlockData.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedBlockData.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedBlockData.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedBlockData.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedChunkCoordinate.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedChunkCoordinate.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedChunkCoordinate.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedChunkCoordinate.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedIntHashMap.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedIntHashMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedIntHashMap.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedIntHashMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java similarity index 98% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java index f42aa9b5..4691c611 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java +++ b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedServerPing.java @@ -1,5 +1,9 @@ package com.comphenix.protocol.wrappers; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; + import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.ByteArrayInputStream; @@ -17,8 +21,6 @@ import org.bukkit.entity.Player; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.compat.netty.Netty; -import com.comphenix.protocol.compat.netty.WrappedByteBuf; import com.comphenix.protocol.injector.BukkitUnwrapper; import com.comphenix.protocol.reflect.EquivalentConverter; import com.comphenix.protocol.reflect.accessors.Accessors; @@ -504,7 +506,9 @@ public class WrappedServerPing extends AbstractWrapper { */ public String toEncodedText() { if (encoded == null) { - encoded = Netty.toEncodedText(this); + final ByteBuf buffer = Unpooled.wrappedBuffer(getDataCopy()); + encoded = "data:" + getMime() + ";base64," + + Base64.encode(buffer).toString(Charsets.UTF_8); } return encoded; @@ -538,7 +542,7 @@ public class WrappedServerPing extends AbstractWrapper { this.mime = segment.substring(5); } else if (segment.startsWith("base64,")) { byte[] encoded = segment.substring(7).getBytes(Charsets.UTF_8); - WrappedByteBuf decoded = Netty.decode(encoded); + ByteBuf decoded = Base64.decode(Unpooled.wrappedBuffer(encoded)); // Read into a byte array byte[] data = new byte[decoded.readableBytes()]; diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedSignedProperty.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedStatistic.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedStatistic.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedStatistic.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedStatistic.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/AbstractConverted.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/AbstractConverted.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/AbstractConverted.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/AbstractConverted.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/BiFunction.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/BiFunction.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/BiFunction.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/BiFunction.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/CachedCollection.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/CachedCollection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/CachedCollection.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/CachedCollection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/CachedSet.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/CachedSet.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/CachedSet.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/CachedSet.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedCollection.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedCollection.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedCollection.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedCollection.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedList.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedList.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedList.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedList.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMap.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMap.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMultimap.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMultimap.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMultimap.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedMultimap.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedSet.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedSet.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedSet.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/collection/ConvertedSet.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/MemoryElement.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/MemoryElement.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/MemoryElement.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/MemoryElement.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NameProperty.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtBase.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtBase.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtBase.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtBase.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtCompound.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtCompound.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtCompound.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtCompound.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtList.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtList.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtList.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtList.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtType.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtType.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtType.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtType.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtVisitor.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtVisitor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtVisitor.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtVisitor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtWrapper.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtWrapper.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtWrapper.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtWrapper.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/TileEntityAccessor.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/TileEntityAccessor.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/TileEntityAccessor.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/TileEntityAccessor.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedCompound.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedCompound.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedCompound.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedCompound.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedElement.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedElement.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedElement.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedElement.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedList.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedList.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedList.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/WrappedList.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtBinarySerializer.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtBinarySerializer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtBinarySerializer.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtBinarySerializer.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializer.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializer.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtConfigurationSerializer.java diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java similarity index 100% rename from ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java rename to modules/API/src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java diff --git a/modules/ItemDisguise/pom.xml b/modules/ItemDisguise/pom.xml deleted file mode 100644 index e134b42a..00000000 --- a/modules/ItemDisguise/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - 4.0.0 - com.comphenix.itemdisguise - ItemDisguise - 1.1.0 - Item Disguise - Change the appearance of inventory items. - - - cp1252 - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public/ - - - dmulloy2-repo - http://repo.dmulloy2.net/content/groups/public/ - - - - - src/main/java - - - src/main/java - - **/*.java - - - - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - - scm:git:git://github.com/aadnk/ProtocolLib.git - scm:git:git@github.com:aadnk/ProtocolLib.git - https://github.com/aadnk/ProtocolLib - - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - http://www.gnu.org/licenses/gpl-2.0.txt - repo - - - - - org.spigotmc - spigot-api - 1.8.7-R0.1-SNAPSHOT - - - org.spigotmc - spigot - 1.8.7-R0.1-SNAPSHOT - provided - - - com.comphenix.protocol - ProtocolLib - 3.6.4 - - - \ No newline at end of file diff --git a/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/HideEnchantmentsListener.java b/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/HideEnchantmentsListener.java deleted file mode 100644 index d4839eb0..00000000 --- a/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/HideEnchantmentsListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * ItemDisguise - A simple Bukkit plugin that illustrates how to use ProtocolLib. - * Copyright (C) 2012 Kristian S. Stangeland - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ - -package com.comphenix.itemdisguise; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.bukkit.Server; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.reflect.FieldAccessException; - -public class HideEnchantmentsListener { - - private final Server server; - private final Logger logger; - - public HideEnchantmentsListener(Server server, Logger logger) { - this.server = server; - this.logger = logger; - } - - public void addListener(ProtocolManager protocolManager, JavaPlugin plugin) { - // Hide all enchantments - protocolManager.addPacketListener(new PacketAdapter(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS, - PacketType.Play.Server.NAMED_SOUND_EFFECT) { - @Override - public void onPacketSending(PacketEvent event) { - PacketContainer packet = event.getPacket(); - - try { - // Item packets - if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) { - removeEnchantments(packet.getItemModifier().read(0)); - } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) { - ItemStack[] elements = packet.getItemArrayModifier().read(0); - - for (int i = 0; i < elements.length; i++) { - if (elements[i] != null) { - removeEnchantments(elements[i]); - } - } - } else if (event.getPacketType() == PacketType.Play.Server.NAMED_SOUND_EFFECT) { - event.setCancelled(true); - } - } catch (FieldAccessException e) { - logger.log(Level.SEVERE, "Couldn't access field.", e); - } - } - }); - - // Censor - protocolManager.addPacketListener(new PacketAdapter(plugin, PacketType.Play.Client.CHAT) { - @Override - public void onPacketReceiving(PacketEvent event) { - if (event.getPacketType() == PacketType.Play.Client.CHAT) { - try { - String message = event.getPacket().getSpecificModifier(String.class).read(0); - if (message.contains("shit") || message.contains("fuck")) { - event.setCancelled(true); - event.getPlayer().sendMessage("Bad manners!"); - } - } catch (FieldAccessException e) { - logger.log(Level.SEVERE, "Couldn't access field.", e); - } - } - } - }); - } - - public Server getServer() { - return server; - } - - public void removeListener(ProtocolManager protocolManager, JavaPlugin plugin) { - // Just remove every adapter with this plugin - protocolManager.removePacketListeners(plugin); - } - - private void removeEnchantments(ItemStack stack) { - if (stack == null) - return; - - Enchantment[] copy = stack.getEnchantments().keySet().toArray(new Enchantment[0]); - for (Enchantment enchantment : copy) { - stack.removeEnchantment(enchantment); - } - } -} diff --git a/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/ItemDisguiseMod.java b/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/ItemDisguiseMod.java deleted file mode 100644 index fc625522..00000000 --- a/modules/ItemDisguise/src/main/java/com/comphenix/itemdisguise/ItemDisguiseMod.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ItemDisguise - A simple Bukkit plugin that illustrates how to use ProtocolLib. - * Copyright (C) 2012 Kristian S. Stangeland - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ - -package com.comphenix.itemdisguise; - -import java.util.logging.Logger; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketContainer; - -public class ItemDisguiseMod extends JavaPlugin { - - private ProtocolManager protocolManager; - private Logger logger; - - private HideEnchantmentsListener enchantmentsListener; - - @Override - public void onEnable() { - logger = getLoggerSafely(); - protocolManager = ProtocolLibrary.getProtocolManager(); - - enchantmentsListener = new HideEnchantmentsListener(getServer(), logger); - enchantmentsListener.addListener(protocolManager, this); - } - - @Override - public void onDisable() { - enchantmentsListener.removeListener(protocolManager, this); - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if (label.equalsIgnoreCase("explosion")) { - PacketContainer fakeExplosion = protocolManager.createPacket(PacketType.Play.Server.EXPLOSION); - - // Set the coordinates - try { - fakeExplosion.getSpecificModifier(double.class).write(0, player.getLocation().getX()).write(1, player.getLocation().getY()).write(2, player.getLocation().getZ()); - fakeExplosion.getSpecificModifier(float.class).write(0, 3.0F); - - protocolManager.sendServerPacket(player, fakeExplosion); - } catch (Exception e) { - e.printStackTrace(); - } - } - - return true; - } - - return false; - } - - // Get the Bukkit logger first, before we try to create our own - private Logger getLoggerSafely() { - - Logger log = null; - - try { - log = getLogger(); - } catch (Throwable e) { - // We'll handle it - } - - if (log == null) - log = Logger.getLogger("Minecraft"); - return log; - } -} diff --git a/modules/ItemDisguise/src/main/java/plugin.yml b/modules/ItemDisguise/src/main/java/plugin.yml deleted file mode 100644 index 7639f0b5..00000000 --- a/modules/ItemDisguise/src/main/java/plugin.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: ItemDisguiseMod -version: 1.0.0 -description: Change the appearance of inventory items. -author: Comphenix -website: http://www.comphenix.net/ItemDisguise - -main: com.comphenix.itemdisguise.ItemDisguiseMod -depends: [ProtocolLib] -database: false - -commands: - explosion: - description: Creates a fake explosion around the caller. - usage: / \ No newline at end of file diff --git a/ProtocolLib/pom.xml b/modules/ProtocolLib/pom.xml similarity index 96% rename from ProtocolLib/pom.xml rename to modules/ProtocolLib/pom.xml index 2597873b..f23649ec 100644 --- a/ProtocolLib/pom.xml +++ b/modules/ProtocolLib/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ProtocolLib ProtocolLib - 3.7.0-SNAPSHOT + 4.0.0-SNAPSHOT Provides read/write access to the Minecraft protocol. http://www.spigotmc.org/resources/protocollib.1997/ @@ -12,8 +12,8 @@ com.comphenix.protocol ProtocolLib-Parent - v3-SNAPSHOT - ../ + v4-SNAPSHOT + ../../ @@ -219,6 +219,11 @@ + + com.comphenix.protocol + ProtocolLib-API + 4.0-SNAPSHOT +