From 7e69bdce39c700bf7adfea06d525572cd5d22dc5 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 30 Nov 2022 18:52:49 +0000 Subject: [PATCH] Use explicit type when not apparent --- VpSharp.Commands/CommandsExtension.cs | 3 ++- VpSharp/src/VirtualParadiseClient.NativeEvents.cs | 10 +++++----- VpSharp/src/VirtualParadiseClient.cs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/VpSharp.Commands/CommandsExtension.cs b/VpSharp.Commands/CommandsExtension.cs index cec8a2f..2ee14f2 100644 --- a/VpSharp.Commands/CommandsExtension.cs +++ b/VpSharp.Commands/CommandsExtension.cs @@ -1,6 +1,7 @@ using System.Reflection; using VpSharp.ClientExtensions; using VpSharp.Commands.Attributes; +using VpSharp.Entities; using VpSharp.EventData; namespace VpSharp.Commands; @@ -133,7 +134,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension protected override Task OnMessageReceived(MessageReceivedEventArgs args) { ArgumentNullException.ThrowIfNull(args); - var message = args.Message; + VirtualParadiseMessage message = args.Message; if (message.Type != MessageType.ChatMessage) { diff --git a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs index e508610..ed7a97a 100644 --- a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs +++ b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs @@ -75,7 +75,7 @@ public sealed partial class VirtualParadiseClient } VirtualParadiseAvatar? avatar = GetAvatar(session); - message = new VirtualParadiseMessage((MessageType) type, name, content, avatar, style, color); + message = new VirtualParadiseMessage((MessageType)type, name, content, avatar, style, color); } var args = new MessageReceivedEventArgs(message); @@ -165,8 +165,8 @@ public sealed partial class VirtualParadiseClient session = vp_int(sender, IntegerAttribute.AvatarSession); } - VirtualParadiseObject? virtualParadiseObject = await ExtractObjectAsync(sender).ConfigureAwait(false); - var cell = virtualParadiseObject.Location.Cell; + VirtualParadiseObject virtualParadiseObject = await ExtractObjectAsync(sender).ConfigureAwait(false); + Cell cell = virtualParadiseObject.Location.Cell; virtualParadiseObject = AddOrUpdateObject(virtualParadiseObject); @@ -268,7 +268,7 @@ public sealed partial class VirtualParadiseClient } VirtualParadiseAvatar? avatar = GetAvatar(session); - var virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); + VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); var args = new ObjectClickedEventArgs(avatar, virtualParadiseObject, clickPoint); RaiseEvent(ObjectClicked, args); } @@ -281,7 +281,7 @@ public sealed partial class VirtualParadiseClient { string name = vp_string(sender, StringAttribute.WorldName); int avatarCount = vp_int(sender, IntegerAttribute.WorldUsers); - var state = (WorldState) vp_int(sender, IntegerAttribute.WorldState); + var state = (WorldState)vp_int(sender, IntegerAttribute.WorldState); world = new VirtualParadiseWorld(this, name) { diff --git a/VpSharp/src/VirtualParadiseClient.cs b/VpSharp/src/VirtualParadiseClient.cs index fa9857c..00f951f 100644 --- a/VpSharp/src/VirtualParadiseClient.cs +++ b/VpSharp/src/VirtualParadiseClient.cs @@ -574,7 +574,7 @@ public sealed partial class VirtualParadiseClient : IDisposable } } - var avatar = CurrentAvatar; + VirtualParadiseAvatar? avatar = CurrentAvatar; return Task.FromResult(new VirtualParadiseMessage( MessageType.ChatMessage, avatar!.Name,