diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index a2f46d394..25db3ccd0 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -723,6 +723,17 @@ public class Player implements PlayerHook { return playerProfile; } + /** + * Sets a player's property. + * + * @param prop The property. + * @param value The value as a boolean. + * @return True if the property was set. + */ + public boolean setProperty(PlayerProperty prop, boolean value) { + return setPropertyWithSanityCheck(prop, value ? 1 : 0, true); + } + public boolean setProperty(PlayerProperty prop, int value) { return setPropertyWithSanityCheck(prop, value, true); } diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 3e7427411..dda06dfff 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -1,13 +1,12 @@ package emu.grasscutter.game.world; -import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT; - import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.dungeon.DungeonData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.EntityIdType; +import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.SceneType; import emu.grasscutter.game.quest.enums.QuestContent; import emu.grasscutter.game.world.data.TeleportProperties; @@ -23,13 +22,16 @@ import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.Getter; +import lombok.val; + import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; -import lombok.Getter; -import lombok.val; + +import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT; public final class World implements Iterable { @Getter private final GameServer server; @@ -532,6 +534,10 @@ public final class World implements Iterable { */ public void lockTime(boolean locked) { this.timeLocked = locked; + + // Notify players of the locking. + this.getPlayers().forEach(player -> + player.setProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED, locked)); } @Override