mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-09 03:42:57 +08:00
Change method of not ticking empty scenes (#2211)
This commit is contained in:
parent
248af4abfb
commit
89376d58bf
@ -556,10 +556,6 @@ public final class Scene {
|
||||
this.finishLoading();
|
||||
this.checkPlayerRespawn();
|
||||
if (this.tickCount++ % 10 == 0) this.broadcastPacket(new PacketSceneTimeNotify(this));
|
||||
if (this.getPlayerCount() <= 0 && !this.dontDestroyWhenEmpty) {
|
||||
this.getScriptManager().onDestroy();
|
||||
this.getWorld().deregisterScene(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** Validates a player's current position. Teleports the player if the player is out of bounds. */
|
||||
|
@ -437,7 +437,9 @@ public class World implements Iterable<Player> {
|
||||
// Check if there are players in this world.
|
||||
if (this.getPlayerCount() == 0) return true;
|
||||
// Tick all associated scenes.
|
||||
this.getScenes().forEach((k, scene) -> scene.onTick());
|
||||
this.getScenes().forEach((k, scene) -> {
|
||||
if (scene.getPlayerCount() > 0) scene.onTick();
|
||||
});
|
||||
|
||||
// sync time every 10 seconds
|
||||
if (this.tickCount % 10 == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user