diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 53df23dde..416c99ab7 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -532,9 +532,6 @@ public final class World implements Iterable { */ public void lockTime(boolean locked) { this.timeLocked = locked; - - // Broadcast the state change. - this.broadcastPacket(new PacketClientLockGameTimeNotify(this)); } @Override diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientLockGameTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientLockGameTimeNotify.java new file mode 100644 index 000000000..095ed163c --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientLockGameTimeNotify.java @@ -0,0 +1,16 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.ClientLockGameTimeNotifyOuterClass.ClientLockGameTimeNotify; +import emu.grasscutter.server.game.GameSession; + +@Opcodes(PacketOpcodes.ClientLockGameTimeNotify) +public final class HandlerClientLockGameTimeNotify extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + var packet = ClientLockGameTimeNotify.parseFrom(payload); + session.getPlayer().getWorld().lockTime(packet.getIsLock()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketClientLockGameTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketClientLockGameTimeNotify.java deleted file mode 100644 index bad6e84bd..000000000 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketClientLockGameTimeNotify.java +++ /dev/null @@ -1,18 +0,0 @@ -package emu.grasscutter.server.packet.send; - -import emu.grasscutter.game.world.World; -import emu.grasscutter.net.packet.BasePacket; -import emu.grasscutter.net.packet.PacketOpcodes; -import emu.grasscutter.net.proto.ClientLockGameTimeNotifyOuterClass.ClientLockGameTimeNotify; - -public final class PacketClientLockGameTimeNotify extends BasePacket { - public PacketClientLockGameTimeNotify(World world) { - super(PacketOpcodes.ClientLockGameTimeNotify); - - var packet = ClientLockGameTimeNotify.newBuilder() - .setIsLock(world.isTimeLocked()) - .build(); - - this.setData(packet); - } -}