mirror of
https://github.com/Melledy/Nebula.git
synced 2026-11-04 21:36:51 +01:00
Initial Commit
This commit is contained in:
commit
f58951fe2a
378 files changed
+315914
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package emu.nebula.server.handlers;
|
||||
|
||||
import emu.nebula.net.NetHandler;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.StarTowerInteract.StarTowerInteractReq;
|
||||
import emu.nebula.net.HandlerId;
|
||||
import emu.nebula.net.GameSession;
|
||||
|
||||
@HandlerId(NetMsgId.star_tower_interact_req)
|
||||
public class HandlerStarTowerInteractReq extends NetHandler {
|
||||
|
||||
@Override
|
||||
public byte[] handle(GameSession session, byte[] message) throws Exception {
|
||||
// Get star tower instance
|
||||
var instance = session.getPlayer().getStarTowerManager().getInstance();
|
||||
|
||||
if (instance == null) {
|
||||
return this.encodeMsg(NetMsgId.star_tower_interact_failed_ack);
|
||||
}
|
||||
|
||||
// Parse request
|
||||
var req = StarTowerInteractReq.parseFrom(message);
|
||||
|
||||
// Handle interaction
|
||||
var rsp = instance.handleInteract(req);
|
||||
|
||||
// Template
|
||||
return this.encodeMsg(NetMsgId.star_tower_interact_succeed_ack, rsp);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user