mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-16 07:35:38 +01: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
@ -160,6 +160,10 @@ public interface ISettings extends IConf {
|
||||
|
||||
boolean cancelAfkOnInteract();
|
||||
|
||||
boolean isAfkListName();
|
||||
|
||||
String getAfkListName();
|
||||
|
||||
boolean areDeathMessagesEnabled();
|
||||
|
||||
void setDebug(boolean debug);
|
||||
|
@ -495,6 +495,8 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
cancelAfkOnInteract = _cancelAfkOnInteract();
|
||||
cancelAfkOnMove = _cancelAfkOnMove() && cancelAfkOnInteract;
|
||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||
afkListName = _getAfkListName();
|
||||
isAfkListName = !afkListName.equalsIgnoreCase("none");
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
loginAttackDelay = _getLoginAttackDelay();
|
||||
signUsePerSecond = _getSignUsePerSecond();
|
||||
@ -862,6 +864,23 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
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
|
||||
public boolean areDeathMessagesEnabled() {
|
||||
return config.getBoolean("death-messages", true);
|
||||
|
@ -418,6 +418,14 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
} else if (!set && isAfk()) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -391,6 +391,11 @@ cancel-afk-on-interact: true
|
||||
# Disable this to reduce server lag.
|
||||
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.
|
||||
death-messages: true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user