File tree 4 files changed +20
-1
lines changed
4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ public interface ISettings extends IConf {
185
185
186
186
boolean cancelAfkOnInteract ();
187
187
188
+ boolean sleepIgnoresAfkPlayers ();
189
+
188
190
boolean isAfkListName ();
189
191
190
192
String getAfkListName ();
Original file line number Diff line number Diff line change @@ -494,6 +494,7 @@ public void reloadConfig() {
494
494
cancelAfkOnInteract = _cancelAfkOnInteract ();
495
495
cancelAfkOnMove = _cancelAfkOnMove ();
496
496
getFreezeAfkPlayers = _getFreezeAfkPlayers ();
497
+ sleepIgnoresAfkPlayers = _sleepIgnoresAfkPlayers ();
497
498
afkListName = _getAfkListName ();
498
499
isAfkListName = !afkListName .equalsIgnoreCase ("none" );
499
500
itemSpawnBl = _getItemSpawnBlacklist ();
@@ -893,6 +894,17 @@ private boolean _cancelAfkOnInteract() {
893
894
return config .getBoolean ("cancel-afk-on-interact" , true );
894
895
}
895
896
897
+ private boolean sleepIgnoresAfkPlayers ;
898
+
899
+ @ Override
900
+ public boolean sleepIgnoresAfkPlayers () {
901
+ return sleepIgnoresAfkPlayers ;
902
+ }
903
+
904
+ private boolean _sleepIgnoresAfkPlayers () {
905
+ return config .getBoolean ("sleep-ignores-afk-players" , true );
906
+ }
907
+
896
908
private String afkListName ;
897
909
private boolean isAfkListName ;
898
910
Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ public void setAfk(final boolean set) {
465
465
return ;
466
466
}
467
467
468
- this .getBase ().setSleepingIgnored (this .isAuthorized ("essentials.sleepingignored" ) ? true : set );
468
+ this .getBase ().setSleepingIgnored (this .isAuthorized ("essentials.sleepingignored" ) || set && ess . getSettings (). sleepIgnoresAfkPlayers () );
469
469
if (set && !isAfk ()) {
470
470
afkPosition = this .getLocation ();
471
471
this .afkSince = System .currentTimeMillis ();
Original file line number Diff line number Diff line change @@ -405,6 +405,11 @@ cancel-afk-on-interact: true
405
405
# Disable this to reduce server lag.
406
406
cancel-afk-on-move : true
407
407
408
+ # Should AFK players be ignored when other players are trying to sleep?
409
+ # When this setting is false, players won't be able to skip the night if some players are AFK.
410
+ # Users with the permission node essentials.sleepingignored will always be ignored.
411
+ sleep-ignores-afk-players : true
412
+
408
413
# Set the player's list name when they are AFK. This is none by default which specifies that Essentials
409
414
# should not interfere with the AFK player's list name.
410
415
# You may use color codes, use {USERNAME} the player's name or {PLAYER} for the player's displayname.
You can’t perform that action at this time.
0 commit comments