From 850b32c389a4dd63d18e06063311d8b861893acf Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 16 Feb 2024 16:49:06 +0000 Subject: [PATCH] fix: fix bug where teleported avatars would lose their world reference --- VpSharp/src/Entities/VirtualParadiseAvatar.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VpSharp/src/Entities/VirtualParadiseAvatar.cs b/VpSharp/src/Entities/VirtualParadiseAvatar.cs index 5ca6f24..5100001 100644 --- a/VpSharp/src/Entities/VirtualParadiseAvatar.cs +++ b/VpSharp/src/Entities/VirtualParadiseAvatar.cs @@ -443,7 +443,9 @@ public sealed class VirtualParadiseAvatar : IEquatable } } - Location = new Location(new VirtualParadiseWorld(_client, world), position, rotation); + VirtualParadiseWorld? updatedWorld = isNewWorld ? await _client.GetWorldAsync(world) : Location.World; + updatedWorld ??= new VirtualParadiseWorld(_client, world); + Location = new Location(updatedWorld, position, rotation); // ReSharper restore InconsistentlySynchronizedField }