diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index e55779b3c..4060a28b0 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -269,4 +269,8 @@ public interface ISettings extends IConf { boolean isPastebinCreateKit(); boolean isAllowBulkBuySell(); + + boolean isAddingPrefixInPlayerlist(); + + boolean isAddingSuffixInPlayerlist(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 626dd8421..9e1ab71eb 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -1364,4 +1364,14 @@ public class Settings implements net.ess3.api.ISettings { public boolean isAllowBulkBuySell() { return config.getBoolean("allow-bulk-buy-sell", false); } + + @Override + public boolean isAddingPrefixInPlayerlist() { + return config.getBoolean("add-prefix-in-playerlist", false); + } + + @Override + public boolean isAddingSuffixInPlayerlist() { + return config.getBoolean("add-suffix-in-playerlist", false); + } } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 0cc2e5513..c98aa7f3f 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -253,6 +253,10 @@ public class User extends UserData implements Comparable, IMessageRecipien } public String getNick(final boolean longnick) { + return getNick(longnick, true, true); + } + + public String getNick(final boolean longnick, final boolean withPrefix, final boolean withSuffix) { final StringBuilder prefix = new StringBuilder(); String nickname; String suffix = ""; @@ -279,12 +283,12 @@ public class User extends UserData implements Comparable, IMessageRecipien if (ess.getSettings().addPrefixSuffix()) { //These two extra toggles are not documented, because they are mostly redundant #EasterEgg - if (!ess.getSettings().disablePrefix()) { + if (withPrefix || !ess.getSettings().disablePrefix()) { final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§'); prefix.insert(0, ptext); suffix = "§r"; } - if (!ess.getSettings().disableSuffix()) { + if (withSuffix || !ess.getSettings().disableSuffix()) { final String stext = ess.getPermissionsHandler().getSuffix(base).replace('&', '§'); suffix = stext + "§r"; suffix = suffix.replace("§f§f", "§f").replace("§f§r", "§r").replace("§r§r", "§r"); @@ -314,7 +318,7 @@ public class User extends UserData implements Comparable, IMessageRecipien // 1.8 enabled player list-names longer than 16 characters. // If the server is on 1.8 or higher, provide that functionality. Otherwise, keep prior functionality. boolean higherOrEqualTo1_8 = ReflUtil.getNmsVersionObject().isHigherThanOrEqualTo(ReflUtil.V1_8_R1); - String name = getNick(higherOrEqualTo1_8); + String name = getNick(higherOrEqualTo1_8, ess.getSettings().isAddingPrefixInPlayerlist(), ess.getSettings().isAddingSuffixInPlayerlist()); try { this.getBase().setPlayerListName(name); } catch (IllegalArgumentException e) { diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 3c9af3bf3..e76ee4788 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -45,6 +45,16 @@ change-displayname: true # Do not edit this setting unless you know what you are doing! #add-prefix-suffix: false +# When this option is enabled, player prefixes will be shown in the playerlist. +# This feature only works for Minecraft version 1.8 and higher. +# This value of change-playerlist has to be true +#add-prefix-in-playerlist: true + +# When this option is enabled, player suffixes will be shown in the playerlist. +# This feature only works for Minecraft version 1.8 and higher. +# This value of change-playerlist has to be true +#add-suffix-in-playerlist: true + # If the teleport destination is unsafe, should players be teleported to the nearest safe location? # If this is set to true, Essentials will attempt to teleport players close to the intended destination. # If this is set to false, attempted teleports to unsafe locations will be cancelled with a warning.