diff options
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; + } +} |