From 5ee4812ac5b5353daf44bd3f8029239ab92b979d Mon Sep 17 00:00:00 2001 From: hamusuke Date: Thu, 21 Sep 2023 10:23:08 +0900 Subject: [PATCH] fix: login too slow (#2380) --- src/main/java/emu/grasscutter/game/home/HomeWorld.java | 1 - src/main/java/emu/grasscutter/game/world/World.java | 2 ++ src/main/java/emu/grasscutter/server/game/GameServer.java | 5 ----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/home/HomeWorld.java b/src/main/java/emu/grasscutter/game/home/HomeWorld.java index 1beee4e81..1200a0f97 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeWorld.java +++ b/src/main/java/emu/grasscutter/game/home/HomeWorld.java @@ -25,7 +25,6 @@ public class HomeWorld extends World { this.home = owner.isOnline() ? owner.getHome() : GameHome.getByUid(owner.getUid()); this.refreshModuleManager(); - server.registerHomeWorld(this); } @Override diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 2f1a1d98e..707fe6db6 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -72,6 +72,8 @@ public class World implements Iterable { this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>()); this.entity = new EntityWorld(this); this.lastUpdateTime = System.currentTimeMillis(); + + server.registerWorld(this); } public int getLevelEntityId() { diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 1787f93ea..ecd6b1425 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -311,11 +311,6 @@ public final class GameServer extends KcpServer implements Iterable { world.save(); // Save the player's world } - public void registerHomeWorld(HomeWorld homeWorld) { - this.getHomeWorlds().put(homeWorld.getOwnerUid(), homeWorld); - this.registerWorld(homeWorld); - } - public HomeWorld getHomeWorldOrCreate(Player owner) { return this.getHomeWorlds() .computeIfAbsent(owner.getUid(), (uid) -> new HomeWorld(this, owner));