diff --git a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs index 9c6081a..e508610 100644 --- a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs +++ b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs @@ -197,8 +197,7 @@ public sealed partial class VirtualParadiseClient } VirtualParadiseAvatar? avatar = GetAvatar(session); - - VirtualParadiseObject cachedObject = null; + VirtualParadiseObject? cachedObject = null; if (_objects.TryGetValue(objectId, out VirtualParadiseObject? virtualParadiseObject)) { @@ -207,7 +206,12 @@ public sealed partial class VirtualParadiseClient virtualParadiseObject.ExtractFromInstance(sender); // update existing instance } + else + { + virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); + } + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract if (virtualParadiseObject is not null) { AddOrUpdateObject(virtualParadiseObject); @@ -316,7 +320,7 @@ public sealed partial class VirtualParadiseClient userId = vp_int(sender, IntegerAttribute.FriendUserId); } - VirtualParadiseUser? user = await GetUserAsync(userId).ConfigureAwait(false); + VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); _friends.AddOrUpdate(userId, user, (_, _) => user); } @@ -519,7 +523,7 @@ public sealed partial class VirtualParadiseClient name = vp_string(NativeInstanceHandle, StringAttribute.JoinName); } - VirtualParadiseUser? user = await GetUserAsync(userId).ConfigureAwait(false); + VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); var joinRequest = new JoinRequest(this, requestId, name, user); var args = new JoinRequestReceivedEventArgs(joinRequest); RaiseEvent(JoinRequestReceived, args); @@ -554,7 +558,7 @@ public sealed partial class VirtualParadiseClient } VirtualParadiseWorld? world = await GetWorldAsync(worldName).ConfigureAwait(false); - VirtualParadiseUser? user = await GetUserAsync(userId).ConfigureAwait(false); + VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); var location = new Location(world, position, rotation); var request = new InviteRequest(this, requestId, avatarName, user, location); diff --git a/VpSharp/src/VirtualParadiseClient.Users.cs b/VpSharp/src/VirtualParadiseClient.Users.cs index d57c0bc..5e5df9c 100644 --- a/VpSharp/src/VirtualParadiseClient.Users.cs +++ b/VpSharp/src/VirtualParadiseClient.Users.cs @@ -39,7 +39,7 @@ public sealed partial class VirtualParadiseClient user = await taskCompletionSource.Task.ConfigureAwait(false); user = AddOrUpdateUser(user); - _usersCompletionSources.TryRemove(userId, out TaskCompletionSource? _); + _usersCompletionSources.TryRemove(userId, out TaskCompletionSource _); return user; } diff --git a/VpSharp/src/WorldSettingsBuilder.cs b/VpSharp/src/WorldSettingsBuilder.cs index b48034e..1221f49 100644 --- a/VpSharp/src/WorldSettingsBuilder.cs +++ b/VpSharp/src/WorldSettingsBuilder.cs @@ -208,14 +208,14 @@ public sealed class WorldSettingsBuilder /// /// The texture for the first sky cloud layer. [SerializationKey("sky_clouds1")] - public string SkyClouds1Texture { get; set; } + public string? SkyClouds1Texture { get; set; } /// /// Gets or sets the texture for the second sky cloud layer. /// /// The texture for the second sky cloud layer. [SerializationKey("sky_clouds2")] - public string SkyClouds2Texture { get; set; } + public string? SkyClouds2Texture { get; set; } /// /// Gets or sets the velocity for the first sky cloud layer. @@ -278,14 +278,14 @@ public sealed class WorldSettingsBuilder /// /// The skybox texture. [SerializationKey("skybox")] - public string Skybox { get; set; } + public string? Skybox { get; set; } /// /// Gets or sets the file extension for skybox textures. /// /// The file extension for skybox textures. [SerializationKey("skybox_extension")] - public string SkyboxExtension { get; set; } + public string? SkyboxExtension { get; set; } /// /// Gets or sets a value indicating whether the X axis of skybox textures should be swapped. @@ -330,14 +330,14 @@ public sealed class WorldSettingsBuilder /// /// The URL of the in-world web overlay. [SerializationKey("web_overlay")] - public string WebOverlay { get; set; } + public string? WebOverlay { get; set; } /// /// Gets or sets the welcome message. /// /// The welcome message. [SerializationKey("welcome")] - public string WelcomeMessage { get; set; } + public string? WelcomeMessage { get; set; } /// /// Gets or sets the ambient light color of the world. @@ -376,7 +376,7 @@ public sealed class WorldSettingsBuilder /// /// The name of the world. [SerializationKey("worldname")] - public string WorldName { get; set; } + public string? WorldName { get; set; } internal void SendChanges() {