fix: login too slow (#2380)

This commit is contained in:
hamusuke 2023-09-21 10:23:08 +09:00 committed by GitHub
parent ec2bfffdd1
commit 5ee4812ac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 6 deletions

View File

@ -25,7 +25,6 @@ public class HomeWorld extends World {
this.home = owner.isOnline() ? owner.getHome() : GameHome.getByUid(owner.getUid()); this.home = owner.isOnline() ? owner.getHome() : GameHome.getByUid(owner.getUid());
this.refreshModuleManager(); this.refreshModuleManager();
server.registerHomeWorld(this);
} }
@Override @Override

View File

@ -72,6 +72,8 @@ public class World implements Iterable<Player> {
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>()); this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
this.entity = new EntityWorld(this); this.entity = new EntityWorld(this);
this.lastUpdateTime = System.currentTimeMillis(); this.lastUpdateTime = System.currentTimeMillis();
server.registerWorld(this);
} }
public int getLevelEntityId() { public int getLevelEntityId() {

View File

@ -311,11 +311,6 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
world.save(); // Save the player's world 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) { public HomeWorld getHomeWorldOrCreate(Player owner) {
return this.getHomeWorlds() return this.getHomeWorlds()
.computeIfAbsent(owner.getUid(), (uid) -> new HomeWorld(this, owner)); .computeIfAbsent(owner.getUid(), (uid) -> new HomeWorld(this, owner));