From 29f6d77e2f83e7d3c14f21ce2dadac12c7a45cdb Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Thu, 21 Apr 2022 00:28:28 -0700 Subject: [PATCH 1/2] Add config entry for OverseaLogPort (default: 8888) --- src/main/java/emu/grasscutter/Config.java | 1 + .../java/emu/grasscutter/server/dispatch/DispatchServer.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index dddbbfa9e..4d4cf4a38 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -13,6 +13,7 @@ public final class Config { public String GameServerPublicIp = ""; public int GameServerPort = 22102; + public int OverseaLogPort = 8888; public int UploadLogPort = 80; public String DatabaseUrl = "mongodb://localhost:27017"; diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index f13b9dc2f..6b4336858 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -410,7 +410,7 @@ public final class DispatchServer { Grasscutter.getLogger().info("Dispatch server started on port " + getAddress().getPort()); // Logging servers - HttpServer overseaLogServer = HttpServer.create(new InetSocketAddress(Grasscutter.getConfig().DispatchServerIp, 8888), 0); + HttpServer overseaLogServer = HttpServer.create(new InetSocketAddress(Grasscutter.getConfig().DispatchServerIp, Grasscutter.getConfig().OverseaLogPort), 0); overseaLogServer.createContext( // overseauspider.yuanshen.com "/log", new DispatchHttpJsonHandler("{\"code\":0}") From bc07fa77b207398f1f2dfab585f5bdf4916a916c Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Thu, 21 Apr 2022 00:29:06 -0700 Subject: [PATCH 2/2] Make sure SetEntityClientDataNotify is a valid proto before replaying it to the other players --- .../packet/recv/HandlerSetEntityClientDataNotify.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java index 1a60f677b..d194e1465 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java @@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.server.game.GameSession; @@ -16,8 +17,11 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler { return; } + // Make sure packet is a valid proto before replaying it to the other players + SetEntityClientDataNotify notif = SetEntityClientDataNotify.parseFrom(payload); + GenshinPacket packet = new GenshinPacket(PacketOpcodes.SetEntityClientDataNotify, true); - packet.setData(payload); + packet.setData(notif); session.getPlayer().getScene().broadcastPacketToOthers(session.getPlayer(), packet); }