implement config toggle for afk users bypassing sleep
This commit is contained in:
parent
246fd03265
commit
42714ff8af
|
@ -181,6 +181,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
boolean cancelAfkOnInteract();
|
||||
|
||||
boolean bypassSleepWhenAfk();
|
||||
|
||||
boolean isAfkListName();
|
||||
|
||||
String getAfkListName();
|
||||
|
|
|
@ -494,6 +494,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
cancelAfkOnInteract = _cancelAfkOnInteract();
|
||||
cancelAfkOnMove = _cancelAfkOnMove();
|
||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||
bypassSleepWhenAfk = _bypassSleepWhenAfk();
|
||||
afkListName = _getAfkListName();
|
||||
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
|
@ -870,6 +871,17 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getBoolean("cancel-afk-on-interact", true);
|
||||
}
|
||||
|
||||
private boolean bypassSleepWhenAfk;
|
||||
|
||||
@Override
|
||||
public boolean bypassSleepWhenAfk() {
|
||||
return bypassSleepWhenAfk;
|
||||
}
|
||||
|
||||
private boolean _bypassSleepWhenAfk() {
|
||||
return config.getBoolean("bypass-sleep-when-afk", true);
|
||||
}
|
||||
|
||||
private String afkListName;
|
||||
private boolean isAfkListName;
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||
return;
|
||||
}
|
||||
|
||||
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
||||
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") || set && ess.getSettings().bypassSleepWhenAfk());
|
||||
if (set && !isAfk()) {
|
||||
afkPosition = this.getLocation();
|
||||
this.afkSince = System.currentTimeMillis();
|
||||
|
|
|
@ -396,6 +396,10 @@ cancel-afk-on-interact: true
|
|||
# Disable this to reduce server lag.
|
||||
cancel-afk-on-move: true
|
||||
|
||||
# When a player is AFK, should they be taken into account when other players are trying to sleep?
|
||||
# Set this to true when you want AFK players to be ignored when sleeping attempts to skip the night.
|
||||
bypass-sleep-when-afk: false
|
||||
|
||||
# Set the player's list name when they are AFK. This is none by default which specifies that Essentials
|
||||
# should not interfere with the AFK player's list name.
|
||||
# You may use color codes, use {USERNAME} the player's name or {PLAYER} for the player's displayname.
|
||||
|
|
Loading…
Reference in New Issue