[API] PacketListenerAPI 3.7.1-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
    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

    Code (spiget-meta (Unknown Language)):
    SlZOd2EkUm9kI1J3YW1GeUooVWtXa2QzZFdGPk4rSmFWelV3WVZoYWJHUiNSbk5hVnpVdytHMDVlVnAzUCswa0okUk1NMEp6WkZka2NHSnBPRDBrSiRSalIzZypXakpzZFZ7V1FtaFpNblJzWkVWNGNHTXpVbSppYlZaNVVWWigka3B1V20qamJrNXdZaiEwT1VwWVdtKmpiazV3WWohMGIoUiNaPlFs

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

Recent Updates

  1. Update
  2. 1.13 support
  3. 1.12 support

Recent Reviews

  1. 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!
  2. o0Julia0o
    o0Julia0o
    5/5,
    Version: 3.6.0-SNAPSHOT
  3. 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
  4. Brokkonaut
    Brokkonaut
    5/5,
    Version: 3.6.0-SNAPSHOT
    Great plugin, we use it in combination with the NickNamer plugin. Thank you for this.
  5. jCripton
    jCripton
    1/5,
    Version: 3.6.0-SNAPSHOT
  6. Redraskal
    Redraskal
    5/5,
    Version: 3.6.0-SNAPSHOT
    Works as intended, not sure why there are a ton of reviews saying the download is broken or the code is "suspicious" lol
  7. Minecraft2016
    Minecraft2016
    2/5,
    Version: 3.6.0-SNAPSHOT
    When i try to download it it sets my Anti virus off and says its a dangerous link. Just to let you know.
  8. isaiah8139
    isaiah8139
    4/5,
    Version: 3.5.2-SNAPSHOT
    Great plugin!

    Could you add 1.12 support Please?
    AdMaps requires this & 1.12 support for this and MapManager havn't been added.
  9. KiritoKun90
    KiritoKun90
    1/5,
    Version: 3.5.2-SNAPSHOT
    This Plugin is not installing for 1.10.2. Don't get any error in console so I can't show you anything. If you'll fix that I will change the rate
  10. Maniec
    Maniec
    1/5,
    Version: 3.5.2-SNAPSHOT
    When i use "ReceiverPacket" player and username is only null, how i can get player or username? Help plz!