Fix compile warnings

This commit is contained in:
miniduikboot authored and XtraCube committed 2025-05-22 22:48:13 -04:00
1 parent 859183a849
commit 26bd155a42
2 files changed
+21 -7

No files matched your search

@@ -37,7 +37,7 @@ public sealed class MethodRpcAttribute : Attribute
/// Gets or sets a value indicating whether the rpc should be sent immediately.
/// </summary>
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. This property will be removed in a future version.")]
public bool SendImmediately { get; set; }
public bool SendImmediately { get; set; } = true;
/// <summary>
/// Initializes a new instance of the <see cref="MethodRpcAttribute"/> class.
@@ -72,7 +72,7 @@ public sealed class MethodRpcAttribute : Attribute
try
{
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.SendOption, attribute.LocalHandling, attribute.SendImmediately);
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.SendOption, attribute.LocalHandling);
PluginSingleton<ReactorPlugin>.Instance.CustomRpcManager.Register(customRpc);
}
catch (Exception e)
+19 -5
View File
@@ -32,13 +32,11 @@ public class MethodRpc : UnsafeCustomRpc
/// <param name="id">The id of the rpc.</param>
/// <param name="option">The send option of the rpc.</param>
/// <param name="localHandling">The local handling method of the rpc.</param>
/// <param name="sendImmediately">The value indicating whether the rpc should be sent immediately.</param>
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling, bool sendImmediately) : base(plugin, id)
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling) : base(plugin, id)
{
Method = method;
LocalHandling = localHandling;
SendOption = option;
SendImmediately = sendImmediately;
var parameters = method.GetParameters();
@@ -71,6 +69,22 @@ public class MethodRpc : UnsafeCustomRpc
_handle = Hook(method, parameters, method.IsStatic);
}
/// <summary>
/// Initializes a new instance of the <see cref="MethodRpc"/> class.
/// </summary>
/// <param name="plugin">The plugin that the rpc is attached to.</param>
/// <param name="method">The method of the method rpc.</param>
/// <param name="id">The id of the rpc.</param>
/// <param name="option">The send option of the rpc.</param>
/// <param name="localHandling">The local handling method of the rpc.</param>
/// <param name="sendImmediately">The value indicating whether the rpc should be sent immediately.</param>
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. Remove sendImmediately from the parameter list.")]
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling, bool sendImmediately)
: this(plugin, method, id, option, localHandling)
{
SendImmediately = sendImmediately;
}
/// <summary>
/// Gets the method of the method rpc.
/// </summary>
@@ -92,7 +106,7 @@ public class MethodRpc : UnsafeCustomRpc
/// Gets a value indicating whether the method rpc should be sent immediately.
/// </summary>
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. This property will be removed in a future version.")]
public bool SendImmediately { get; }
public bool SendImmediately { get; } = true;
/// <inheritdoc />
public override void UnsafeWrite(MessageWriter writer, object? data)
@@ -135,7 +149,7 @@ public class MethodRpc : UnsafeCustomRpc
/// <param name="args">The arguments to serialize and send.</param>
public void Send(InnerNetObject innerNetObject, object[] args)
{
UnsafeSend(innerNetObject, args, SendImmediately);
UnsafeSend(innerNetObject, args);
}
private static readonly MethodInfo _sendMethod = AccessTools.Method(typeof(MethodRpc), nameof(Send));