mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
Hiding display names (#2248) @AllTheMegahertz
Prevents a user's nickname from appearing if they are hidden, if `hide-displayname-in-vanish: true` in the config. Closes #2221. * Does not return display name if user is hidden * Added hide-displayname-in-vanish field * Added hideDisplayNameInVanish() * Changed to only hide display name if specified in config * Changed hideDisplayNameInVanish to default to false if not specified in config.yml
This commit is contained in:
parent
6a6383462d
commit
a18ce40921
4 changed files with 12 additions and 1 deletions
|
@ -243,6 +243,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
boolean ignoreColorsInMaxLength();
|
||||
|
||||
boolean hideDisplayNameInVanish();
|
||||
|
||||
int getMaxUserCacheCount();
|
||||
|
||||
boolean allowSilentJoinQuit();
|
||||
|
|
|
@ -1103,6 +1103,11 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getBoolean("ignore-colors-in-max-nick-length", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideDisplayNameInVanish() {
|
||||
return config.getBoolean("hide-displayname-in-vanish", false);
|
||||
}
|
||||
|
||||
private boolean allowSilentJoin;
|
||||
|
||||
public boolean _allowSilentJoinQuit() {
|
||||
|
|
|
@ -360,7 +360,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return super.getBase().getDisplayName() == null ? super.getBase().getName() : super.getBase().getDisplayName();
|
||||
return super.getBase().getDisplayName() == null || (ess.getSettings().hideDisplayNameInVanish() && isHidden()) ? super.getBase().getName() : super.getBase().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,10 @@ max-nick-length: 15
|
|||
# ie: "&6Notch" has 7 characters (2 are part of a color code), a length of 5 is used when this option is set to true
|
||||
ignore-colors-in-max-nick-length: false
|
||||
|
||||
# When this option is enabled, display names for hidden users will not be shown. This prevents players from being
|
||||
# able to see that they are online while vanished.
|
||||
hide-displayname-in-vanish: true
|
||||
|
||||
# Disable this if you have any other plugin, that modifies the displayname of a user.
|
||||
change-displayname: true
|
||||
|
||||
|
|
Loading…
Reference in a new issue