Make announcer no longer spam the Discord bridge

This commit is contained in:
business-goose 2022-03-20 16:01:28 +00:00
parent 0cc0839861
commit 80a240bf09
2 changed files with 13 additions and 3 deletions

View file

@ -89,7 +89,7 @@ public class Announcer
current = 0; current = 0;
} }
Utilities.bcastMsg(prefix + ANNOUNCEMENTS.get(current)); Utilities.bcastMsg(prefix + ANNOUNCEMENTS.get(current), false);
} }
}; };

View file

@ -84,14 +84,24 @@ public class Utilities
throw new AssertionError(); 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); Log.info(message, true);
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) { for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
player.sendMessage((color == null ? "" : color) + message); 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) public static void bcastMsg(String message)