mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 13:13:06 +08:00
unload scene when there are no players (#2147)
* unload scene when there are no players * Update src/main/java/emu/grasscutter/game/world/Scene.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:
parent
c425fb12c4
commit
ef263cb326
@ -511,6 +511,10 @@ public final class Scene {
|
|||||||
this.finishLoading();
|
this.finishLoading();
|
||||||
this.checkPlayerRespawn();
|
this.checkPlayerRespawn();
|
||||||
if (this.tickCount++ % 10 == 0) this.broadcastPacket(new PacketSceneTimeNotify(this));
|
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. */
|
/** Validates a player's current position. Teleports the player if the player is out of bounds. */
|
||||||
|
Loading…
Reference in New Issue
Block a user