Skip to content

Commit ddbae61

Browse files
committed
Fix compile warnings
1 parent 859183a commit ddbae61

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

Reactor/Networking/Attributes/MethodRpcAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public sealed class MethodRpcAttribute : Attribute
3737
/// Gets or sets a value indicating whether the rpc should be sent immediately.
3838
/// </summary>
3939
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. This property will be removed in a future version.")]
40-
public bool SendImmediately { get; set; }
40+
public bool SendImmediately { get; set; } = true;
4141

4242
/// <summary>
4343
/// Initializes a new instance of the <see cref="MethodRpcAttribute"/> class.
@@ -72,7 +72,7 @@ public static void Register(Assembly assembly, BasePlugin plugin)
7272

7373
try
7474
{
75-
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.SendOption, attribute.LocalHandling, attribute.SendImmediately);
75+
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.SendOption, attribute.LocalHandling);
7676
PluginSingleton<ReactorPlugin>.Instance.CustomRpcManager.Register(customRpc);
7777
}
7878
catch (Exception e)

Reactor/Networking/Rpc/MethodRpc.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ public class MethodRpc : UnsafeCustomRpc
3232
/// <param name="id">The id of the rpc.</param>
3333
/// <param name="option">The send option of the rpc.</param>
3434
/// <param name="localHandling">The local handling method of the rpc.</param>
35-
/// <param name="sendImmediately">The value indicating whether the rpc should be sent immediately.</param>
36-
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling, bool sendImmediately) : base(plugin, id)
35+
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling) : base(plugin, id)
3736
{
3837
Method = method;
3938
LocalHandling = localHandling;
4039
SendOption = option;
41-
SendImmediately = sendImmediately;
4240

4341
var parameters = method.GetParameters();
4442

@@ -71,6 +69,22 @@ public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption optio
7169
_handle = Hook(method, parameters, method.IsStatic);
7270
}
7371

72+
/// <summary>
73+
/// Initializes a new instance of the <see cref="MethodRpc"/> class.
74+
/// </summary>
75+
/// <param name="plugin">The plugin that the rpc is attached to.</param>
76+
/// <param name="method">The method of the method rpc.</param>
77+
/// <param name="id">The id of the rpc.</param>
78+
/// <param name="option">The send option of the rpc.</param>
79+
/// <param name="localHandling">The local handling method of the rpc.</param>
80+
/// <param name="sendImmediately">The value indicating whether the rpc should be sent immediately.</param>
81+
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. Remove sendImmediately from the parameter list.")]
82+
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling, bool sendImmediately)
83+
: this(plugin, method, id, option, localHandling)
84+
{
85+
SendImmediately = sendImmediately;
86+
}
87+
7488
/// <summary>
7589
/// Gets the method of the method rpc.
7690
/// </summary>
@@ -92,7 +106,7 @@ public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption optio
92106
/// Gets a value indicating whether the method rpc should be sent immediately.
93107
/// </summary>
94108
[Obsolete("Non-immediate RPCs were removed in 2025.5.20. All RPCs are immediate. This property will be removed in a future version.")]
95-
public bool SendImmediately { get; }
109+
public bool SendImmediately { get; } = true;
96110

97111
/// <inheritdoc />
98112
public override void UnsafeWrite(MessageWriter writer, object? data)
@@ -135,7 +149,7 @@ public override void UnsafeHandle(InnerNetObject innerNetObject, object? data)
135149
/// <param name="args">The arguments to serialize and send.</param>
136150
public void Send(InnerNetObject innerNetObject, object[] args)
137151
{
138-
UnsafeSend(innerNetObject, args, SendImmediately);
152+
UnsafeSend(innerNetObject, args);
139153
}
140154

141155
private static readonly MethodInfo _sendMethod = AccessTools.Method(typeof(MethodRpc), nameof(Send));

0 commit comments

Comments
 (0)