diff --git a/src/main/java/net/md_5/bungee/ChatColor.java b/src/main/java/net/md_5/bungee/ChatColor.java index c42fc866..ca157672 100644 --- a/src/main/java/net/md_5/bungee/ChatColor.java +++ b/src/main/java/net/md_5/bungee/ChatColor.java @@ -139,15 +139,16 @@ public enum ChatColor return STRIP_COLOR_PATTERN.matcher(input).replaceAll(""); } - public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) + + public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) { char[] b = textToTranslate.toCharArray(); - for (int i = 0; i < b.length - 1; i++) + for (int i = 0; i < b.length - 1; i++) { - if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) + if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) { b[i] = ChatColor.COLOR_CHAR; - b[i+1] = Character.toLowerCase(b[i+1]); + b[i + 1] = Character.toLowerCase(b[i + 1]); } } return new String(b); diff --git a/src/main/java/net/md_5/bungee/command/CommandAlert.java b/src/main/java/net/md_5/bungee/command/CommandAlert.java index 9846bf93..170d69e7 100644 --- a/src/main/java/net/md_5/bungee/command/CommandAlert.java +++ b/src/main/java/net/md_5/bungee/command/CommandAlert.java @@ -18,15 +18,23 @@ public class CommandAlert extends Command } if (args.length == 0) { - sender.sendMessage(ChatColor.RED + "Please follow this command by an announcement to make"); + sender.sendMessage(ChatColor.RED + "You must supply a message."); } else { StringBuilder builder = new StringBuilder(); - builder.append(ChatColor.DARK_PURPLE); - builder.append(" [Alert] "); + if (!args[0].contains("&h")) //They want to hide the alert prefix + { + builder.append(ChatColor.DARK_PURPLE); + builder.append("[Alert] "); //No space at start. + } else + { + args[0].replaceAll("&h", ""); //Remove hide control code from message + } + for (String s : args) { - builder.append(s); + + builder.append(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours builder.append(" "); } String message = builder.substring(0, builder.length() - 1);