mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 20:12:54 +00:00
implement config toggle for afk users bypassing sleep
This commit is contained in:
parent
246fd03265
commit
42714ff8af
4 changed files with 19 additions and 1 deletions
|
@ -181,6 +181,8 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean cancelAfkOnInteract();
|
boolean cancelAfkOnInteract();
|
||||||
|
|
||||||
|
boolean bypassSleepWhenAfk();
|
||||||
|
|
||||||
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();
|
||||||
|
bypassSleepWhenAfk = _bypassSleepWhenAfk();
|
||||||
afkListName = _getAfkListName();
|
afkListName = _getAfkListName();
|
||||||
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||||
itemSpawnBl = _getItemSpawnBlacklist();
|
itemSpawnBl = _getItemSpawnBlacklist();
|
||||||
|
@ -870,6 +871,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 bypassSleepWhenAfk;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean bypassSleepWhenAfk() {
|
||||||
|
return bypassSleepWhenAfk;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean _bypassSleepWhenAfk() {
|
||||||
|
return config.getBoolean("bypass-sleep-when-afk", true);
|
||||||
|
}
|
||||||
|
|
||||||
private String afkListName;
|
private String afkListName;
|
||||||
private boolean isAfkListName;
|
private boolean isAfkListName;
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,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().bypassSleepWhenAfk());
|
||||||
if (set && !isAfk()) {
|
if (set && !isAfk()) {
|
||||||
afkPosition = this.getLocation();
|
afkPosition = this.getLocation();
|
||||||
this.afkSince = System.currentTimeMillis();
|
this.afkSince = System.currentTimeMillis();
|
||||||
|
|
|
@ -396,6 +396,10 @@ 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
|
||||||
|
|
||||||
|
# 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
|
# 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…
Add table
Add a link
Reference in a new issue