use of au.com.mineauz.minigames.events.MinigamesBroadcastEvent in project Minigames by AddstarMC.
the class MinigameUtils method broadcast.
/**
* Broadcasts a server message without a permission.
* @param message - The message to be broadcasted (Can be manipulated with MinigamesBroadcastEvent)
* @param minigame - The Minigame this broadcast is related to.
* @param prefixColor - The color to be used in the prefix.
*/
public static void broadcast(String message, Minigame minigame, ChatColor prefixColor) {
MinigamesBroadcastEvent ev = new MinigamesBroadcastEvent(prefixColor + "[Minigames]" + ChatColor.WHITE, message, minigame);
Bukkit.getPluginManager().callEvent(ev);
Bukkit.getServer().broadcastMessage(ev.getMessageWithPrefix());
}
use of au.com.mineauz.minigames.events.MinigamesBroadcastEvent in project Minigames by AddstarMC.
the class MessageManager method broadcast.
/**
* Broadcasts a message with a defined permission.
*
* @param message - The message to be broadcast (Can be manipulated with MinigamesBroadcastEvent)
* @param minigame - The Minigame this broadcast is related to.
* @param permission - The permission required to see this broadcast message.
*/
public static void broadcast(String message, Minigame minigame, String permission) {
MinigamesBroadcastEvent ev = new MinigamesBroadcastEvent(org.bukkit.ChatColor.AQUA + "[Minigames]" + org.bukkit.ChatColor.WHITE, message, minigame);
Bukkit.getPluginManager().callEvent(ev);
// Only send broadcast if event was not cancelled and is not empty
if (!ev.isCancelled() && !ev.getMessage().isEmpty())
Bukkit.getServer().broadcast(ev.getMessageWithPrefix(), permission);
}
use of au.com.mineauz.minigames.events.MinigamesBroadcastEvent in project Minigames by AddstarMC.
the class MinigameUtils method broadcast.
/**
* Broadcasts a message with a defined permission.
* @param message - The message to be broadcasted (Can be manipulated with MinigamesBroadcastEvent)
* @param minigame - The Minigame this broadcast is related to.
* @param permission - The permission required to see this broadcast message.
*/
public static void broadcast(String message, Minigame minigame, String permission) {
MinigamesBroadcastEvent ev = new MinigamesBroadcastEvent(ChatColor.AQUA + "[Minigames]" + ChatColor.WHITE, message, minigame);
Bukkit.getPluginManager().callEvent(ev);
Bukkit.getServer().broadcast(ev.getMessageWithPrefix(), permission);
}
use of au.com.mineauz.minigames.events.MinigamesBroadcastEvent in project Minigames by AddstarMC.
the class MessageManager method broadcast.
/**
* Broadcasts a server message without a permission.
*
* @param message - The message to be broadcasted (Can be manipulated with MinigamesBroadcastEvent)
* @param minigame - The Minigame this broadcast is related to.
* @param prefixColor - The color to be used in the prefix.
*/
public static void broadcast(String message, Minigame minigame, org.bukkit.ChatColor prefixColor) {
BaseComponent init = new TextComponent("[Minigames]");
init.setColor(prefixColor.asBungee());
TextComponent m = new TextComponent(" " + message);
MinigamesBroadcastEvent ev = new MinigamesBroadcastEvent(prefixColor + "[Minigames]" + org.bukkit.ChatColor.WHITE, message, minigame);
Bukkit.getPluginManager().callEvent(ev);
// Only send broadcast if event was not cancelled and is not empty
if (!ev.isCancelled() && !ev.getMessage().isEmpty()) {
if (PaperLib.isPaper()) {
Bukkit.getServer().broadcast(init, m);
} else {
Bukkit.getServer().spigot().broadcast(init, m);
}
}
}
Aggregations