mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package com.l2jserver.game.net.handler;
|
|
|
|
import org.jboss.netty.channel.ChannelHandlerContext;
|
|
import org.jboss.netty.channel.ChannelStateEvent;
|
|
import org.jboss.netty.channel.MessageEvent;
|
|
import org.jboss.netty.channel.SimpleChannelHandler;
|
|
|
|
import com.l2jserver.game.net.Lineage2Connection;
|
|
import com.l2jserver.game.net.packet.ClientPacket;
|
|
|
|
public class Lineage2PacketHandler extends SimpleChannelHandler {
|
|
private Lineage2Connection connection;
|
|
|
|
@Override
|
|
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
|
|
throws Exception {
|
|
connection = new Lineage2Connection(e.getChannel());
|
|
super.channelOpen(ctx, e);
|
|
}
|
|
|
|
@Override
|
|
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
|
|
throws Exception {
|
|
final Object msg = e.getMessage();
|
|
if (!(msg instanceof ClientPacket))
|
|
return;
|
|
final ClientPacket packet = (ClientPacket) msg;
|
|
packet.process(connection, null);
|
|
super.messageReceived(ctx, e);
|
|
}
|
|
|
|
@Override
|
|
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
|
|
throws Exception {
|
|
super.writeRequested(ctx, e);
|
|
}
|
|
}
|