Use NRT where appropriate

This commit is contained in:
Oliver Booth 2022-11-30 18:43:59 +00:00
parent 267c450677
commit 8bbbf170e3
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 17 additions and 13 deletions

View File

@ -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);

View File

@ -39,7 +39,7 @@ public sealed partial class VirtualParadiseClient
user = await taskCompletionSource.Task.ConfigureAwait(false);
user = AddOrUpdateUser(user);
_usersCompletionSources.TryRemove(userId, out TaskCompletionSource<VirtualParadiseUser>? _);
_usersCompletionSources.TryRemove(userId, out TaskCompletionSource<VirtualParadiseUser> _);
return user;
}

View File

@ -208,14 +208,14 @@ public sealed class WorldSettingsBuilder
/// </summary>
/// <value>The texture for the first sky cloud layer.</value>
[SerializationKey("sky_clouds1")]
public string SkyClouds1Texture { get; set; }
public string? SkyClouds1Texture { get; set; }
/// <summary>
/// Gets or sets the texture for the second sky cloud layer.
/// </summary>
/// <value>The texture for the second sky cloud layer.</value>
[SerializationKey("sky_clouds2")]
public string SkyClouds2Texture { get; set; }
public string? SkyClouds2Texture { get; set; }
/// <summary>
/// Gets or sets the velocity for the first sky cloud layer.
@ -278,14 +278,14 @@ public sealed class WorldSettingsBuilder
/// </summary>
/// <value>The skybox texture.</value>
[SerializationKey("skybox")]
public string Skybox { get; set; }
public string? Skybox { get; set; }
/// <summary>
/// Gets or sets the file extension for skybox textures.
/// </summary>
/// <value>The file extension for skybox textures.</value>
[SerializationKey("skybox_extension")]
public string SkyboxExtension { get; set; }
public string? SkyboxExtension { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the X axis of skybox textures should be swapped.
@ -330,14 +330,14 @@ public sealed class WorldSettingsBuilder
/// </summary>
/// <value>The URL of the in-world web overlay.</value>
[SerializationKey("web_overlay")]
public string WebOverlay { get; set; }
public string? WebOverlay { get; set; }
/// <summary>
/// Gets or sets the welcome message.
/// </summary>
/// <value>The welcome message.</value>
[SerializationKey("welcome")]
public string WelcomeMessage { get; set; }
public string? WelcomeMessage { get; set; }
/// <summary>
/// Gets or sets the ambient light color of the world.
@ -376,7 +376,7 @@ public sealed class WorldSettingsBuilder
/// </summary>
/// <value>The name of the world.</value>
[SerializationKey("worldname")]
public string WorldName { get; set; }
public string? WorldName { get; set; }
internal void SendChanges()
{