From 80a240bf09406d31289e40eb73dde5bb80f207b3 Mon Sep 17 00:00:00 2001 From: business-goose Date: Sun, 20 Mar 2022 16:01:28 +0000 Subject: [PATCH] Make announcer no longer spam the Discord bridge --- .../TotalFreedomMod/announcer/Announcer.java | 2 +- .../TotalFreedomMod/util/Utilities.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/StevenLawson/TotalFreedomMod/announcer/Announcer.java b/src/main/java/me/StevenLawson/TotalFreedomMod/announcer/Announcer.java index 47a7532..b948c19 100644 --- a/src/main/java/me/StevenLawson/TotalFreedomMod/announcer/Announcer.java +++ b/src/main/java/me/StevenLawson/TotalFreedomMod/announcer/Announcer.java @@ -89,7 +89,7 @@ public class Announcer current = 0; } - Utilities.bcastMsg(prefix + ANNOUNCEMENTS.get(current)); + Utilities.bcastMsg(prefix + ANNOUNCEMENTS.get(current), false); } }; diff --git a/src/main/java/me/StevenLawson/TotalFreedomMod/util/Utilities.java b/src/main/java/me/StevenLawson/TotalFreedomMod/util/Utilities.java index b2a0218..07965e1 100644 --- a/src/main/java/me/StevenLawson/TotalFreedomMod/util/Utilities.java +++ b/src/main/java/me/StevenLawson/TotalFreedomMod/util/Utilities.java @@ -84,14 +84,24 @@ public class Utilities throw new AssertionError(); } - public static void bcastMsg(String message, ChatColor color) { + public static void bcastMsg(String message, ChatColor color, boolean transmitToDiscord) { Log.info(message, true); for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) { player.sendMessage((color == null ? "" : color) + message); } - DiscordBridge.transmitMessage(message); + if(transmitToDiscord) { + DiscordBridge.transmitMessage(message); + } + } + + public static void bcastMsg(String message, ChatColor color) { + bcastMsg(message, color, true); + } + + public static void bcastMsg(String message, boolean transmitToDiscord) { + bcastMsg(message, null, transmitToDiscord); } public static void bcastMsg(String message)