PacketLib 1.0d

Easy way to handle Packets - Version Independent

  1. Dablakbandit
    Handle Server and Player packets with ease. Version Independent
    Includes an almost complete packet wrapper to easily access fields from the packets.

    Example:
    Code (Text):
    PacketListenerAPI.getInstance().addListener(new PacketListener(){

                @Override
                public void onPlayerPacketSend(PlayerPacketSend packet){
                    Packet p = packet.getPacket();
                    //This Packet is the wrapper class
                    Object o = packet.getPacket().getPacket();
                    //This is the real packet
                    PacketType pt = packet.getPacket().getPacketType();
                    //The PacketType, this is version safe
                }

                @Override
                public void onPlayerPacketReceive(PlayerPacketReceive packet){
                    if(packet.getPacket().getPacketType().equals(PacketType.PacketPlayInTabComplete)){
                        PacketPlayInTabComplete p = (PacketPlayInTabComplete) packet.getPacket();
                        if(p.hasA()){
                            //Checks if the packet has the field a
                            String s = p.getA();
                            //Returns the field a String
                            p.setA("Test");
                            //Sets the field a to "Test"
                        }
                    }
                }

                @Override
                public void onServerPacketSend(ServerPacketSend packet){
                    if(packet.getPacket().getPacketType().equals(PacketType.PacketStatusOutServerInfo)){
                        PacketStatusOutServerInfo p = (PacketStatusOutServerInfo) packet.getPacket();
                        if(p.hasB()){
                            //Checks if the packet has the field b
                            Object o = p.getB();
                            //Returns a Object because the b field is of net.minecraft.server.<version>.ServerPing
                        }
                    }
                }

                @Override
                public void onServerPacketReceive(ServerPacketReceive packet){
                    if(packet.getPacket().getPacketType().equals(PacketType.PacketStatusInPing)){
                        PacketStatusInPing p = (PacketStatusInPing) packet.getPacket();
                        if(p.hasA()){
                            //Checks if the packet has the field a
                            long a = p.getA();
                            //The field a from the PacketStatusInPing packet
                        }
                    }
                }

            });
    Source

Recent Reviews

  1. brainsynder
    brainsynder
    4/5,
    Version: 1.0c
    This is a awesome LIB i will use this on my plugins. Good job.
    1. Dablakbandit
      Author's Response
      Thanks :D, I will be adding all the constructors for the packets soon :)