From 9b5ffa22554f9e32220e41910c6e03d145348693 Mon Sep 17 00:00:00 2001 From: Player Name Date: Tue, 21 Jul 2026 15:48:35 +0200 Subject: [PATCH] don't invent start position if you don't have one yet --- Server/src/main/core/game/node/entity/npc/NPC.java | 2 +- .../player/info/login/LoginConfiguration.java | 2 +- .../src/main/core/game/world/map/RegionManager.kt | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Server/src/main/core/game/node/entity/npc/NPC.java b/Server/src/main/core/game/node/entity/npc/NPC.java index 15877b6f8..07acec56f 100644 --- a/Server/src/main/core/game/node/entity/npc/NPC.java +++ b/Server/src/main/core/game/node/entity/npc/NPC.java @@ -214,7 +214,7 @@ public class NPC extends Entity { getProperties().setSpawnLocation(getLocation()); initConfig(); Repository.getNpcs().add(this); - RegionManager.move(this, ServerConstants.START_LOCATION, location); + RegionManager.move(this, null, location); if (getLocation().getRegion().isActive()) { Repository.addRenderableNPC(this); } diff --git a/Server/src/main/core/game/node/entity/player/info/login/LoginConfiguration.java b/Server/src/main/core/game/node/entity/player/info/login/LoginConfiguration.java index 4a7c87c91..5133f4a58 100644 --- a/Server/src/main/core/game/node/entity/player/info/login/LoginConfiguration.java +++ b/Server/src/main/core/game/node/entity/player/info/login/LoginConfiguration.java @@ -130,7 +130,7 @@ public final class LoginConfiguration { Repository.getLobbyPlayers().remove(player); player.setPlaying(true); UpdateSequence.getRenderablePlayers().add(player); - RegionManager.move(player, ServerConstants.START_LOCATION, player.getLocation()); + RegionManager.move(player, null, player.getLocation()); player.getMusicPlayer().init(); player.updateAppearance(); player.getPlayerFlags().setUpdateSceneGraph(true); diff --git a/Server/src/main/core/game/world/map/RegionManager.kt b/Server/src/main/core/game/world/map/RegionManager.kt index 7d5feb87a..16c0deccd 100644 --- a/Server/src/main/core/game/world/map/RegionManager.kt +++ b/Server/src/main/core/game/world/map/RegionManager.kt @@ -378,17 +378,21 @@ object RegionManager { * @param entity The entity. */ @JvmStatic - fun move(entity: Entity, src: Location, dst: Location) { - if (src.chunk != dst.chunk) { + fun move(entity: Entity, src: Location?, dst: Location) { + if (src?.chunk != dst.chunk) { when (entity) { is Player -> { - src.chunk.removePlayer(entity) - src.region.decrementViewAmount() + if (src != null) { + src.chunk.removePlayer(entity) + src.region.decrementViewAmount() + } dst.chunk.addPlayer(entity) dst.region.incrementViewAmount() } is NPC -> { - src.chunk.remove(entity) + if (src != null) { + src.chunk.remove(entity) + } dst.chunk.add(entity) } else -> {