Git Product home page Git Product logo

protocollib's Introduction

ProtocolLib

Certain tasks are impossible to perform with the standard Bukkit API, and may require working with and even modifying Minecraft directly. A common technique is to modify incoming and outgoing packets, or inject custom packets into the stream. This is quite cumbersome to do, however, and most implementations will break as soon as a new version of Minecraft has been released, mostly due to obfuscation.

Critically, different plugins that use this approach may hook into the same classes, with unpredictable outcomes. More than often this causes plugins to crash, but it may also lead to more subtle bugs.

Currently maintained by dmulloy2 on behalf of Spigot.

Resources

Compilation

ProtocolLib is built with Gradle. If you have it installed, just run ./gradlew build in the root project folder. Other gradle targets you may be interested in include clean, test, and shadowJar. shadowJar will create a jar with all dependencies (ByteBuddy) included.

A new API

ProtocolLib attempts to solve this problem by providing an event API, much like Bukkit, that allows plugins to monitor, modify, or cancel packets sent and received. But, more importantly, the API also hides all the gritty, obfuscated classes with a simple index based read/write system. You no longer have to reference CraftBukkit!

Using ProtocolLib

To use this library, first add ProtocolLib.jar to your Java build path. Then, add ProtocolLib as a dependency or soft dependency to your plugin.yml file like any other plugin:

depend: [ ProtocolLib ]

You can also add ProtocolLib as a Maven dependency:

<repositories>
  <repository>
    <id>dmulloy2-repo</id>
    <url>https://repo.dmulloy2.net/repository/public/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.comphenix.protocol</groupId>
    <artifactId>ProtocolLib</artifactId>
    <version>5.0.0-SNAPSHOT</version>
    <scope>provided</scope>
  </dependency>
</dependencies>

Or use the maven dependency with gradle:

repositories {
    maven { url "https://repo.dmulloy2.net/repository/public/" }
}

dependencies {
    compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT'
}

Then get a reference to ProtocolManager in onLoad() or onEnable() and you're good to go.

private ProtocolManager protocolManager;

public void onLoad() {
    protocolManager = ProtocolLibrary.getProtocolManager();
}

To listen for packets sent by the server to a client, add a server-side listener:

// Disable all sound effects
protocolManager.addPacketListener(new PacketAdapter(
    this,
    ListenerPriority.NORMAL,
    PacketType.Play.Server.NAMED_SOUND_EFFECT
) {
    @Override
    public void onPacketSending(PacketEvent event) {
        event.setCancelled(true);
    }
});

It's also possible to read and modify the content of these packets. For instance, you can create a global censor by listening for Packet3Chat events:

// Censor
protocolManager.addPacketListener(new PacketAdapter(
    this,
    ListenerPriority.NORMAL,
    PacketType.Play.Client.CHAT
) {
    @Override
    public void onPacketReceiving(PacketEvent event) {
        PacketContainer packet = event.getPacket();
        String message = packet.getStrings().read(0);

        if (message.contains("shit") || message.contains("damn")) {
            event.setCancelled(true);
            event.getPlayer().sendMessage("Bad manners!");
        }
    }
});

Sending packets

Normally, you might have to do something ugly like the following:

PacketPlayOutExplosion fakeExplosion = new PacketPlayOutExplosion(
    player.getLocation().getX(),
    player.getLocation().getY(),
    player.getLocation().getZ(),
    3.0F,
    new ArrayList<>(),
    new Vec3D(
        player.getVelocity().getX() + 1,
        player.getVelocity().getY() + 1,
        player.getVelocity().getZ() + 1
    )
);

((CraftPlayer) player).getHandle().b.a(fakeExplosion);

But with ProtocolLib, you can turn that into something more manageable:

PacketContainer fakeExplosion = new PacketContainer(PacketType.Play.Server.EXPLOSION);
fakeExplosion.getDoubles()
    .write(0, player.getLocation().getX())
    .write(1, player.getLocation().getY())
    .write(2, player.getLocation().getZ());
fakeExplosion.getFloat().write(0, 3.0F);
fakeExplosion.getBlockPositionCollectionModifier().write(0, new ArrayList<>());
fakeExplosion.getVectors().write(0, player.getVelocity().add(new Vector(1, 1, 1)));

protocolManager.sendServerPacket(player, fakeExplosion);

Compatibility

One of the main goals of this project was to achieve maximum compatibility with CraftBukkit. And the end result is quite flexible. It's likely that I won't have to update ProtocolLib for anything but bug fixes and new features.

How is this possible? It all comes down to reflection in the end. Essentially, no name is hard coded - every field, method and class is deduced by looking at field types, package names or parameter types. It's remarkably consistent across different versions.

protocollib's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protocollib's Issues

Support for spigot's new outgoing packet filtering.

I've detailed the issue on the ProtocolLib forums here.

Spigot builds > #1521 add a new filter on outgoing packets which has effectively broken ProtocolLib's ability to modify outgoing itemstacks, at least in creative mode.

The spigot developers have indicated that this is similar to what is already being done to incoming packets by craftbukkit, but was added as an additional precaution against crashing clients with bad itemstacks.

ProtocolLib offers an INTERCEPT_INPUT_BUFFER flag which allows users to work around craftbukkits filtering, but offers no way (to my knowledge) to work around this new outgoing packet filter. This has rendered PortableHorses completely broken and exploitable, and I'm sure other plugins are probably affected as well.

I fear ProtocolLib is the only hope of a solution to this, as I'm not nearly comfortable enough with the networking internals of minecraft to attempt a workaround myself.

l'il help? :)

ProtocolLib build for spigot 1.8 has no DataWatcher support

The datawatcher in spigot's 1.8 uses new DualByte and so classes in order to support both 1.7 and 1.8
But ProtocolLib doesn't have those objects. This results in a error being spewed whenever you try to access DataWatcher.

[21:13:45] [Server thread/WARN]: java.lang.IllegalArgumentException: Cannot watch the type class org.spigotmc.ProtocolData$DualByte
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.wrappers.WrappedWatchableObject.<init>(WrappedWatchableObject.java:94)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.disguisetypes.FlagWatcher.convert(FlagWatcher.java:114)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.PacketsManager.createDataWatcher(PacketsManager.java:337)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.PacketsManager.constructSpawnPackets(PacketsManager.java:249)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.PacketsManager.transformPacket(PacketsManager.java:1265)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.PacketsManager$3.onPacketSending(PacketsManager.java:745)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:618)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:594)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetQueued(NettyProtocolInjector.java:281)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketSending(NettyProtocolInjector.java:249)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:351)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.access$500(ChannelInjector.java:59)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector$5.handleScheduled(ChannelInjector.java:315)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector$5.onMessageScheduled(ChannelInjector.java:283)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:100)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:76)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.NetworkManager.b(NetworkManager.java:151)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.NetworkManager.handle(NetworkManager.java:129)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.PlayerConnection.sendPacket(PlayerConnection.java:803)
[21:13:45] [Server thread/WARN]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[21:13:45] [Server thread/WARN]:    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[21:13:45] [Server thread/WARN]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[21:13:45] [Server thread/WARN]:    at java.lang.reflect.Method.invoke(Unknown Source)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.invokeSendPacket(ChannelInjector.java:619)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.sendServerPacket(ChannelInjector.java:603)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector$4.sendServerPacket(NettyProtocolInjector.java:341)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.sendServerPacket(PacketFilterManager.java:815)
[21:13:45] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.sendServerPacket(PacketFilterManager.java:771)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.DisguiseUtilities.sendSelfDisguise(DisguiseUtilities.java:659)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.utilities.DisguiseUtilities.setupFakeDisguise(DisguiseUtilities.java:773)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.disguisetypes.Disguise.startDisguise(Disguise.java:708)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.DisguiseAPI.disguiseEntity(DisguiseAPI.java:159)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.DisguiseAPI.disguiseToAll(DisguiseAPI.java:222)
[21:13:45] [Server thread/WARN]:    at me.libraryaddict.disguise.commands.DisguiseCommand.onCommand(DisguiseCommand.java:46)
[21:13:45] [Server thread/WARN]:    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[21:13:45] [Server thread/WARN]:    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181)
[21:13:45] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584)
[21:13:45] [Server thread/WARN]:    at     net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490)
[21:13:45] [Server thread/WARN]:    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)

Failed to initialize a channel

Jenkins Version 179
Running Spigot-1187

http://pastebin.com/SzWnShXB

The exception was thrown after a second restart.
First time it was good, but the second and third restart brought this exception.
The console was full of them.

After the fifth restart it was away.

... and never seen again. :o

PS: Don't forget to update the Version Number in your plugin.yml ;)
"/ver ProtocolLib" still shows 3.0.0

TinyProtocol only for server status packets.

I want to implement TinyProtocol in my plugin so it does not necessarily require ProtocolLib anymore (though it is still recommended). I only need to modify the PacketStatusOutServerInfo packet and listen to the PacketHandshakingInSetProtocol packet but TinyProtocol also allows listening for ingame packets which I don't need.

Is there a way I can optimize it so it does only listen for the packets before joining the game and is a little bit faster by doing that? I wasn't be able to figure out how the injection works exactly so it would be great if you could point me in the right direction. :)

Thanks in advance!

IncompatibleClassChangeError with Cauldron 1.7.10 [Protocollib 3.4.1-Cauldron]

On the Spigot have no this issue... Could You please fix this? Many thanks.

09:13:47 ERROR: [SkinsRestorer] Unhandled exception occured in onPacketSending(PacketEvent) for SkinsRestorer
java.lang.IncompatibleClassChangeError: Class com.mojang.authlib.properties.PropertyMap does not implement the requested interface com.google.common.collect.Multimap
at com.comphenix.protocol.wrappers.GuavaWrappers$1.clear(GuavaWrappers.java:31) ~[ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.wrappers.collection.ConvertedMultimap.clear(ConvertedMultimap.java:161) ~[ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at skinsrestorer.SkinListeners$1.onPacketSending(SkinListeners.java:113) ~[SkinsRestorer.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:612) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:588) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetQueued(NettyProtocolInjector.java:281) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketSending(NettyProtocolInjector.java:249) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:319) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.ChannelInjector.access$300(ChannelInjector.java:59) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.ChannelInjector$5.handleScheduled(ChannelInjector.java:295) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.ChannelInjector$5.onMessageScheduled(ChannelInjector.java:263) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:100) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:76) [ProtocolLib-Cauldron-3.4.1-SNAPSHOT.jar:?]
at net.minecraft.network.NetworkManager.func_150732_b(NetworkManager.java:188) [ej.class:?]
at net.minecraft.network.NetworkManager.func_150725_a(NetworkManager.java:158) [ej.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147359_a(NetHandlerPlayServer.java:1019) [nh.class:?]
at net.minecraft.entity.EntityTrackerEntry.func_73117_b(EntityTrackerEntry.java:435) [my.class:?]
at net.minecraft.entity.EntityTrackerEntry.func_73125_b(EntityTrackerEntry.java:555) [my.class:?]
at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java:203) [mn.class:?]
at net.minecraft.entity.EntityTracker.func_72791_a(EntityTracker.java:183) [mn.class:?]
at net.minecraft.entity.EntityTracker.func_72786_a(EntityTracker.java:69) [mn.class:?]
at net.minecraft.world.WorldManager.func_72703_a(WorldManager.java:28) [mp.class:?]
at net.minecraft.world.World.func_72923_a(World.java:1824) [ahb.class:?]
at net.minecraft.world.WorldServer.func_72923_a(WorldServer.java:1083) [mt.class:?]
at net.minecraft.world.World.addEntity(World.java:1814) [ahb.class:?]
at net.minecraft.world.World.func_72838_d(World.java:1701) [ahb.class:?]
at net.minecraft.server.management.ServerConfigurationManager.func_72377_c(ServerConfigurationManager.java:369) [oi.class:?]
at net.minecraft.server.management.ServerConfigurationManager.a(ServerConfigurationManager.java:217) [oi.class:?]
at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:173) [NetworkDispatcher.class:git-Cauldron-MCPC-Plus-1.7.10-1.1187.03.118]
at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeHandshake(NetworkDispatcher.java:448) [NetworkDispatcher.class:git-Cauldron-MCPC-Plus-1.7.10-1.1187.03.118]
at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:21) [HandshakeCompletionHandler.class:git-Cauldron-MCPC-Plus-1.7.10-1.1187.03.118]
at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:11) [HandshakeCompletionHandler.class:git-Cauldron-MCPC-Plus-1.7.10-1.1187.03.118]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) [SimpleChannelInboundHandler.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:git-Cauldron-MCPC-Plus-1.7.10-1.1187.03.118]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) [ej.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:976) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:419) [lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:806) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:666) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:722) [?:1.7.0_04-ea]

net.minecraft.network.play.server.S0CPacketSpawnPlayer@7f089507[
field_148957_a=749
field_148955_b=com.mojang.authlib.GameProfile@7a77c8d6[id=567dbe7a-774d-3aa2-8f02-c60b4e9793ea,name=HunterzCZ,properties={},legacy=false]
field_148956_c=-8204
field_148953_d=2208
field_148954_e=8413
field_148951_f=65
field_148952_g=17
field_148959_h=0
field_148960_i=net.minecraft.entity.DataWatcher@41447f39
field_148958_j=
timestamp=1406013227833
]

Error Unable to intercept a read client packet

I'm using this build: http://assets.comphenix.net/job/ProtocolLib/155/
The plugin.yml is actually not stating the version is 3.0.0 which is a bit weird.
ProtocolLib is the only plugin installed.
The error happened once upon first join to the server ever.

[12:04:51 INFO]: Error Unable to intercept a read client packet. (java.lang.NullPointerException) occured in com.comphenix.protocol.injector.netty.ChannelInjector@1294ff9.
[12:04:51 ERROR]: [ProtocolLib] INTERNAL ERROR: Unable to intercept a read client packet.
If this problem hasn't already been reported, please open a ticket
at http://dev.bukkit.org/server-mods/protocollib/ with the following data:
===== STACK TRACE =====
java.lang.NullPointerException
at com.comphenix.protocol.injector.netty.NettyProtocolInjector.includeBuffer(NettyProtocolInjector.java:221)
at com.comphenix.protocol.injector.netty.ChannelInjector.decode(ChannelInjector.java:330)
at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232)
at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
at net.minecraft.server.v1_7_R1.LegacyPingHandler.channelRead(SourceFile:89)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100)
at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480)
at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447)
at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341)
at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Unknown Source)
===== DUMP =====
Parameters:
net.minecraft.util.io.netty.buffer.UnpooledHeapByteBuf@2574efb4[
alloc=net.minecraft.util.io.netty.buffer.UnpooledByteBufAllocator@202525a2
array={0,4,9,108,111,99,97,108,104,111,115,116,99,-35,2}
tmpNioBuf=
refCnt=1
readerIndex=15
writerIndex=15
markedReaderIndex=0
markedWriterIndex=0
maxCapacity=2147483647
swappedBuf=
]
manager:
com.comphenix.protocol.injector.PacketFilterManager@2de62290[
unhookTask=com.comphenix.protocol.injector.DelayedSingleTask@5fe7337a
packetListeners=[]
packetInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector$4@5eea82fc
playerInjection=com.comphenix.protocol.injector.netty.NettyProtocolInjector$3@763d9f12
interceptWritePacket=com.comphenix.protocol.injector.packet.InterceptWritePacket@47969363
inputBufferedPackets=[]
recievedListeners=com.comphenix.protocol.injector.SortedPacketListenerList@6ea66d4c
sendingListeners=com.comphenix.protocol.injector.SortedPacketListenerList@7051d154
hasClosed=false
classLoader=org.bukkit.plugin.java.PluginClassLoader@7bc2336c
reporter=com.comphenix.protocol.ProtocolLibrary$1@b861b68
server=CraftServer{serverName=CraftBukkit,serverVersion=git-Spigot-1168,minecraftVersion=1.7.2}
asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@25e969d9
knowsServerPackets=true
knowsClientPackets=true
phaseLoginCount=0
phasePlayingCount=0
packetCreation=false
spigotInjector=
nettyInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector@15ed9922
pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@21e0926d
hasRecycleDistance=true
minecraftVersion=(MC: 1.7.2)
loginPackets=com.comphenix.protocol.injector.LoginPackets@1ead437b
]
Sender:
com.comphenix.protocol.injector.netty.ChannelInjector@1294ff9[
player=com.comphenix.protocol.injector.server.InjectorContainer$$EnhancerByCGLIB$$5ce62eb@3f416507
playerConnection=
networkManager=net.minecraft.server.v1_7_R1.NetworkManager@5e4fcf02
originalChannel=[id: 0xaedd44fc, /127.0.0.1:50700 => /127.0.0.1:25565]
channelField=VolatileField [field=private net.minecraft.util.io.netty.channel.Channel net.minecraft.server.v1_7_R1.NetworkManager.k, container=net.minecraft.server.v1_7_R1.NetworkManager@5e4fcf0
2, previous=null, current=com.comphenix.protocol.injector.netty.ChannelInjector$2@161c279e]
packetMarker={}
markerEvent={}
ignoredPackets=[]
vanillaDecoder=net.minecraft.server.v1_7_R1.PacketDecoder@7571fa35
vanillaEncoder=net.minecraft.server.v1_7_R1.PacketEncoder@de1e9d0
protocolEncoder=com.comphenix.protocol.injector.netty.ChannelInjector$1@6abd5dce
channelListener=com.comphenix.protocol.injector.netty.NettyProtocolInjector@15ed9922
injected=true
closed=false
cumulation=UnpooledHeapByteBuf(ridx: 15, widx: 15, cap: 15)
singleDecode=false
decodeWasNull=false
added=true
]
Version:
ProtocolLib v2.7.4-SNAPSHOT
Server:
git-Spigot-1168 (MC: 1.7.2)

Support for Spigot's 1.8 protocol hack.

Currently ProtocolLib is completely disabled on the new 1.8 Spigot protocol hacks because it will prevent players from joining. The reason for this is probably that ProtocolLib will not use the decompressor required for 1.8 because the ChannelInjector is created before the compression will be enabled.

Together with @kashike the only completely working way we found to fix this is to add the decompressor before the ProtocolLib decoder in Spigot itself, but we weren't able to find a way to do that directly in ProtocolLib, even after testing quite a lot of different ways how it could have worked. Maybe that could be also done in ProtocolLib somehow?

Thanks in advance!

Out of Bounds

@aadnk
Having some issues, can you please shed some light:

    private static PacketContainer createTeamPacket(TeamInfo team, int action, List<String> players) {
        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_TEAM);

        packet.getStrings().write(0, team.getName()); // Team Name
        packet.getBytes().write(0, (byte) action); // Action
        if (action == 0 || action == 2) {
            packet.getStrings().write(1, team.getName());
            packet.getStrings().write(2, team.getPrefix());
            packet.getStrings().write(3, team.getSuffix());
            packet.getBytes().write((byte) 1, (byte) 1); // Friendly fire
        }
        if (action == 0 || action == 3 || action == 4) {
            packet.getStringArrays().write(0, players.toArray(new String[players.size()]));
        }

        return packet;
    }

Results in the following:

17.12 10:51:26 [Server] INFO [10:51:26 WARN]: Caused by: java.lang.IndexOutOfBoundsException: Out of bounds
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:446)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:534)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:651)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:150)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.LoginListener.a(LoginListener.java:42)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.LoginListener.c(LoginListener.java:87)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.PlayerList.a(PlayerList.java:116)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at net.minecraft.server.v1_7_R1.PlayerList.c(PlayerList.java:225)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:463)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:478)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at java.lang.reflect.Method.invoke(Unknown Source)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at ca.wacos.nametagedit.NametagEventHandler.onPlayerJoin(NametagEventHandler.java:30)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at ca.wacos.nametagedit.NametagManager.sendTeamsToPlayer(NametagManager.java:332)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at ca.wacos.nametagedit.NametagManager.createTeamPacket(NametagManager.java:454)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:285)
17.12 10:51:26 [Server] INFO [10:51:26 WARN]: com.comphenix.protocol.reflect.FieldAccessException: Field index must be within 0 - count
17.12 10:51:26 [Server] INFO [10:51:26 INFO]: Failed to send packet for player (Packet209SetScoreboardTeam) : 

Add a method for hiding the player amounts in the server ping wrapper.

Currently there's no way for hiding the player amount in the server list with the server ping wrapper. Before 1.7, this could be easily done by setting the max player amount to a negative number, however that does no longer work in 1.7.
But that feature was not removed, it's possible to get the same behavior in 1.7 by removing the player amounts from the response.

Basicly, a method like this:

public void hidePlayers() {
    PLAYERS.set(handle, null);
    // this.players = null;
}

They're a few things to note though:

  • What happens if the methods getPlayersOnline() or setPlayersOnline() are called after this? (It would probably throw a NPE or another Exception)
    1. Maybe it would be possible to revert the changes of the hidePlayers() method and apply the changes made for the called method.
    2. Make the methods doing nothing. This would destroy the purpose of the packet handler priorities.

Example:

Hidden player amount

Failed to handle packet

Hi,
I use ProtocolLib-3.5.0-SNAPSHOT.jar (Build #269) and I experimented an error when I die:

[21:34:16 WARN]: Failed to handle packet for /xxx.xxx.xxx.xxx:53216
java.util.ConcurrentModificationException

  at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429) ~[?:1.8.0_20]
  at java.util.HashMap$KeyIterator.next(HashMap.java:1453) ~[?:1.8.0_20]
  at net.minecraft.server.v1_7_R4.EntityTracker.track(EntityTracker.java:32) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.WorldManager.a(WorldManager.java:18) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.World.a(World.java:1010) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.WorldServer.a(WorldServer.java:800) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.World.addEntity(World.java:1003) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.World.addEntity(World.java:947) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.PlayerList.moveToWorld(PlayerList.java:530) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.PlayerList.moveToWorld(PlayerList.java:433) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:1142) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.PacketPlayInClientCommand.a(SourceFile:50) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.PacketPlayInClientCommand.handle(SourceFile:8) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:157) ~[spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.ServerConnection.c(SourceFile:134) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:667) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:258) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:558) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:469) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
  at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]

[21:34:16 INFO]: mjl1010 lost connection: Internal server error

I use CraftBukkit 1.7.10, thanks for reading.

ProtocolLib SpigotSnapshot Bug

I know officially this protocolLib build is not supported, but figured I'd report this bug anyways. Using ProtocolLib SpigotSnapshot hack build 1, nametags do not colorize anymore.

VanishNoPacket - Vanished players don't have a colorized nametag.
PVP Arenas - Team gamemodes don't have a colorized nametag of their team above their head.
Nametags + TagAPI - Doesn't colorize player's nametag.

Removing ProtocolLib 'hack' build 1, nametags retain all their color again!

http://assets.comphenix.net/jenkins/job/ProtocolLib%20-%20Spigot%20Hack/

I presume this is due to the hack commit, as this issue didn't occur on 1.6.4's protocollib. Unfortunately can't use 1.6.4's protocollib due to the login null packet error spam. I suppose the only solution for me is to wait for Bukkit's official 1.7.2 API and have a proper protocollib update if I wish to use plugin features requiring protocollib. However, again, thought I'd report the bug anyways. :)

[Issue with my plugin] IndexOutOfBoundsException & FieldAccessException

Hello,
I recently found one outdated plugin which hides attributes on items, for example on lore swords that tells us sword´s damage. I have updated the code and copied to my plugin.
It works in game, but sometimes in console an error message is shown:
http://pastebin.com/DRhAX2T6

Here is my code:
http://pastebin.com/b9gLATWq

The line 192 is:
packet.getIntegers().write(0, Integer.valueOf(b.length));

Using Spigot MC 1.7.5 #1387

The issue is not very important, it is just an addon for my server so if you don´t have time just close it ;)

Minecraft 1.6.1 incompatibility?

I am using Spigot #979 and ProtocolLib #88
You previously helped me with this piece of source code:
https://github.com/MassiveCraft/mcore/blob/master/src/com/massivecraft/mcore/integration/protocollib/EntityPotionColorPacketAdapter.java#L70

Looking at http://wiki.vg/Protocol_History I see no changes to the entity metadata packet.

Does this error imply protocol lib is not yet compatible with 1.6.1?:

11:47:12 [INFO] Cayorion[/127.0.0.1:54569] logged in with entity id 0 at ([regalia] -233.6768976721056, 72.0, 773.0377111100919)
11:47:13 [INFO] Caught java.lang.ClassCastException exception in EntityPotionColorPacketAdapter#onPacketSending
11:47:13 [INFO] Message: java.lang.Byte cannot be cast to java.lang.Integer
11:47:13 [INFO] Stack Trace:
11:47:13 [SEVERE] java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.Integer
11:47:13 [SEVERE] at com.massivecraft.mcore.integration.protocollib.EntityPotionColorPacketAdapter.onPacketSending(EntityPotionColorPacketAdapter.java:70)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:113)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:495)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:475)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector.packetQueued(SpigotPacketInjector.java:400)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector.packetQueued(SpigotPacketInjector.java:380)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector$2.intercept(SpigotPacketInjector.java:172)
11:47:13 [SEVERE] at org.spigotmc.netty.PacketListener$$EnhancerByCGLIB$$65c16b2d.packetQueued()
11:47:13 [SEVERE] at org.spigotmc.netty.PacketListener.callQueued(PacketListener.java:73)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager.queue0(NettyNetworkManager.java:192)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager.access$000(NettyNetworkManager.java:34)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager$3.run(NettyNetworkManager.java:182)
11:47:13 [SEVERE] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
11:47:13 [SEVERE] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:365)
11:47:13 [SEVERE] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
11:47:13 [SEVERE] at java.lang.Thread.run(Unknown Source)

Error Unable to intercept a read client packet.

Occurred on server startup. Dev build 51. http://build.yu8.me:8080/job/ProtocolLib/51/

[09:12:05] [Netty IO #2/INFO]: Error Unable to intercept a read client packet. (java.lang.NullPointerException) occured in com.comphenix.protocol.injector.netty.ChannelInjector@15be40b3.
[09:12:05] [Netty IO #1/INFO]: Error Unable to intercept a read client packet. (java.lang.NullPointerException) occured in com.comphenix.protocol.injector.netty.ChannelInjector@152a3cd5.
[09:12:05] [Netty IO #2/ERROR]:   [ProtocolLib] INTERNAL ERROR: Unable to intercept a read client packet.
  If this problem hasn't already been reported, please open a ticket
  at http://dev.bukkit.org/server-mods/protocollib/ with the following data:
            ===== STACK TRACE =====
  java.lang.NullPointerException
    at com.comphenix.protocol.injector.netty.ChannelInjector.handleLogin(ChannelInjector.java:331)
    at com.comphenix.protocol.injector.netty.ChannelInjector.decode(ChannelInjector.java:297)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.server.v1_7_R1.LegacyPingHandler.channelRead(SourceFile:89)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
    at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341)
    at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)
            ===== DUMP =====
  Parameters: 
    net.minecraft.util.io.netty.buffer.UnpooledHeapByteBuf@200c8be6[
      alloc=net.minecraft.util.io.netty.buffer.UnpooledByteBufAllocator@78096413
      array={0,15,102,108,117,102,102,121,49,50,51,49,50,51,52,53,54}
      tmpNioBuf=<null>
      refCnt=1
      readerIndex=17
      writerIndex=17
      markedReaderIndex=0
      markedWriterIndex=0
      maxCapacity=2147483647
      swappedBuf=<null>
    ]
    manager:
      com.comphenix.protocol.injector.PacketFilterManager@2bf526ef[
        unhookTask=com.comphenix.protocol.injector.DelayedSingleTask@4b66efcb
        packetListeners=[]
        packetInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector$5@7a1fbf7e
        playerInjection=com.comphenix.protocol.injector.netty.NettyProtocolInjector$4@3feffede
        interceptWritePacket=com.comphenix.protocol.injector.packet.InterceptWritePacket@1438353d
        inputBufferedPackets=[]
        recievedListeners=com.comphenix.protocol.injector.SortedPacketListenerList@7d4d425
        sendingListeners=com.comphenix.protocol.injector.SortedPacketListenerList@b76fee
        hasClosed=false
        classLoader=org.bukkit.plugin.java.PluginClassLoader@af65c44
        reporter=com.comphenix.protocol.ProtocolLibrary$1@40ee7828
        server=CraftServer{serverName=CraftBukkit,serverVersion=git-Spigot-1299,minecraftVersion=1.7.2}
        asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@2ed6d0a5
        knowsServerPackets=true
        knowsClientPackets=true
        phaseLoginCount=0
        phasePlayingCount=0
        packetCreation=false
        spigotInjector=<null>
        nettyInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector@6051323a
        pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@7e97cfd7
        hasRecycleDistance=true
        minecraftVersion=(MC: 1.7.2)
        loginPackets=com.comphenix.protocol.injector.LoginPackets@39bb4856
        debug=false
      ]
  Sender:
    com.comphenix.protocol.injector.netty.ChannelInjector@15be40b3[
      factory=com.comphenix.protocol.injector.netty.InjectionFactory@7c9760dc
      player=com.comphenix.protocol.injector.server.InjectorContainer$$EnhancerByCGLIB$$e6aecb3e@3cbee1ee
      updated=<null>
      playerConnection=<null>
      networkManager=net.minecraft.server.v1_7_R1.NetworkManager@5f24e7d7
      originalChannel=[id: 0x0a65224d, censor:38977 => censor]
      channelField=VolatileField [accessor=DefaultFieldAccessor [field=private net.minecraft.util.io.netty.channel.Channel net.minecraft.server.v1_7_R1.NetworkManager.k], container=net.minecraft.server.v1_7_R1.NetworkManager@5f24e7d7, previous=[id: 0x0a65224d, censor:38977 => censor], current=com.comphenix.protocol.injector.netty.ChannelInjector$2@7fae890b, previousLoaded=true, currentSet=true, forceAccess=true]
      packetMarker={}
      markerEvent={}
      processedPackets=[]
      ignoredPackets=[]
      vanillaDecoder=net.minecraft.server.v1_7_R1.PacketDecoder@2480402b
      vanillaEncoder=net.minecraft.server.v1_7_R1.PacketEncoder@33b4ff62
      protocolEncoder=com.comphenix.protocol.injector.netty.ChannelInjector$1@3b247817
      channelListener=com.comphenix.protocol.injector.netty.NettyProtocolInjector@6051323a
      injected=true
      closed=false
      cumulation=UnpooledHeapByteBuf(ridx: 17, widx: 17, cap: 17)
      singleDecode=false
      decodeWasNull=false
      added=true
    ]
  Version:
    ProtocolLib v3.2.1-SNAPSHOT
  Server:
    git-Spigot-1299 (MC: 1.7.2)

[09:12:05] [Netty IO #1/ERROR]:   [ProtocolLib] INTERNAL ERROR: Unable to intercept a read client packet.
  If this problem hasn't already been reported, please open a ticket
  at http://dev.bukkit.org/server-mods/protocollib/ with the following data:
            ===== STACK TRACE =====
  java.lang.NullPointerException
    at com.comphenix.protocol.injector.netty.ChannelInjector.handleLogin(ChannelInjector.java:331)
    at com.comphenix.protocol.injector.netty.ChannelInjector.decode(ChannelInjector.java:297)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.server.v1_7_R1.LegacyPingHandler.channelRead(SourceFile:89)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337)
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323)
    at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
    at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447)
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341)
    at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)
            ===== DUMP =====
  Parameters: 
    net.minecraft.util.io.netty.buffer.UnpooledHeapByteBuf@6579c0ae[
      alloc=net.minecraft.util.io.netty.buffer.UnpooledByteBufAllocator@78096413
      array={0,8,106,114,111,99,107,57,51,52}
      tmpNioBuf=<null>
      refCnt=1
      readerIndex=10
      writerIndex=10
      markedReaderIndex=0
      markedWriterIndex=0
      maxCapacity=2147483647
      swappedBuf=<null>
    ]
    manager:
      com.comphenix.protocol.injector.PacketFilterManager@2bf526ef[
        unhookTask=com.comphenix.protocol.injector.DelayedSingleTask@4b66efcb
        packetListeners=[]
        packetInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector$5@7a1fbf7e
        playerInjection=com.comphenix.protocol.injector.netty.NettyProtocolInjector$4@3feffede
        interceptWritePacket=com.comphenix.protocol.injector.packet.InterceptWritePacket@1438353d
        inputBufferedPackets=[]
        recievedListeners=com.comphenix.protocol.injector.SortedPacketListenerList@7d4d425
        sendingListeners=com.comphenix.protocol.injector.SortedPacketListenerList@b76fee
        hasClosed=false
        classLoader=org.bukkit.plugin.java.PluginClassLoader@af65c44
        reporter=com.comphenix.protocol.ProtocolLibrary$1@40ee7828
        server=CraftServer{serverName=CraftBukkit,serverVersion=git-Spigot-1299,minecraftVersion=1.7.2}
        asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@2ed6d0a5
        knowsServerPackets=true
        knowsClientPackets=true
        phaseLoginCount=0
        phasePlayingCount=0
        packetCreation=false
        spigotInjector=<null>
        nettyInjector=com.comphenix.protocol.injector.netty.NettyProtocolInjector@6051323a
        pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@7e97cfd7
        hasRecycleDistance=true
        minecraftVersion=(MC: 1.7.2)
        loginPackets=com.comphenix.protocol.injector.LoginPackets@39bb4856
        debug=false
      ]
  Sender:
    com.comphenix.protocol.injector.netty.ChannelInjector@152a3cd5[
      factory=com.comphenix.protocol.injector.netty.InjectionFactory@7c9760dc
      player=com.comphenix.protocol.injector.server.InjectorContainer$$EnhancerByCGLIB$$e6aecb3e@347eb7a9
      updated=<null>
      playerConnection=<null>
      networkManager=net.minecraft.server.v1_7_R1.NetworkManager@f0d66d7
      originalChannel=[id: 0x7cc638b7, censor:57070 => censor]
      channelField=VolatileField [accessor=DefaultFieldAccessor [field=private net.minecraft.util.io.netty.channel.Channel net.minecraft.server.v1_7_R1.NetworkManager.k], container=net.minecraft.server.v1_7_R1.NetworkManager@f0d66d7, previous=[id: 0x7cc638b7, censor:57070 => censor], current=com.comphenix.protocol.injector.netty.ChannelInjector$2@78992fe5, previousLoaded=true, currentSet=true, forceAccess=true]
      packetMarker={}
      markerEvent={}
      processedPackets=[]
      ignoredPackets=[]
      vanillaDecoder=net.minecraft.server.v1_7_R1.PacketDecoder@6a63b544
      vanillaEncoder=net.minecraft.server.v1_7_R1.PacketEncoder@5bb449ea
      protocolEncoder=com.comphenix.protocol.injector.netty.ChannelInjector$1@3aaba030
      channelListener=com.comphenix.protocol.injector.netty.NettyProtocolInjector@6051323a
      injected=true
      closed=false
      cumulation=UnpooledHeapByteBuf(ridx: 10, widx: 10, cap: 10)
      singleDecode=false
      decodeWasNull=false
      added=true
    ]
  Version:
    ProtocolLib v3.2.1-SNAPSHOT
  Server:
    git-Spigot-1299 (MC: 1.7.2)

CB 1.7.2 - java.lang.RuntimeException: Cannot construct completed future.

Just to help finding the bugs in the actual builds:

I ran PL along with some other plugins on our test server and got this on console after I joined it:
https://gist.github.com/DerFlash/7810193

Build: 8f408c2

Server Info:
[18:55:42 INFO]: This server is running CraftBukkit version git-Spigot-1168 (MC: 1.7.2) (Implementing API version 1.7.2-R0.1-SNAPSHOT)

(yea I know Spigot is kind of unsupported, but maybe the ticket will still help)

Add TinyProtocol to Maven repository.

It would be great if you could add TinyProtocol to your Maven repository so I can shade it directly into my plugin and don't need to copy the sources and reference CraftBukkit.
Thanks in advance. :)

Create a multiline motd in the server ping wrapper?

The Javadoc of the setMotD(String) method says:
Warning: Only the first line will be transmitted.

What would be the correct way for setting more than one line for the wrapper in this case? Currently it's possible to create this through parsing a custom JSON string in the chat component wrapper, however this may change in the future again and is not easy to write in Java code because you have to escape all the double quotes.
ping.setMotD(WrappedChatComponent.fromJson("{\"text\":\"This is the first line.\nAnd this is the second line.\"}"));

At the moment, when using setMotD(String) the message is parsed by the CraftChatMessage class and converted to the new chat system. This will fix links and some other things in the ingame chat, however in my tests the new chat possibilities like hovering or clicking do not work in the server list and the client will just ignore them.
CraftBukkit itself is just wrapping the plain motd into a ChatComponentText without doing additional converting, this will also support multiple lines for the motd.

What do you think, shouldn't we using the same procedure when setting motds in the server ping wrapper?

Pack

if (args[0].equalsIgnoreCase("delentity")) {
    PacketContainer changeblock = manager
        .createPacket(PacketType.Play.Server.BLOCK_CHANGE);
    changeblock.getIntegers().write(0, Integer.parseInt(args[1]));
    changeblock.getIntegers().write(1, Integer.parseInt(args[2]));
    changeblock.getIntegers().write(2, Integer.parseInt(args[3]));
    changeblock.getBlocks().write(0, Material.getMaterial(Integer.parseInt(args[4])));
    try {
            manager.sendServerPacket(p, changeblock);
    } catch (InvocationTargetException e) {
            e.printStackTrace();
    }
}

That code gives a null pointer exception at the initializing of changeblock.
That my entire problem. (Im trying to send a fake block packet to a client)

NPE in Build #162

getting an NPE deep in the bowels of ProtocolLib with the latest 1.6.2 build.

[15:32:47 ERROR]: Error occurred while enabling PortableHorses v0.2.3 (Is it up to date?)
java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333) ~[?:1.7.0_40]
    at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1125) ~[?:1.7.0_40]
    at java.util.Collections$SetFromMap.add(Collections.java:3903) ~[?:1.7.0_40]
    at com.comphenix.protocol.concurrency.PacketTypeSet.addType(PacketTypeSet.java:36) ~[?:?]
    at com.comphenix.protocol.concurrency.PacketTypeSet.<init>(PacketTypeSet.java:26) ~[?:?]
    at com.comphenix.protocol.injector.netty.NettyProtocolInjector$4.inputBuffersChanged(NettyProtocolInjector.java:318) ~[?:?]
    at com.comphenix.protocol.injector.PacketFilterManager.updateRequireInputBuffers(PacketFilterManager.java:432) ~[?:?]
    at com.comphenix.protocol.injector.PacketFilterManager.addPacketListener(PacketFilterManager.java:396) ~[?:?]
    at com.norcode.bukkit.portablehorses.PacketListener.registerListeners(PacketListener.java:90) ~[?:?]
    at com.norcode.bukkit.portablehorses.PacketListener.<init>(PacketListener.java:30) ~[?:?]
    at com.norcode.bukkit.portablehorses.PortableHorses.onEnable(PortableHorses.java:73) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) ~[craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.java:298) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.java:280) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:338) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:315) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:275) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:175) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:420) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]
    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit-dev.jar:git-Bukkit-1.6.4-R2.0-23-ge8eb325-b2941jnks]

MultiBlockChange Packet sometimes contains wrong chunk coordinates

Hi,

I'am using version 3.4 of protocollib and 1.7.2-R0.5 of packetwrapper.
The following code sometimes generates the x and z coordinate with an offset of 16. This seems to be based on wrong Chunk x and z coordinates.

WrapperPlayServerMultiBlockChange packetWrapper = new WrapperPlayServerMultiBlockChange(packet);
BlockChangeArray array = packetWrapper.getRecordDataArray();
int chunkX = packetWrapper.getChunkX();
int chunkZ = packetWrapper.getChunkZ();
System.out.println("chunk: "+chunkX+"; "+chunkZ);
for (int i=0; i<array.getSize();i++) {
        BlockChange change = array.getBlockChange(i);
        int x = chunkX * 16 + change.getRelativeX();
        int y = change.getAbsoluteY();
        int z = chunkZ * 16 + change.getRelativeZ();
}
packetWrapper.setRecordData(array);

Greetings
Postremus

Issue with WrappedGameProfile in WrappedServerPing on MC 1.7.6 and never

Hello,
I would like to post an issue that causes inability to view server info in menu at all.

Code:
http://pastebin.com/7KHMUVd2

The issue:
On Minecraft 1.7.2 - 1.7.5 everything is working fine, but since 1.7.6 (and 1.7.7 and 1.7.8) I am unable to view my server in menu. It just shows "Can´t connect to server.".
I think the issue is related with the UUID changes in 1.7.6 since the wrappedgameprofile uses the fake uuid to display my custom text. The "derp" can be changed to anything but without any results.

Versions:
Using Spigot #1387 (MC 1.7.5) and ProtocolLib from 12.04.2014

HELP I think this is a problem with ProtocolLib. Please correct me if i'm wrong

[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTrackerEntry.updatePlayer(EntityTrackerEntry.java:323)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTrackerEntry.scanPlayers(EntityTrackerEntry.java:410)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTracker.addEntity(EntityTracker.java:109)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTracker.addEntity(EntityTracker.java:90)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTracker.track(EntityTracker.java:27)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.WorldManager.a(WorldManager.java:18)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.a(World.java:998)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.WorldServer.a(WorldServer.java:816)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.addEntity(World.java:991)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.addEntity(World.java:918)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.PlayerList.c(PlayerList.java:241)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.PlayerList.a(PlayerList.java:116)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.LoginListener.c(LoginListener.java:78)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.LoginListener.a(LoginListener.java:42)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:149)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:647)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:530)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:442)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
[08:46:42 WARN]: Caused by: java.lang.IndexOutOfBoundsException: Out of bounds
[08:46:42 WARN]: ... 37 more
[08:46:42 WARN]: com.comphenix.protocol.reflect.FieldAccessException: Field index must be within 0 - count
[08:46:42 WARN]: at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:191)
[08:46:42 WARN]: at org.kitteh.tag.handler.ProtocolLibHandler$1.onPacketSending(ProtocolLibHandler.java:53)
[08:46:42 WARN]: at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195)
[08:46:42 WARN]: at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149)
[08:46:42 WARN]: at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:576)
[08:46:42 WARN]: at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:552)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetQueued(NettyProtocolInjector.java:251)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketSending(NettyProtocolInjector.java:202)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:259)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.ChannelInjector.access$000(ChannelInjector.java:51)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.ChannelInjector$2.onMessageScheduled(ChannelInjector.java:238)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:91)
[08:46:42 WARN]: at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:76)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.NetworkManager.b(NetworkManager.java:110)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.NetworkManager.handle(NetworkManager.java:88)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.PlayerConnection.sendPacket(PlayerConnection.java:737)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTrackerEntry.updatePlayer(EntityTrackerEntry.java:323)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityTracker.a(EntityTracker.java:210)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.EntityPlayer.h(EntityPlayer.java:244)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.entityJoinedWorld(World.java:1463)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.playerJoinedWorld(World.java:1439)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.World.tickEntities(World.java:1308)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.WorldServer.tickEntities(WorldServer.java:508)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:626)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:530)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:442)
[08:46:42 WARN]: at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
[08:46:42 WARN]: Caused by: java.lang.IndexOutOfBoundsException: Out of bounds
[08:46:42 WARN]: ... 28 more

Example of listening for a custom packet

How do you listen for a custom packet?

I would like to access a custom packet that uses an otherwise unused ID. This packet is sent before the handshake or anything else is sent if that matters.

Simply hardcoding the packet ID into something like this doesn't work:

new PacketType(PacketType.Protocol.HANDSHAKING, PacketType.Sender.CLIENT, 0x47, 0x47)

I get an error like this:

Unsupported client packet ID in current Minecraft version: UNREGISTERED [HANDSHAKING, CLIENT, 71, legacy: 71]

Field index must be within 0 - count

Dev build 161. http://assets.comphenix.net/job/ProtocolLib/changes

@aadnk

[13:19:16] [Server thread/WARN]: com.comphenix.protocol.reflect.FieldAccessException: Field index must be within 0 - count
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:191)
[13:19:16] [Server thread/WARN]:    at org.kitteh.tag.handler.ProtocolLibHandler$1.onPacketSending(ProtocolLibHandler.java:53)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:576)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:552)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetQueued(NettyProtocolInjector.java:233)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketSending(NettyProtocolInjector.java:184)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:282)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.access$000(ChannelInjector.java:51)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector$2.onMessageScheduled(ChannelInjector.java:261)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:89)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:76)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.NetworkManager.b(NetworkManager.java:110)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.NetworkManager.handle(NetworkManager.java:88)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.PlayerConnection.sendPacket(PlayerConnection.java:737)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTrackerEntry.updatePlayer(EntityTrackerEntry.java:323)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTrackerEntry.scanPlayers(EntityTrackerEntry.java:410)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTracker.addEntity(EntityTracker.java:109)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTracker.addEntity(EntityTracker.java:90)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTracker.track(EntityTracker.java:27)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.WorldManager.a(WorldManager.java:18)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.a(World.java:998)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.WorldServer.a(WorldServer.java:816)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.addEntity(World.java:991)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.addEntity(World.java:918)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.PlayerList.c(PlayerList.java:241)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.PlayerList.a(PlayerList.java:116)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.LoginListener.c(LoginListener.java:78)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.LoginListener.a(LoginListener.java:42)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:149)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:647)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:530)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:442)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
[13:19:16] [Server thread/WARN]: Caused by: java.lang.IndexOutOfBoundsException: Out of bounds
[13:19:16] [Server thread/WARN]:    ... 37 more
[13:19:16] [Server thread/WARN]: com.comphenix.protocol.reflect.FieldAccessException: Field index must be within 0 - count
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:191)
[13:19:16] [Server thread/WARN]:    at org.kitteh.tag.handler.ProtocolLibHandler$1.onPacketSending(ProtocolLibHandler.java:53)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:576)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:552)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetQueued(NettyProtocolInjector.java:233)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketSending(NettyProtocolInjector.java:184)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:282)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector.access$000(ChannelInjector.java:51)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelInjector$2.onMessageScheduled(ChannelInjector.java:261)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:89)
[13:19:16] [Server thread/WARN]:    at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:76)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.NetworkManager.b(NetworkManager.java:110)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.NetworkManager.handle(NetworkManager.java:88)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.PlayerConnection.sendPacket(PlayerConnection.java:737)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTrackerEntry.updatePlayer(EntityTrackerEntry.java:323)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityTracker.a(EntityTracker.java:210)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.EntityPlayer.h(EntityPlayer.java:244)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.entityJoinedWorld(World.java:1463)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.playerJoinedWorld(World.java:1439)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.World.tickEntities(World.java:1308)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.WorldServer.tickEntities(WorldServer.java:508)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:626)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:530)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:442)
[13:19:16] [Server thread/WARN]:    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
[13:19:16] [Server thread/WARN]: Caused by: java.lang.IndexOutOfBoundsException: Out of bounds
[13:19:16] [Server thread/WARN]:    ... 28 more

ProtocolLib + mcore for Factions plug

ProtocolLib-2.6.1-SNAPSHOT - or any version
152mcore641 - or any version for 1.5.2

2013-08-27 13:36:45 [SEVERE] java.lang.RuntimeException: Cannot retrieve entity from ID.
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.wrappers.BukkitConverters$6.getSpecificValue(BukkitConverters.java:361)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.wrappers.BukkitConverters$6.getSpecificValue(BukkitConverters.java:340)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.wrappers.BukkitConverters$IgnoreNullConverter.getSpecific(BukkitConverters.java:87)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:192)
2013-08-27 13:36:45 [SEVERE] at com.massivecraft.mcore.integration.protocollib.EntityPotionColorPacketAdapter.onPacketSending(EntityPotionColorPacketAdapter.java:54)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:113)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:490)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:470)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.player.PlayerInjector.handlePacketSending(PlayerInjector.java:588)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.player.NetworkServerInjector$1.intercept(NetworkServerInjector.java:158)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.network.NetServerHandler$$EnhancerByCGLIB$$3feb8c91.func_72567_b()
2013-08-27 13:36:45 [SEVERE] at net.minecraft.entity.EntityTrackerEntry.func_73117_b(EntityTrackerEntry.java:452)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.entity.EntityTrackerEntry.func_73125_b(EntityTrackerEntry.java:537)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java:216)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.entity.EntityTracker.func_72786_a(EntityTracker.java:155)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.WorldManager.func_72703_a(WorldManager.java:37)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.World.func_72923_a(World.java:1848)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.WorldServer.func_72923_a(WorldServer.java:1213)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.World.addEntity(World.java:1836)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.SpawnerAnimals.func_77192_a(SpawnerAnimals.java:263)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:358)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:809)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:320)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:716)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:600)
2013-08-27 13:36:45 [SEVERE] at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)
2013-08-27 13:36:45 [SEVERE] Caused by: com.comphenix.protocol.reflect.FieldAccessException: Cannot find entity from ID 222.
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.EntityUtilities.getEntityFromID(EntityUtilities.java:273)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.getEntityFromID(PacketFilterManager.java:674)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.wrappers.BukkitConverters$6.getSpecificValue(BukkitConverters.java:355)
2013-08-27 13:36:45 [SEVERE] ... 25 more
2013-08-27 13:36:45 [SEVERE] Caused by: java.lang.IllegalArgumentException: Unable to find a field tracker with the type net.minecraft.entity.Entity in net.minecraft.util.IntHashMapEntry
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.reflect.FuzzyReflection.getFieldByType(FuzzyReflection.java:287)
2013-08-27 13:36:45 [SEVERE] at com.comphenix.protocol.injector.EntityUtilities.getEntityFromID(EntityUtilities.java:258)
2013-08-27 13:36:45 [SEVERE] ... 27 more

mobs dosnt die...

[Feature] TinyProtocol using 100% reflection?

That would be pretty cool!

Unfortunately you can't do this because of bug in old netty version Mojang is using(I tried creating reflection proxy - ChannelHandler, but I couldn't pass the write() call to next handler because one of netty interfaces is package-local. That was fixed in newer netty versions :( )

xxx can not access a member of class net.minecraft.util.io.netty.channel.ChannelOutboundInvoker with modifiers "public abstract"

Slow packet creation

So I made a test plugin that sends packets with faked teams to the client to set per player name prefixes and suffixes. I doubt I would get this performance drain if I created and sent the packages directly myself:

http://i.imgur.com/6qEULuu.jpg

Couldn't the packet creation somehow be optimized?

Memory Leak

Hi, I am experiencing a memory leak with ProtocolLib.
Latest ProtocolLib build, latest available Spigot build.
I have done heap dumps and...debugging heap dumps is always tricky,
but it clearly shows that CraftPlayers are being leaked and somehow - it's ProtocolLib's ChannelInjector holding the CraftPlayer(and the player is holding other stuff such as now-unloaded worlds).

Removing ProtocolLib removes memory leaks.

Apart from the ChannelInjector, GC root also shows TinyProtocolLib instance from another plugin on the same path.
I am sure that the used TinyProtocolLib does not cause issues on itself - are there incompatibilities with "real" ProtocolLib that could cause CraftPlayers to leak?

Thanks for any help. Please tell me if you need more debugging etc. information.

[1.7.2] Some spam on undisguise with Lib's Disguises

Since the 1.7 branch does seem like it's semi-supported, here's a bit of console spam on undisguise with the Lib's Disguises plugin:

It does function fine, but somewhat of a cosmetic issue in console. Disguise works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.