mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 22:34:35 +01:00
Fix issues with random stuff not loading when logging in
This commit is contained in:
@@ -50,7 +50,7 @@ public class GameServerPacketHandler {
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
// Check cooldown to prevent packet spam
|
// Check cooldown to prevent packet spam
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
if (session.getPacketCooldown().get(cmdId) >= timestamp) {
|
if (session.getPacketCooldown().get(cmdId) >= timestamp && !CmdIdUtils.ALLOWED_FILTER_PACKETS.contains(cmdId)) {
|
||||||
//LunarCore.getLogger().warn("Dropped a packet " + CmdIdUtils.getCmdIdName(cmdId));
|
//LunarCore.getLogger().warn("Dropped a packet " + CmdIdUtils.getCmdIdName(cmdId));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class GameSession {
|
|||||||
|
|
||||||
// Log packet
|
// Log packet
|
||||||
if (LunarCore.getConfig().getLogOptions().packets) {
|
if (LunarCore.getConfig().getLogOptions().packets) {
|
||||||
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(opcode))) {
|
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.IGNORED_LOG_PACKETS.contains(opcode))) {
|
||||||
logPacket("RECV", opcode, data);
|
logPacket("RECV", opcode, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,8 +159,8 @@ public class GameSession {
|
|||||||
|
|
||||||
// Log
|
// Log
|
||||||
if (LunarCore.getConfig().getLogOptions().packets) {
|
if (LunarCore.getConfig().getLogOptions().packets) {
|
||||||
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(packet.getCmdId()))) {
|
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.IGNORED_LOG_PACKETS.contains(packet.getCmdId()))) {
|
||||||
logPacket("RECV", packet.getCmdId(), packet.getData());
|
logPacket("SEND", packet.getCmdId(), packet.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ public class GameSession {
|
|||||||
|
|
||||||
// Log
|
// Log
|
||||||
if (LunarCore.getConfig().getLogOptions().packets) {
|
if (LunarCore.getConfig().getLogOptions().packets) {
|
||||||
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.LOOP_PACKETS.contains(cmdId))) {
|
if (!(LunarCore.getConfig().getLogOptions().filterLoopingPackets && CmdIdUtils.IGNORED_LOG_PACKETS.contains(cmdId))) {
|
||||||
logPacket("SEND", cmdId, Utils.EMPTY_BYTE_ARRAY);
|
logPacket("SEND", cmdId, Utils.EMPTY_BYTE_ARRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
|
|
||||||
public class CmdIdUtils {
|
public class CmdIdUtils {
|
||||||
public static final IntSet LOOP_PACKETS = IntOpenHashSet.of(
|
/**
|
||||||
|
* Packet ids that will NOT be logged if "filterLoopingPackets" is true in the config
|
||||||
|
*/
|
||||||
|
public static final IntSet IGNORED_LOG_PACKETS = IntOpenHashSet.of(
|
||||||
CmdId.PlayerHeartBeatCsReq,
|
CmdId.PlayerHeartBeatCsReq,
|
||||||
CmdId.PlayerHeartBeatScRsp,
|
CmdId.PlayerHeartBeatScRsp,
|
||||||
CmdId.SceneEntityMoveCsReq,
|
CmdId.SceneEntityMoveCsReq,
|
||||||
@@ -24,6 +27,18 @@ public class CmdIdUtils {
|
|||||||
CmdId.GetQuestDataScRsp
|
CmdId.GetQuestDataScRsp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Packet ids that will NOT be caught by the spam filter
|
||||||
|
*/
|
||||||
|
public static final IntSet ALLOWED_FILTER_PACKETS = IntOpenHashSet.of(
|
||||||
|
CmdId.PlayerGetTokenCsReq,
|
||||||
|
CmdId.PlayerLoginCsReq,
|
||||||
|
CmdId.PlayerHeartBeatCsReq,
|
||||||
|
CmdId.GetMissionStatusCsReq,
|
||||||
|
CmdId.GetMissionStatusCsReq,
|
||||||
|
CmdId.GetMissionEventDataCsReq
|
||||||
|
);
|
||||||
|
|
||||||
private static Int2ObjectMap<String> cmdIdMap;
|
private static Int2ObjectMap<String> cmdIdMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
Reference in New Issue
Block a user