diff options
author | KHobbits <rob@khobbits.co.uk> | 2011-10-27 06:17:18 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2011-10-27 06:17:18 +0100 |
commit | 04de66bc8aaa018b47a3193e37f8e34d1105f615 (patch) | |
tree | 4eb687c080e6a6722361526b195770c23ac5f785 | |
parent | 32cc1b66a4b9293a1fbbab63d761dc96f99d7619 (diff) | |
download | Essentials-04de66bc8aaa018b47a3193e37f8e34d1105f615.tar Essentials-04de66bc8aaa018b47a3193e37f8e34d1105f615.tar.gz Essentials-04de66bc8aaa018b47a3193e37f8e34d1105f615.tar.lz Essentials-04de66bc8aaa018b47a3193e37f8e34d1105f615.tar.xz Essentials-04de66bc8aaa018b47a3193e37f8e34d1105f615.zip |
Sneaking in an option to disable prefix/suffix selectively.
(This will probably be removed during ess chat rewrite).
-rw-r--r-- | Essentials/src/com/earth2me/essentials/ISettings.java | 4 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 10 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 20 |
3 files changed, 29 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index d058d892a..fa36ecc9f 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -124,6 +124,10 @@ public interface ISettings extends IConf boolean useBukkitPermissions(); boolean addPrefixSuffix(); + + boolean disablePrefix(); + + boolean disableSuffix(); boolean isUpdateEnabled(); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index e59c3c2b2..954e52542 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -498,6 +498,16 @@ public class Settings implements ISettings { return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat")); } + + public boolean disablePrefix() + { + return config.getBoolean("disablePrefix", false); + } + + public boolean disableSuffix() + { + return config.getBoolean("disableSuffix", false); + } @Override public boolean isUpdateEnabled() diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index bcc871eab..ef3e91a55 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -269,12 +269,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser if (ess.getSettings().addPrefixSuffix()) { - final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); - final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); - nickname.insert(0, prefix); - nickname.append(suffix); - if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§")) + if (!ess.getSettings().disablePrefix()) + { + final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); + nickname.insert(0, prefix); + } + if (!ess.getSettings().disableSuffix()) + { + final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); + nickname.append(suffix); + if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§")) + { + nickname.append("§f"); + } + } + else { nickname.append("§f"); } |