Fix replace method

This commit is contained in:
lol768 2012-10-22 12:31:22 +01:00 committed by md_5
parent d4122eb5e5
commit d47f37557c
2 changed files with 12 additions and 11 deletions

View File

@ -22,17 +22,16 @@ public class CommandAlert extends Command
} else } else
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (!args[0].contains("&h")) //They want to hide the alert prefix if (!args[0].startsWith("&h"))
{ {
builder.append(ChatColor.DARK_PURPLE); builder.append(ChatColor.DARK_PURPLE);
builder.append("[Alert] "); //No space at start. builder.append("[Alert] ");
} }
for (String s : args) for (String s : args)
{ {
s = s.replaceAll("&h", ""); //Fix replace s = s.replace("&h", "");
builder.append(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours builder.append(ChatColor.translateAlternateColorCodes('&', s));
builder.append(" "); builder.append(" ");
} }

View File

@ -1,10 +1,12 @@
package net.md_5.bungee.command; package net.md_5.bungee.command;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
import net.md_5.bungee.Permission; import net.md_5.bungee.Permission;
/** /**
* Command to set a temp copy of the motd in real-time without stopping the proxy * Command to set a temp copy of the motd in real-time without stopping the
* proxy.
*/ */
public class CommandMotd extends Command public class CommandMotd extends Command
{ {