[API] PacketListenerAPI 3.7.8-SNAPSHOT

Simple API to manipulate sent and received packets | compatible with all versions

  1. inventivetalent
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    Source Code:
    https://github.com/InventivetalentDev/PacketListenerAPI
    This API provides an easy way to listen for when a Packet is sent or received and includes functions to modify Fields of the Packet.


    Code (Text):

    PacketListenerAPI.addPacketHandler(new PacketHandler() {

                @Override
                public void onSend(SentPacket packet) {
                }

                @Override
                public void onReceive(ReceivedPacket packet) {
                }

            });
     
    The processed packets can also be limited by adding the @PacketOptions annotation.

    If you are interested in manipulating packets directly on your BungeeCord server, check out the BungeeCord version of this API.

    Examples

    Checking a Packet

    1.) Not version save
    Code (Java):

            PacketListenerAPI.addPacketHandler(new PacketHandler() {

                @Override
                public void onSend(SentPacket packet) {
                    if (packet.getPacket() instanceof PacketPlayOutSpawnEntity) {// instanceof requires an import of the Packet, therefore not Version save
                        // Currently spawning an entity.
                    }
                }

                @Override
                public void onReceive(ReceivedPacket packet) {
                }

            });
     

    2.) version save (recommended)
    Code (Java):

        PacketListenerAPI.addPacketHandler(new PacketHandler() {

                @Override
                public void onSend(SentPacket packet) {
                    if (packet.getPacketName().equals("PacketPlayOutSpawnEntity")) {
                        // Currently spawning an entity.
                    }
                }

                @Override
                public void onReceive(ReceivedPacket packet) {
                }

            });
     

    1.) Not version save
    Code (Text):
        @EventHandler
        public void onPacketSend(PacketSendEvent e) {
            if (e.getPacket() instanceof PacketPlayOutSpawnEntity) {// instanceof requires an import of the Packet, therefore not Version save
                // Currently spawning an entity.
            }
        }
    2.) version save (recommended)
    Code (Text):
    @EventHandler
        public void onPacketSend(PacketSendEvent e) {
            if(e.getPacketName().equals("PacketPlayOutSpawnEntity")) {
                // Currently spawning an entity.
            }
        }
     

    Modifying Field values

    Code (Java):

    PacketListenerAPI.addPacketHandler(new PacketHandler() {

                @Override
                public void onSend(SentPacket packet) {
                    if(packet.getPacketName().equals("PacketPlayOutSpawnEntity")) {
                        packet.setPacketValue("f", <EntityID>);//f is the Field in the packet which defines the Entity-type as an Integer
                    }
                }

                @Override
                public void onReceive(ReceivedPacket packet) {
                }

            });
     
    1.) version save
    Code (Text):
        @EventHandler
        public void onPacketSend(PacketSendEvent e) {
            if(e.getPacketName().equals("PacketPlayOutSpawnEntity")) {
                e.setPacketValue("f", <EntityID>);//f is the Field in the packet which defines the Entity-type as an Integer
            }
        }



    Maven
    [​IMG]


    APIManager
    This API is compatible with APIManger.
    Click here for information on how to implement it.



    Links



    Please leave a rating if you like this resource.
    Donations to support me or this resource are also very much appreciated.

Recent Updates

  1. Fix
  2. 1.16.2 support
  3. fix

Recent Reviews

  1. ciolgaming
    ciolgaming
    5/5,
    Version: 3.7.6-SNAPSHOT
    It's a very good API, I use it with my plugin and it's a very good solution to manage packets.
  2. cocoraid
    cocoraid
    5/5,
    Version: 3.7.5-SNAPSHOT
    working great on 1.15.2 with glowapi, thank you for your job you saved me so much time of work !
  3. THC1442
    THC1442
    4/5,
    Version: 3.7.3-SNAPSHOT
    Pls, update it to 1.14.4, i really need it for MapManager and AnimatedFrames! Then, I will review with 5 stars! Thx!
  4. LuisDasNilpferd
    LuisDasNilpferd
    1/5,
    Version: 3.7.3-SNAPSHOT
    Don't work. On start comes 'org.inventivetalent.packetlistener.PacketListenerAPI' is not yet initialized. Creating new instance.
    [00:17:15] [Server thread/WARN]: java.lang.ClassNotFoundException: net.minecraft.util.io.netty.channel.Channel
  5. WeaselBeans
    WeaselBeans
    5/5,
    Version: 3.7.2-SNAPSHOT
    This plugin is important and helpful. Please continue to support and improve this.
  6. z__
    z__
    5/5,
    Version: 3.7.2-SNAPSHOT
    So much is possible because of this plugin. Thank you for the continued updates. Unbelievably Amazing!!
  7. mansurka64
    mansurka64
    5/5,
    Version: 3.6.0-SNAPSHOT
    useful and helpful api plugin
    recommended for developers
    thank you so much m8 for dat good plugin make more plugin!
  8. o0Julia0o
    o0Julia0o
    5/5,
    Version: 3.6.0-SNAPSHOT
  9. Tomix7_XD
    Tomix7_XD
    5/5,
    Version: 3.6.0-SNAPSHOT
    Me dijeron que podia editar los mensajes de los plugins pero como??
    Pls responde
  10. Brokkonaut
    Brokkonaut
    5/5,
    Version: 3.6.0-SNAPSHOT
    Great plugin, we use it in combination with the NickNamer plugin. Thank you for this.