mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 17:19:58 +02:00
29 lines
917 B
Java
29 lines
917 B
Java
package emu.nebula.server.handlers;
|
|
|
|
import emu.nebula.net.NetHandler;
|
|
import emu.nebula.net.NetMsgId;
|
|
import emu.nebula.proto.InfinityTowerApply.InfinityTowerApplyReq;
|
|
import emu.nebula.net.HandlerId;
|
|
import emu.nebula.net.GameSession;
|
|
|
|
@HandlerId(NetMsgId.infinity_tower_apply_req)
|
|
public class HandlerInfinityTowerApplyReq extends NetHandler {
|
|
|
|
@Override
|
|
public byte[] handle(GameSession session, byte[] message) throws Exception {
|
|
// Template hanlder
|
|
var req = InfinityTowerApplyReq.parseFrom(message);
|
|
|
|
// Apply
|
|
boolean success = session.getPlayer().getInfinityTowerManager().apply(req.getLevelId(), req.getBuildId());
|
|
|
|
if (!success) {
|
|
return session.encodeMsg(NetMsgId.infinity_tower_apply_failed_ack);
|
|
}
|
|
|
|
// Encode and send
|
|
return session.encodeMsg(NetMsgId.infinity_tower_apply_succeed_ack);
|
|
}
|
|
|
|
}
|