summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-02-23 11:43:40 +0000
committerDinnerbone <dinnerbone@dinnerbone.com>2011-02-23 11:43:40 +0000
commit0e0a76625b6eae323c1ae14e7a75742a2d9b3acf (patch)
tree841ac213ad77ce9db2f81e4d3d92e935b70bd088 /src
parent86aa75c3b5b1f634e6876f2cdf75e11d9565a329 (diff)
downloadbukkit-0e0a76625b6eae323c1ae14e7a75742a2d9b3acf.tar
bukkit-0e0a76625b6eae323c1ae14e7a75742a2d9b3acf.tar.gz
bukkit-0e0a76625b6eae323c1ae14e7a75742a2d9b3acf.tar.lz
bukkit-0e0a76625b6eae323c1ae14e7a75742a2d9b3acf.tar.xz
bukkit-0e0a76625b6eae323c1ae14e7a75742a2d9b3acf.zip
Added ChatColor.stripColor
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/ChatColor.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index 2ce5e82f..bcd0da6d 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -103,6 +103,16 @@ public enum ChatColor {
return colors.get(code);
}
+ /**
+ * Strips the given message of all color codes
+ *
+ * @param input String to strip of color
+ * @return A copy of the input string, without any coloring
+ */
+ public static String stripColor(final String input) {
+ return input.replaceAll("(?i)\u00A7[0-F]", "");
+ }
+
static {
for (ChatColor color : ChatColor.values()) {
colors.put(color.getCode(), color);