package net.md_5.bungee.command;

import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
import net.md_5.bungee.Permission;
import net.md_5.bungee.UserConnection;

public class CommandAlert extends Command
{

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        if (getPermission(sender) != Permission.ADMIN)
        {
            sender.sendMessage(ChatColor.RED + "You do not have permission to execute this command!");
            return;
        }
        if (args.length == 0)
        {
            sender.sendMessage(ChatColor.RED + "You must supply a message.");
        } else
        {
            StringBuilder builder = new StringBuilder();
            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(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours
                builder.append(" ");
            }
            String message = builder.substring(0, builder.length() - 1);
            for (UserConnection con : BungeeCord.instance.connections.values())
            {
                con.sendMessage(message);
            }
        }
    }
}

@@ -791,36 +791,32 @@
   %7B%0A            
-    
 builder.append(C
@@ -838,20 +838,16 @@
 URPLE);%0A
-    
         
@@ -904,37 +904,32 @@
 t.%0A            %7D
- else
 %0A            %7B%0A 
@@ -917,33 +917,32 @@
   %7D%0A            
-%7B
 %0A               
@@ -942,81 +942,42 @@
     
+%0A
     
-args%5B0%5D.replaceAll(%22&h%22, %22%22); //Remove hide control code from message
+        for (String s : args)
 %0A   
@@ -985,18 +985,17 @@
         
-%7D%0A
+%7B
 %0A       
@@ -1003,44 +1003,53 @@
     
-for (String s : args)%0A            %7B%0A
+    s = s.replaceAll(%22&h%22, %22%22); //Fix replace
 %0A   
@@ -1191,32 +1191,45 @@
 ;%0A            %7D%0A
+            %0A
             Stri

Fix &h not being removed from the message properly