-
Notifications
You must be signed in to change notification settings - Fork 0
Automatic Packet Handlers
If you want your project to respond to a particular packet in a very similar way each time it receives that packet, then the AutoResponder class may prove very useful. This class provides an easy way to register a listener that will listen for an indicated packet type and will call the given Response when the specified packet is received.
Here's an example that sends back a JsonMessagePacket as a response to any JsonMessagePacket that it receives:
ResponseUtil.getDefaultResponder().respondTo(JsonMessagePacket.class, new Response() {
@Override
public void run() {
event.getConnection().sendPacket(new JsonMessagePacket("Thanks for the message!").setResponse(packet));
}
});The packet and event variables are set for you in Response automagically.
Basic IO
Basic Client
Basic Server
Authenticated IO
Authenticated Client
Authenticated Server
Mesh
Mesh Network
Authenticated Mesh
Packets
Creating Packets
Sending Packets
Listening for Packets
Automatic Handlers
Response Handlers
UPnP
Port Forwarding