mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-01 13:01:41 +01:00
Merge pull request #2329 from triagonal/issue-2311
Implement config option for sleep ignoring AFK players
This commit is contained in:
commit
25ddaef423
@ -185,6 +185,8 @@ public interface ISettings extends IConf {
|
||||
|
||||
boolean cancelAfkOnInteract();
|
||||
|
||||
boolean sleepIgnoresAfkPlayers();
|
||||
|
||||
boolean isAfkListName();
|
||||
|
||||
String getAfkListName();
|
||||
|
@ -494,6 +494,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
cancelAfkOnInteract = _cancelAfkOnInteract();
|
||||
cancelAfkOnMove = _cancelAfkOnMove();
|
||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||
sleepIgnoresAfkPlayers = _sleepIgnoresAfkPlayers();
|
||||
afkListName = _getAfkListName();
|
||||
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
@ -893,6 +894,17 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
return config.getBoolean("cancel-afk-on-interact", true);
|
||||
}
|
||||
|
||||
private boolean sleepIgnoresAfkPlayers;
|
||||
|
||||
@Override
|
||||
public boolean sleepIgnoresAfkPlayers() {
|
||||
return sleepIgnoresAfkPlayers;
|
||||
}
|
||||
|
||||
private boolean _sleepIgnoresAfkPlayers() {
|
||||
return config.getBoolean("sleep-ignores-afk-players", true);
|
||||
}
|
||||
|
||||
private String afkListName;
|
||||
private boolean isAfkListName;
|
||||
|
||||
|
@ -465,7 +465,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().sleepIgnoresAfkPlayers());
|
||||
if (set && !isAfk()) {
|
||||
afkPosition = this.getLocation();
|
||||
this.afkSince = System.currentTimeMillis();
|
||||
|
@ -405,6 +405,11 @@ cancel-afk-on-interact: true
|
||||
# Disable this to reduce server lag.
|
||||
cancel-afk-on-move: true
|
||||
|
||||
# Should AFK players be ignored when other players are trying to sleep?
|
||||
# When this setting is false, players won't be able to skip the night if some players are AFK.
|
||||
# Users with the permission node essentials.sleepingignored will always be ignored.
|
||||
sleep-ignores-afk-players: true
|
||||
|
||||
# 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
Block a user