mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-19 02:15:45 +01:00
Convert to the far superior config system
This commit is contained in:
@@ -30,11 +30,9 @@ import java.net.InetSocketAddress;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
import static emu.grasscutter.Configuration.*;
|
||||
|
||||
public final class GameServer extends KcpServer {
|
||||
private final InetSocketAddress address;
|
||||
@@ -59,8 +57,8 @@ public final class GameServer extends KcpServer {
|
||||
|
||||
public GameServer() {
|
||||
this(new InetSocketAddress(
|
||||
Grasscutter.getConfig().getGameServerOptions().Ip,
|
||||
Grasscutter.getConfig().getGameServerOptions().Port
|
||||
GAME_INFO.bindAddress,
|
||||
GAME_INFO.bindPort
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import emu.grasscutter.server.game.GameSession.SessionState;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import static emu.grasscutter.Configuration.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class GameServerPacketHandler {
|
||||
private final Int2ObjectMap<PacketHandler> handlers;
|
||||
@@ -92,7 +94,7 @@ public class GameServerPacketHandler {
|
||||
}
|
||||
|
||||
// Log unhandled packets
|
||||
if (Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING) {
|
||||
if (SERVER.debugLevel == ServerDebugMode.MISSING) {
|
||||
Grasscutter.getLogger().info("Unhandled packet (" + opcode + "): " + emu.grasscutter.net.packet.PacketOpcodesUtil.getOpcodeName(opcode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package emu.grasscutter.server.game;
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
@@ -23,9 +22,10 @@ import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
import static emu.grasscutter.Configuration.*;
|
||||
|
||||
public class GameSession extends KcpChannel {
|
||||
private GameServer server;
|
||||
private final GameServer server;
|
||||
|
||||
private Account account;
|
||||
private Player player;
|
||||
@@ -140,7 +140,7 @@ public class GameSession extends KcpChannel {
|
||||
}
|
||||
|
||||
public void replayPacket(int opcode, String name) {
|
||||
String filePath = Grasscutter.getConfig().PACKETS_FOLDER + name;
|
||||
String filePath = PACKETS_FOLDER + name;
|
||||
File p = new File(filePath);
|
||||
|
||||
if (!p.exists()) return;
|
||||
@@ -172,7 +172,7 @@ public class GameSession extends KcpChannel {
|
||||
}
|
||||
|
||||
// Log
|
||||
if (Grasscutter.getConfig().DebugMode == ServerDebugMode.ALL) {
|
||||
if (SERVER.debugLevel == ServerDebugMode.ALL) {
|
||||
logPacket(packet);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public class GameSession extends KcpChannel {
|
||||
}
|
||||
|
||||
// Log packet
|
||||
if (Grasscutter.getConfig().DebugMode == ServerDebugMode.ALL) {
|
||||
if (SERVER.debugLevel == ServerDebugMode.ALL) {
|
||||
if (!loopPacket.contains(opcode)) {
|
||||
Grasscutter.getLogger().info("RECV: " + PacketOpcodesUtil.getOpcodeName(opcode) + " (" + opcode + ")");
|
||||
System.out.println(Utils.bytesToHex(payload));
|
||||
|
||||
Reference in New Issue
Block a user