use of org.apollo.net.codec.game.GameMessageDecoder in project apollo by apollo-rsps.
the class LoginSession method sendLoginSuccess.
/**
* Sends a succesfull {@link LoginResponse} to the client.
*
* @param player The {@link Player} that successfully logged in.
*/
public void sendLoginSuccess(Player player) {
IsaacRandomPair randomPair = request.getRandomPair();
boolean flagged = false;
GameSession session = new GameSession(channel, context, player, request.isReconnecting());
channel.attr(ApolloHandler.SESSION_KEY).set(session);
player.setSession(session);
int rights = player.getPrivilegeLevel().toInteger();
channel.writeAndFlush(new LoginResponse(LoginConstants.STATUS_OK, rights, flagged));
Release release = context.getRelease();
channel.pipeline().addFirst("messageEncoder", new GameMessageEncoder(release));
channel.pipeline().addBefore("messageEncoder", "gameEncoder", new GamePacketEncoder(randomPair.getEncodingRandom()));
channel.pipeline().addBefore("handler", "gameDecoder", new GamePacketDecoder(randomPair.getDecodingRandom(), context.getRelease()));
channel.pipeline().addAfter("gameDecoder", "messageDecoder", new GameMessageDecoder(release));
channel.pipeline().remove("loginDecoder");
channel.pipeline().remove("loginEncoder");
}
Aggregations