More efficient handling of Party/Admin chat messages

This commit is contained in:
GJ 2012-07-05 09:21:07 -04:00
parent ccd103cd88
commit d6d1e0ffed
2 changed files with 18 additions and 6 deletions

View File

@ -55,12 +55,16 @@ public class ACommand implements CommandExecutor {
return true;
default:
String message = args[0];
StringBuffer buffer = new StringBuffer();
buffer.append(args[0]);
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
buffer.append(" ");
buffer.append(args[i]);
}
String message = buffer.toString();
if (sender instanceof Player) {
Player player = (Player) sender;

View File

@ -65,12 +65,16 @@ public class PCommand implements CommandExecutor {
return true;
}
String message = args[0];
StringBuffer buffer = new StringBuffer();
buffer.append(args[0]);
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
buffer.append(" ");
buffer.append(args[i]);
}
String message = buffer.toString();
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), party.getName(), message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
@ -98,12 +102,16 @@ public class PCommand implements CommandExecutor {
return true;
}
String message = args[1];
StringBuffer buffer = new StringBuffer();
buffer.append(args[1]);
for (int i = 2; i < args.length; i++) {
message = message + " " + args [i];
buffer.append(" ");
buffer.append(args[i]);
}
String message = buffer.toString();
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], message);
plugin.getServer().getPluginManager().callEvent(chatEvent);