diff --git a/src/main/java/emu/grasscutter/config/ConfigContainer.java b/src/main/java/emu/grasscutter/config/ConfigContainer.java index 1be3c942814..e80b51a0afe 100644 --- a/src/main/java/emu/grasscutter/config/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/config/ConfigContainer.java @@ -35,9 +35,10 @@ public class ConfigContainer { * HTTP server should start immediately. * Version 13 - 'game.useUniquePacketKey' was added to control whether the * encryption key used for packets is a constant or randomly generated. + * Version 14 - 添加热更新配置 添加弹窗信息配置 */ private static int version() { - return 13; + return 14; } /** @@ -418,6 +419,7 @@ public VisionOptions(String name, int visionRange, int gridWidth) { } public static class JoinOptions { + public static String noticeMessage = "Welcome to a Grasscutter server."; public int[] welcomeEmotes = {2007, 1002, 4010}; public String welcomeMessage = "Welcome to a Grasscutter server."; public JoinOptions.Mail welcomeMail = new JoinOptions.Mail(); diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLib.java b/src/main/java/emu/grasscutter/scripts/ScriptLib.java index 48f35986aa3..356c2072707 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLib.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLib.java @@ -2015,9 +2015,9 @@ public int[] GetGatherConfigIdList() { * 对原版 lua 不支持 * */ - //弹窗alert 用法: ScriptLib.alert(context, 1, "hello world 666") then - public int alert(int MsgType, String msg) { - sceneScriptManager.get().getScene().broadcastPacket(new PacketAntiAddictNotify(MsgType, msg)); + //弹窗 Notice 用法: ScriptLib.alert(context, 1, "hello world 666") then + public int Notice(int MsgType, String Msg) { + sceneScriptManager.get().getScene().broadcastPacket(new PacketAntiAddictNotify(MsgType, Msg)); return 0; } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java index 231304997af..aaf410a5322 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java @@ -1,7 +1,9 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.net.packet.*; +import emu. grasscutter.config.ConfigContainer.JoinOptions; import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketAntiAddictNotify; import emu.grasscutter.server.packet.send.PacketTowerAllDataRsp; @Opcodes(PacketOpcodes.TowerAllDataReq) @@ -9,6 +11,7 @@ public class HandlerTowerAllDataReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + session.send(new PacketAntiAddictNotify(1, JoinOptions.noticeMessage)); session.send( new PacketTowerAllDataRsp( session.getServer().getTowerSystem(), session.getPlayer().getTowerManager())); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAntiAddictNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAntiAddictNotify.java index 284fe9fa978..4630b57bb70 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAntiAddictNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAntiAddictNotify.java @@ -5,12 +5,12 @@ import emu.grasscutter.net.proto.AntiAddictNotifyOuterClass.AntiAddictNotify; public class PacketAntiAddictNotify extends BasePacket { - public PacketAntiAddictNotify(int MsgType, String msg) { + public PacketAntiAddictNotify(int MsgType, String Msg) { super(PacketOpcodes.AntiAddictNotify); AntiAddictNotify proto = AntiAddictNotify.newBuilder() .setMsgType(MsgType) - .setMsg(msg) + .setMsg(Msg) .build(); this.setData(proto);