Handle ClientLockGameTimeNotify over sending it

This commit is contained in:
KingRainbow44 2023-05-09 17:09:42 -04:00
parent 061782f555
commit f7b25df91c
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
3 changed files with 16 additions and 21 deletions

View File

@ -532,9 +532,6 @@ public final class World implements Iterable<Player> {
*/ */
public void lockTime(boolean locked) { public void lockTime(boolean locked) {
this.timeLocked = locked; this.timeLocked = locked;
// Broadcast the state change.
this.broadcastPacket(new PacketClientLockGameTimeNotify(this));
} }
@Override @Override

View File

@ -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());
}
}

View File

@ -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);
}
}