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
{
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("[Alert] "); //No space at start.
builder.append("[Alert] ");
}
for (String s : args)
{
s = s.replaceAll("&h", ""); //Fix replace
builder.append(ChatColor.translateAlternateColorCodes('&', s)); //Allow custom colours
s = s.replace("&h", "");
builder.append(ChatColor.translateAlternateColorCodes('&', s));
builder.append(" ");
}

View File

@ -1,10 +1,12 @@
package net.md_5.bungee.command;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
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
{
@ -18,11 +20,11 @@ public class CommandMotd extends Command
} else
{
String newMOTD = "";
for (String s: args)
for (String s : args)
{
newMOTD = newMOTD + s + " ";
}
newMOTD = newMOTD.substring(0, newMOTD.length()-1);
newMOTD = newMOTD.substring(0, newMOTD.length() - 1);
BungeeCord.instance.config.motd = newMOTD;
}
}