File tree 4 files changed +20
-2
lines changed
4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ public final class PGMConfig implements Config {
90
90
91
91
// join.*
92
92
private final long minPlayers ;
93
+ private final long minPlayersMaintain ;
93
94
private final boolean limitJoin ;
94
95
private final boolean priorityKick ;
95
96
private final boolean balanceJoin ;
@@ -196,6 +197,7 @@ public final class PGMConfig implements Config {
196
197
this .maxExtraVotes = parseInteger (config .getString ("votes.max-extra-votes" , "5" ));
197
198
198
199
this .minPlayers = parseInteger (config .getString ("join.min-players" , "1" ));
200
+ this .minPlayersMaintain = parseInteger (config .getString ("gameplay.min-players-maintain" , "1" ));
199
201
this .limitJoin = parseBoolean (config .getString ("join.limit" , "true" ));
200
202
this .priorityKick = parseBoolean (config .getString ("join.priority-kick" , "true" ));
201
203
this .balanceJoin = parseBoolean (config .getString ("join.balance" , "true" ));
@@ -583,6 +585,11 @@ public Duration getTimePenalty(TimePenalty penalty) {
583
585
return timePenalties .get (penalty );
584
586
}
585
587
588
+ @ Override
589
+ public long getMinimumPlayersMaintain () {
590
+ return this .minPlayersMaintain ;
591
+ }
592
+
586
593
@ Override
587
594
public boolean showSideBar () {
588
595
return showSideBar ;
Original file line number Diff line number Diff line change @@ -330,6 +330,13 @@ enum TimePenalty {
330
330
SWITCH
331
331
}
332
332
333
+ /**
334
+ * Get the number of players needed to keep a match running.
335
+ *
336
+ * @return number of players
337
+ */
338
+ long getMinimumPlayersMaintain ();
339
+
333
340
/**
334
341
* Gets if extra votes are allowed based on the "pgm.vote.extra.#" permission.
335
342
*
Original file line number Diff line number Diff line change @@ -47,8 +47,11 @@ public void startCountdown(@Nullable Duration duration) {
47
47
public void onPartyChange (PlayerPartyChangeEvent event ) {
48
48
if (event .wasParticipating ()
49
49
&& match .isRunning ()
50
- && match .getParticipants ().isEmpty ()) {
51
- match .getLogger ().info ("Cycling due to empty match" );
50
+ && match .getParticipants ().size ()
51
+ < PGM .get ().getConfiguration ().getMinimumPlayersMaintain ()) {
52
+ match
53
+ .getLogger ()
54
+ .info ("Ending match due to an insufficient number of players." );
52
55
match .finish ();
53
56
startCountdown (null );
54
57
}
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ restart:
66
66
# Changes behaviour when players try to /join a match.
67
67
join :
68
68
min-players : 1 # Minimum number of players before a match can start.
69
+ min-players-maintain : 1 # Minimum number of players that a match should maintain before PGM ends the match
69
70
anytime : true # Can players join after a match has started?
70
71
balance : true # Can players be moved to make teams more balanced?
71
72
queue : false # Should players be put in a queue before joining the match?
You can’t perform that action at this time.
0 commit comments