mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-11-23 12:29:53 +00:00
Cleanup unnecessary code
This commit is contained in:
parent
90d7bfee88
commit
17c3ebab16
@ -9,12 +9,12 @@ import org.jline.reader.UserInterruptException;
|
||||
import org.jline.reader.impl.LineReaderImpl;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import emu.lunarcore.command.CommandManager;
|
||||
import emu.lunarcore.data.ResourceLoader;
|
||||
import emu.lunarcore.database.DatabaseManager;
|
||||
@ -25,7 +25,7 @@ import emu.lunarcore.util.JsonUtils;
|
||||
import lombok.Getter;
|
||||
|
||||
public class LunarCore {
|
||||
private static final Logger log = (Logger) LoggerFactory.getLogger(LunarCore.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(LunarCore.class);
|
||||
private static File configFile = new File("./config.json");
|
||||
@Getter private static Config config;
|
||||
|
||||
@ -67,6 +67,8 @@ public class LunarCore {
|
||||
|
||||
// Load commands
|
||||
LunarCore.commandManager = new CommandManager();
|
||||
|
||||
// Load plugin manager
|
||||
LunarCore.pluginManager = new PluginManager();
|
||||
|
||||
try {
|
||||
@ -131,12 +133,13 @@ public class LunarCore {
|
||||
} catch (Exception exception) {
|
||||
LunarCore.getLogger().error("Unable to start the game server.", exception);
|
||||
}
|
||||
|
||||
LunarCore.getPluginManager().enablePlugins();
|
||||
|
||||
|
||||
// Hook into shutdown event
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(LunarCore::onShutdown));
|
||||
|
||||
// Enable plugins
|
||||
LunarCore.getPluginManager().enablePlugins();
|
||||
|
||||
// Start console
|
||||
LunarCore.startConsole();
|
||||
}
|
||||
|
@ -26,9 +26,8 @@ public class CommandArgs {
|
||||
private int rank = -1;
|
||||
private int promotion = -1;
|
||||
private int stage = -1;
|
||||
private Int2IntMap map;
|
||||
|
||||
private static String EMPTY_STRING = "";
|
||||
private Int2IntMap map;
|
||||
|
||||
public CommandArgs(Player sender, List<String> args) {
|
||||
this.sender = sender;
|
||||
@ -102,7 +101,7 @@ public class CommandArgs {
|
||||
|
||||
public String get(int index) {
|
||||
if (index < 0 || index >= list.size()) {
|
||||
return EMPTY_STRING;
|
||||
return "";
|
||||
}
|
||||
return this.list.get(index);
|
||||
}
|
||||
|
@ -136,18 +136,7 @@ public class GameData {
|
||||
}
|
||||
return id * 10; // or return a default value if needed
|
||||
}
|
||||
|
||||
public static List<Integer> getAllQuestIds() {
|
||||
List<Integer> allIds = new ArrayList<>();
|
||||
|
||||
for (Int2ObjectMap.Entry<QuestExcel> entry : questExcelMap.int2ObjectEntrySet()) {
|
||||
QuestExcel questExcel = entry.getValue();
|
||||
allIds.add(questExcel.getId());
|
||||
}
|
||||
|
||||
return allIds;
|
||||
}
|
||||
|
||||
|
||||
public static List<Integer> getAllMonsterIds() {
|
||||
List<Integer> allIds = new ArrayList<>();
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package emu.lunarcore.data.excel;
|
||||
|
||||
import org.h2.util.Utils;
|
||||
|
||||
import emu.lunarcore.data.GameResource;
|
||||
import emu.lunarcore.data.ResourceType;
|
||||
import emu.lunarcore.util.Utils;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.JoinLineupCsReqOuterClass.JoinLineupCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -15,7 +14,7 @@ public class HandlerJoinLineupCsReq extends PacketHandler {
|
||||
var req = JoinLineupCsReq.parseFrom(data);
|
||||
|
||||
session.getPlayer().getLineupManager().joinLineup(req.getIndex(), req.getSlot(), req.getBaseAvatarId());
|
||||
session.send(new BasePacket(CmdId.JoinLineupScRsp));
|
||||
session.send(CmdId.JoinLineupScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.LockEquipmentCsReqOuterClass.LockEquipmentCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -15,7 +14,7 @@ public class HandlerLockEquipmentCsReq extends PacketHandler {
|
||||
var req = LockEquipmentCsReq.parseFrom(data);
|
||||
|
||||
session.getServer().getInventoryService().lockEquip(session.getPlayer(), req.getEquipmentUniqueId(), req.getIsProtected());
|
||||
session.send(new BasePacket(CmdId.LockEquipmentScRsp));
|
||||
session.send(CmdId.LockEquipmentScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.LockRelicCsReqOuterClass.LockRelicCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -15,7 +14,7 @@ public class HandlerLockRelicCsReq extends PacketHandler {
|
||||
var req = LockRelicCsReq.parseFrom(data);
|
||||
|
||||
session.getServer().getInventoryService().lockEquip(session.getPlayer(), req.getRelicUniqueId(), req.getIsProtected());
|
||||
session.send(new BasePacket(CmdId.LockRelicScRsp));
|
||||
session.send(CmdId.LockRelicScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.QuitLineupCsReqOuterClass.QuitLineupCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -15,7 +14,7 @@ public class HandlerQuitLineupCsReq extends PacketHandler {
|
||||
var req = QuitLineupCsReq.parseFrom(data);
|
||||
|
||||
session.getPlayer().getLineupManager().quitLineup(req.getIndex(), req.getBaseAvatarId());
|
||||
session.send(new BasePacket(CmdId.QuitLineupScRsp));
|
||||
session.send(CmdId.QuitLineupScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import emu.lunarcore.proto.LineupSlotDataOuterClass.LineupSlotData;
|
||||
import emu.lunarcore.proto.ReplaceLineupCsReqOuterClass.ReplaceLineupCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -24,7 +23,7 @@ public class HandlerReplaceLineupCsReq extends PacketHandler {
|
||||
}
|
||||
|
||||
session.getPlayer().getLineupManager().replaceLineup(req.getIndex(), req.getExtraLineupTypeValue(), lineupList);
|
||||
session.send(new BasePacket(CmdId.ReplaceLineupScRsp));
|
||||
session.send(CmdId.ReplaceLineupScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.SceneEntityMoveCsReqOuterClass.SceneEntityMoveCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -23,7 +22,7 @@ public class HandlerSceneEntityMoveCsReq extends PacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
session.send(new BasePacket(CmdId.SceneEntityMoveScRsp));
|
||||
session.send(CmdId.SceneEntityMoveScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
import emu.lunarcore.proto.MsgTypeOuterClass.MsgType;
|
||||
import emu.lunarcore.proto.SendMsgCsReqOuterClass.SendMsgCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -23,7 +22,7 @@ public class HandlerSendMsgCsReq extends PacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
session.send(new BasePacket(CmdId.SendMsgScRsp));
|
||||
session.send(CmdId.SendMsgScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.SwapLineupCsReqOuterClass.SwapLineupCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
@ -15,7 +14,7 @@ public class HandlerSwapLineupCsReq extends PacketHandler {
|
||||
var req = SwapLineupCsReq.parseFrom(data);
|
||||
|
||||
session.getPlayer().getLineupManager().swapLineup(req.getIndex(), req.getSrcSlot(), req.getDstSlot());
|
||||
session.send(new BasePacket(CmdId.SwapLineupScRsp));
|
||||
session.send(CmdId.SwapLineupScRsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,18 +11,17 @@ public class PacketGetQuestDataScRsp extends BasePacket {
|
||||
|
||||
public PacketGetQuestDataScRsp() {
|
||||
super(CmdId.GetQuestDataScRsp);
|
||||
|
||||
var allIds = GameData.getAllQuestIds();
|
||||
|
||||
|
||||
var data = GetQuestDataScRsp.newInstance();
|
||||
//.setTotalAchievementExp(69);
|
||||
|
||||
for (int questId : allIds) {
|
||||
for (var questExcel : GameData.getQuestExcelMap().values()) {
|
||||
var questItem = Quest.newInstance()
|
||||
.setId(questId)
|
||||
.setId(questExcel.getQuestID())
|
||||
.setStatus(QuestStatus.QUEST_CLOSE)
|
||||
.setFinishTime(10000L)
|
||||
.setProgress(1);
|
||||
|
||||
data.addQuestList(questItem);
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,11 @@ public class Utils {
|
||||
private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray();
|
||||
|
||||
public static final Object EMPTY_OBJECT = new Object();
|
||||
public static final int[] EMPTY_ARRAY = new int[0];
|
||||
public static final int[] EMPTY_INT_ARRAY = new int[0];
|
||||
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
public static String bytesToHex(byte[] bytes) {
|
||||
if (bytes == null || bytes.length == 0) return EMPTY_STRING;
|
||||
if (bytes == null || bytes.length == 0) return "";
|
||||
char[] hexChars = new char[bytes.length * 2];
|
||||
for (int j = 0; j < bytes.length; j++) {
|
||||
int v = bytes[j] & 0xFF;
|
||||
|
Loading…
Reference in New Issue
Block a user