mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +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 cancelAfkOnInteract();
|
||||||
|
|
||||||
|
boolean sleepIgnoresAfkPlayers();
|
||||||
|
|
||||||
boolean isAfkListName();
|
boolean isAfkListName();
|
||||||
|
|
||||||
String getAfkListName();
|
String getAfkListName();
|
||||||
|
@ -494,6 +494,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
cancelAfkOnInteract = _cancelAfkOnInteract();
|
cancelAfkOnInteract = _cancelAfkOnInteract();
|
||||||
cancelAfkOnMove = _cancelAfkOnMove();
|
cancelAfkOnMove = _cancelAfkOnMove();
|
||||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||||
|
sleepIgnoresAfkPlayers = _sleepIgnoresAfkPlayers();
|
||||||
afkListName = _getAfkListName();
|
afkListName = _getAfkListName();
|
||||||
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||||
itemSpawnBl = _getItemSpawnBlacklist();
|
itemSpawnBl = _getItemSpawnBlacklist();
|
||||||
@ -893,6 +894,17 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
return config.getBoolean("cancel-afk-on-interact", true);
|
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 String afkListName;
|
||||||
private boolean isAfkListName;
|
private boolean isAfkListName;
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") || set && ess.getSettings().sleepIgnoresAfkPlayers());
|
||||||
if (set && !isAfk()) {
|
if (set && !isAfk()) {
|
||||||
afkPosition = this.getLocation();
|
afkPosition = this.getLocation();
|
||||||
this.afkSince = System.currentTimeMillis();
|
this.afkSince = System.currentTimeMillis();
|
||||||
|
@ -405,6 +405,11 @@ cancel-afk-on-interact: true
|
|||||||
# Disable this to reduce server lag.
|
# Disable this to reduce server lag.
|
||||||
cancel-afk-on-move: true
|
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
|
# 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.
|
# 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.
|
# 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