mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-25 16:09:44 +00:00
Add afk-list-name config property for changing the player list name of AFK players.
This commit is contained in:
parent
c6d2746959
commit
bbf657e251
4 changed files with 36 additions and 0 deletions
|
@ -160,6 +160,10 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean cancelAfkOnInteract();
|
boolean cancelAfkOnInteract();
|
||||||
|
|
||||||
|
boolean isAfkListName();
|
||||||
|
|
||||||
|
String getAfkListName();
|
||||||
|
|
||||||
boolean areDeathMessagesEnabled();
|
boolean areDeathMessagesEnabled();
|
||||||
|
|
||||||
void setDebug(boolean debug);
|
void setDebug(boolean debug);
|
||||||
|
|
|
@ -495,6 +495,8 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
cancelAfkOnInteract = _cancelAfkOnInteract();
|
cancelAfkOnInteract = _cancelAfkOnInteract();
|
||||||
cancelAfkOnMove = _cancelAfkOnMove() && cancelAfkOnInteract;
|
cancelAfkOnMove = _cancelAfkOnMove() && cancelAfkOnInteract;
|
||||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||||
|
afkListName = _getAfkListName();
|
||||||
|
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||||
itemSpawnBl = _getItemSpawnBlacklist();
|
itemSpawnBl = _getItemSpawnBlacklist();
|
||||||
loginAttackDelay = _getLoginAttackDelay();
|
loginAttackDelay = _getLoginAttackDelay();
|
||||||
signUsePerSecond = _getSignUsePerSecond();
|
signUsePerSecond = _getSignUsePerSecond();
|
||||||
|
@ -862,6 +864,23 @@ 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 String afkListName;
|
||||||
|
private boolean isAfkListName;
|
||||||
|
|
||||||
|
public String _getAfkListName() {
|
||||||
|
return FormatUtil.replaceFormat(config.getString("afk-list-name", "none"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAfkListName() {
|
||||||
|
return isAfkListName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAfkListName() {
|
||||||
|
return afkListName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areDeathMessagesEnabled() {
|
public boolean areDeathMessagesEnabled() {
|
||||||
return config.getBoolean("death-messages", true);
|
return config.getBoolean("death-messages", true);
|
||||||
|
|
|
@ -418,6 +418,14 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||||
} else if (!set && isAfk()) {
|
} else if (!set && isAfk()) {
|
||||||
afkPosition = null;
|
afkPosition = null;
|
||||||
}
|
}
|
||||||
|
if (ess.getSettings().isAfkListName()) {
|
||||||
|
if(set) {
|
||||||
|
String afkName = ess.getSettings().getAfkListName().replace("{PLAYER}", getDisplayName()).replace("{USERNAME}", getName());
|
||||||
|
getBase().setPlayerListName(afkName);
|
||||||
|
} else {
|
||||||
|
getBase().setPlayerListName(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
_setAfk(set);
|
_setAfk(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,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
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
afk-list-name: none
|
||||||
|
|
||||||
# You can disable the death messages of Minecraft here.
|
# You can disable the death messages of Minecraft here.
|
||||||
death-messages: true
|
death-messages: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue