You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Instantiate the required registriesEventRegistryeventRegistry = newEventRegistry();
IPacketRegistryregistry = newSimplePacketRegistry();
// Register a packet with the id 1registry.registerPacket(1, TestPacket.class);
// Register a PacketSubscriber for the registered packet// Normally this would have been made in an external class to ensure a better readabilityeventRegistry.registerEvents(newObject() {
// The method signature of a PacketSubscriber must contain a valid packet and may contain the ChannelHandlerContext (optional)@PacketSubscriberpublicvoidonPacketReceive(TestPacketpacket, ChannelHandlerContextctx) {
System.out.println("Received " + packet.getUuid().toString() + " from " + ctx.channel().remoteAddress().toString());
}
});