File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 3
3
using System . Collections . Generic ;
4
4
using System . ComponentModel ;
5
5
using System . Diagnostics ;
6
- using System . Linq ;
7
- using System . Text ;
8
- using System . Threading . Tasks ;
9
- using Exiled ;
10
- using Exiled . API ;
11
6
using Exiled . API . Features ;
12
7
using Exiled . API . Interfaces ;
13
- using Exiled . Events ;
14
8
using PlayerRoles ;
15
9
16
10
namespace UtilPlugin
@@ -38,6 +32,8 @@ public class PluginConfig : IConfig
38
32
public bool ReserveSlotEnabled { get ; set ; } = false ;
39
33
[ Description ( "管理员预留位数量" ) ]
40
34
public int Slots { get ; set ; } = 5 ;
35
+ [ Description ( "是否判断预留位占用" ) ]
36
+ public bool WhetherOccupieSlots { get ; set ; } = false ;
41
37
[ Description ( "系统核弹投票可发起时间(以秒为单位)" ) ]
42
38
public int SystemWarheadVoteTime { get ; set ; } = 720 ;
43
39
[ Description ( "预留位踢出理由" ) ]
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public static void Register(bool isEnabled)
37
37
public static void OnJoining ( PreAuthenticatingEventArgs ev )
38
38
{
39
39
Log . Debug ( $ "Player { ev . UserId } joining, now remain { Server . MaxPlayerCount - LiteNetLib4MirrorCore . Host . ConnectedPeersCount } ") ;
40
- if ( Server . MaxPlayerCount - LiteNetLib4MirrorCore . Host . ConnectedPeersCount <= Remain )
40
+ if ( Determine ( ) )
41
41
{
42
42
Log . Debug ( $ "Checking reservesolt of { ev . UserId } ") ;
43
43
if ( Check ( ev . UserId ) )
@@ -49,5 +49,11 @@ public static void OnJoining(PreAuthenticatingEventArgs ev)
49
49
ev . Reject ( UtilPlugin . Instance . Config . ReserveSlotKickReason , true ) ;
50
50
}
51
51
}
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
+ }
52
58
}
53
59
}
You can’t perform that action at this time.
0 commit comments