mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-21 19:34:42 +01:00
Handle ClientLockGameTimeNotify over sending it
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user