Handle Server and Player packets with ease. Version Independent
Includes an almost complete packet wrapper to easily access fields from the packets.
Example:
SourceCode (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
}
}
}
});

PacketLib 1.0d
Easy way to handle Packets - Version Independent
Recent Updates
- Finished setters/getters for all fields in all packets Jun 24, 2015
- Fixed method names Apr 8, 2015
- Fixed bugs and errors, started on constructors Mar 31, 2015