diff options
author | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
---|---|---|
committer | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
commit | 78f4820876f42f7b50bf88f64afd45bee939e4e4 (patch) | |
tree | 317cd3bcc63fc9e86a6efbcb5e13a50ed9efbaaf /EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java | |
parent | 26409058467e9f34aa65a08df3c68a58129d22ba (diff) | |
download | Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.gz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.lz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.xz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.zip |
Initial formatted and slightly tweaked version of @evenprime 's NoCheat. Will be intergrated into the main Essentials as soon as possible
Diffstat (limited to 'EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java')
-rw-r--r-- | EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java new file mode 100644 index 000000000..053b177e5 --- /dev/null +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java @@ -0,0 +1,42 @@ +package com.earth2me.essentials.anticheat; + +import org.bukkit.ChatColor; + + +/** + * Manages color codes in NoCheat + * + */ +public class Colors +{ + /** + * Replace instances of &X with a color + * + * @param text + * @return + */ + public static String replaceColors(String text) + { + for (ChatColor c : ChatColor.values()) + { + text = text.replace("&" + c.getChar(), c.toString()); + } + + return text; + } + + /** + * Remove instances of &X + * + * @param text + * @return + */ + public static String removeColors(String text) + { + for (ChatColor c : ChatColor.values()) + { + text = text.replace("&" + c.getChar(), ""); + } + return text; + } +} |