mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-24 15:42:53 +08:00
Handle ClientLockGameTimeNotify
over sending it
This commit is contained in:
parent
061782f555
commit
f7b25df91c
@ -532,9 +532,6 @@ public final class World implements Iterable<Player> {
|
||||
*/
|
||||
public void lockTime(boolean locked) {
|
||||
this.timeLocked = locked;
|
||||
|
||||
// Broadcast the state change.
|
||||
this.broadcastPacket(new PacketClientLockGameTimeNotify(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user