Added collection-support for sendMessages in MVMessaging.

This commit is contained in:
main() 2012-01-06 18:00:34 +01:00
parent 79c06b5c42
commit 1af30dad1d

View File

@ -10,6 +10,7 @@ package com.onarandombox.MultiverseCore.utils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@ -76,6 +77,20 @@ public class MVMessaging {
return false;
}
/**
* Sends a group of messages to the specified sender if the cooldown has passed.
* This method is needed, since sending many messages in quick succession would violate
* the cooldown.
*
* @param sender The person/console to send the message to.
* @param messages The messages to send.
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
public boolean sendMessages(CommandSender sender, Collection<String> messages, boolean ignoreCooldown) {
return this.sendMessages(sender, messages.toArray(new String[0]), ignoreCooldown);
}
private void sendMessages(CommandSender sender, String[] messages) {
for (String s : messages) {
sender.sendMessage(s);