mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Added collection-support for sendMessages in MVMessaging.
This commit is contained in:
parent
79c06b5c42
commit
1af30dad1d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user