Fix lock clock (#2201)

* Fix lock clock

* Update src/main/java/emu/grasscutter/game/world/World.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/server/packet/recv/HandlerClientLockGameTimeNotify.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/server/packet/recv/HandlerClientLockGameTimeNotify.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

---------

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
This commit is contained in:
Nazrin 2023-06-10 20:32:23 -07:00 committed by GitHub
parent 2788206934
commit 15699e562a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,8 @@ public class World implements Iterable<Player> {
private int nextPeerId = 0;
private int worldLevel;
@Getter private boolean isMultiplayer, timeLocked = false;
@Getter private boolean isMultiplayer = false;
@Getter private boolean timeLocked;
private long lastUpdateTime;
@Getter private int tickCount = 0;
@ -56,6 +57,7 @@ public class World implements Iterable<Player> {
this.entity = new EntityWorld(this);
this.worldLevel = player.getWorldLevel();
this.isMultiplayer = isMultiplayer;
this.timeLocked = player.getProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED) != 0;
this.lastUpdateTime = System.currentTimeMillis();
this.currentWorldTime = host.getPlayerGameTime();

View File

@ -1,5 +1,6 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
@ -11,6 +12,8 @@ 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());
// session.getPlayer().getWorld().lockTime(packet.getIsLock());
// TODO: figure out what to implement here
if (packet.getIsLock()) Grasscutter.getLogger().warn("Invalid 'ClientLockGameTimeNotify' received; value is true. (please report to development channel)");
}
}