Implement PR #212 - sendMessages() for CommandSenders

This commit is contained in:
md_5 2013-03-19 11:43:37 +11:00
parent 49f2f5f28b
commit 87fcef0658
3 changed files with 26 additions and 0 deletions

View File

@ -19,6 +19,14 @@ public interface CommandSender
*/ */
public void sendMessage(String message); public void sendMessage(String message);
/**
* Send several messages to this sender. Each message will be sent
* separately.
*
* @param messages the messages to send
*/
public void sendMessages(String... messages);
/** /**
* Get all groups this user is part of. This returns an unmodifiable * Get all groups this user is part of. This returns an unmodifiable
* collection. * collection.

View File

@ -183,6 +183,15 @@ public final class UserConnection implements ProxiedPlayer
ch.write( new Packet3Chat( message ) ); ch.write( new Packet3Chat( message ) );
} }
@Override
public void sendMessages(String... messages)
{
for ( String message : messages )
{
sendMessage( message );
}
}
@Override @Override
public void sendData(String channel, byte[] data) public void sendData(String channel, byte[] data)
{ {

View File

@ -25,6 +25,15 @@ public class ConsoleCommandSender implements CommandSender
System.out.println( ChatColor.stripColor( message ) ); System.out.println( ChatColor.stripColor( message ) );
} }
@Override
public void sendMessages(String... messages)
{
for ( String message : messages )
{
sendMessage( message );
}
}
@Override @Override
public String getName() public String getName()
{ {