Added real name boolean option for the /list command (#3117)

This commit is contained in:
Radoje17 2020-04-02 09:06:32 +02:00 committed by GitHub
parent ad98fc4121
commit b08d380643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -162,6 +162,8 @@ public interface ISettings extends IConf {
boolean isEcoLogUpdateEnabled(); boolean isEcoLogUpdateEnabled();
boolean realNamesOnList();
boolean removeGodOnDisconnect(); boolean removeGodOnDisconnect();
boolean changeDisplayName(); boolean changeDisplayName();

View File

@ -1,6 +1,7 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.ChatColor;
import org.bukkit.Server; import org.bukkit.Server;
import java.util.*; import java.util.*;
@ -27,6 +28,9 @@ public class PlayerList {
} }
user.setDisplayNick(); user.setDisplayNick();
groupString.append(user.getDisplayName()); groupString.append(user.getDisplayName());
if (ess.getSettings().realNamesOnList() && !ChatColor.stripColor(user.getDisplayName()).equals(user.getName())) {
groupString.append(" (").append(user.getName()).append(")");
}
groupString.append("\u00a7f"); groupString.append("\u00a7f");
} }
return groupString.toString(); return groupString.toString();

View File

@ -791,6 +791,11 @@ public class Settings implements net.ess3.api.ISettings {
return economyLogUpdate; return economyLogUpdate;
} }
@Override
public boolean realNamesOnList() {
return config.getBoolean("real-names-on-list", false);
}
public boolean _isEcoLogUpdateEnabled() { public boolean _isEcoLogUpdateEnabled() {
return config.getBoolean("economy-log-update-enabled", false); return config.getBoolean("economy-log-update-enabled", false);
} }

View File

@ -381,6 +381,9 @@ list:
# Uncomment the line below to simply list all players with no grouping # Uncomment the line below to simply list all players with no grouping
#Players: '*' #Players: '*'
# Displays real names in /list next to players who are using a nickname.
real-names-on-list: false
# More output to the console. # More output to the console.
debug: false debug: false