diff --git a/AriasServerUtils/RTPFactory.cs b/AriasServerUtils/RTPFactory.cs index d1d017e..a891813 100644 --- a/AriasServerUtils/RTPFactory.cs +++ b/AriasServerUtils/RTPFactory.cs @@ -168,9 +168,36 @@ public class RTPFactory // Log the request ChunkChecks.Add(chunk); - // Load the chunk - worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ); + // Check if the chunk's coordinates are loaded + var cxCheck = ServerUtilities.API.World.IsFullyLoadedChunk(position.GetBlockPos()); + if (cxCheck) + { + // Process the check here, no need to load + var posX = GetSafePosition(rtp, position); + if (posX == null) + { + // Let this get checked again + ServerUtilities.API.Logger.Notification("position null: resume search"); + } + else + { + // Found! Perform teleport and remove the RTP Check + RTPCache.Remove(rtp); + posX.Merge(rtp.player.Entity); + + ServerUtilities.SendMessageTo(rtp.player, Lang.Get($"{ServerUtilities.MOD_ID}:rtp", GetDistance(new Vec2i(rtp.StartPosition.X, rtp.StartPosition.Z), new Vec2i(posX.X, posX.Z)))); + + ServerUtilities.API.Logger.Notification("position found"); + } + + ChunkChecks.Remove(chunk); + } + else + { + // Load the chunk + worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ); + } } } diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index db75f3d..f4dd3b9 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 11:52 AM MST", - "version": "1.0.6-dev.17", + "description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 11:55 AM MST", + "version": "1.0.6-dev.18", "dependencies": { "game": "" }