Skip to content

Commit a9fcdee

Browse files
Sirin3rdGriseo-bh3rd
authored andcommitted
ok
1 parent 8da3650 commit a9fcdee

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

util/MainClass.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
using System.Collections.Generic;
44
using System.ComponentModel;
55
using System.Diagnostics;
6-
using System.Linq;
7-
using System.Text;
8-
using System.Threading.Tasks;
9-
using Exiled;
10-
using Exiled.API;
116
using Exiled.API.Features;
127
using Exiled.API.Interfaces;
13-
using Exiled.Events;
148
using PlayerRoles;
159

1610
namespace UtilPlugin
@@ -38,6 +32,8 @@ public class PluginConfig : IConfig
3832
public bool ReserveSlotEnabled { get; set; } = false;
3933
[Description("管理员预留位数量")]
4034
public int Slots { get; set; } = 5;
35+
[Description("是否判断预留位占用")]
36+
public bool WhetherOccupieSlots { get; set; } = false;
4137
[Description("系统核弹投票可发起时间(以秒为单位)")]
4238
public int SystemWarheadVoteTime { get; set; } = 720;
4339
[Description("预留位踢出理由")]

util/ReserveSlot.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void Register(bool isEnabled)
3737
public static void OnJoining(PreAuthenticatingEventArgs ev)
3838
{
3939
Log.Debug($"Player {ev.UserId} joining, now remain {Server.MaxPlayerCount - LiteNetLib4MirrorCore.Host.ConnectedPeersCount}");
40-
if (Server.MaxPlayerCount - LiteNetLib4MirrorCore.Host.ConnectedPeersCount <= Remain)
40+
if (Determine())
4141
{
4242
Log.Debug($"Checking reservesolt of {ev.UserId}");
4343
if (Check(ev.UserId))
@@ -49,5 +49,11 @@ public static void OnJoining(PreAuthenticatingEventArgs ev)
4949
ev.Reject(UtilPlugin.Instance.Config.ReserveSlotKickReason, true);
5050
}
5151
}
52+
53+
private static bool Determine()
54+
{
55+
if (!UtilPlugin.Instance.Config.WhetherOccupieSlots) return Server.MaxPlayerCount - LiteNetLib4MirrorCore.Host.ConnectedPeersCount <= Remain;
56+
else return Server.MaxPlayerCount - LiteNetLib4MirrorCore.Host.ConnectedPeersCount <= UtilPlugin.Instance.Config.Slots;
57+
}
5258
}
5359
}

0 commit comments

Comments
 (0)