protocolsminecraftbukkitpacket

Retrooper packetevents, is there a documentation of the version 2.0?


I am searching for a documentation of the PacketEvents API. So that I can lookup secific problems, and directly learn good practice / inteded use.

Things I found:


currently, I am trying to understand how to send server-bound packets.

I found the method ProtocolManager#receivePacket(Object, PacketWrapper), I have no idea what kind of object is expected (the variable name is channel).


Solution

  • The PacketEvents-Example library you linked does contain examples for 2.0. Select the 2.0 branch in the 'Switch branches/tags' dropdown. Here's a link to that: PacketEvents-Example 2.0.

    You are correct that the Javadocs and Wiki only pertain to versions lower than 2.0 because 2.0 is a snapshot and not a full release.

    Here's an example of how to send packets to a player in 2.0:

    PacketEvents.getAPI().getPlayerManager().sendPacket(player, packet);
    

    Where player is your target player and packet is an instance of PacketWrapper<?> (e.g. WrapperPlayServerPlayerInfo).

    That example is one of a few ways to send packets. As stated in the project's README, you should join their Discord for further help.