From 1ac07d0d3ad591ad6259cd348fce450e80331fd4 Mon Sep 17 00:00:00 2001 From: Draycia Date: Tue, 8 Sep 2020 11:59:56 -0700 Subject: [PATCH] Use BukkitAudiences#console() instead of serialization --- .../net/draycia/carbon/commands/AliasedChannelCommand.java | 3 +-- src/main/java/net/draycia/carbon/commands/ChannelCommand.java | 3 +-- .../java/net/draycia/carbon/commands/SudoChannelCommand.java | 3 +-- .../java/net/draycia/carbon/listeners/BukkitChatListener.java | 3 +-- src/main/java/net/draycia/carbon/messaging/MessageManager.java | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java b/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java index f4dc57d0..da603cea 100644 --- a/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java +++ b/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java @@ -68,8 +68,7 @@ public class AliasedChannelCommand { Component component = getChatChannel().sendMessage(user, message, false); - carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component) - .replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%")); + carbonChat.getAdventureManager().getAudiences().console().sendMessage(component); } public ChatChannel getChatChannel() { diff --git a/src/main/java/net/draycia/carbon/commands/ChannelCommand.java b/src/main/java/net/draycia/carbon/commands/ChannelCommand.java index cf31b525..1c2ae001 100644 --- a/src/main/java/net/draycia/carbon/commands/ChannelCommand.java +++ b/src/main/java/net/draycia/carbon/commands/ChannelCommand.java @@ -78,8 +78,7 @@ public class ChannelCommand { Component component = channel.sendMessage(user, message, false); - carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component) - .replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%")); + carbonChat.getAdventureManager().getAudiences().console().sendMessage(component); } } diff --git a/src/main/java/net/draycia/carbon/commands/SudoChannelCommand.java b/src/main/java/net/draycia/carbon/commands/SudoChannelCommand.java index 0da0fe29..b25e20af 100644 --- a/src/main/java/net/draycia/carbon/commands/SudoChannelCommand.java +++ b/src/main/java/net/draycia/carbon/commands/SudoChannelCommand.java @@ -69,8 +69,7 @@ public class SudoChannelCommand { private void sendMessageOther(CommandSender sender, ChatUser user, ChatChannel channel, String message) { Component component = channel.sendMessage(user, message, false); - carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component) - .replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%")); + carbonChat.getAdventureManager().getAudiences().console().sendMessage(component); } } diff --git a/src/main/java/net/draycia/carbon/listeners/BukkitChatListener.java b/src/main/java/net/draycia/carbon/listeners/BukkitChatListener.java index 884e528f..66cb9efe 100644 --- a/src/main/java/net/draycia/carbon/listeners/BukkitChatListener.java +++ b/src/main/java/net/draycia/carbon/listeners/BukkitChatListener.java @@ -76,8 +76,7 @@ public class BukkitChatListener implements Listener { Bukkit.getScheduler().runTaskAsynchronously(carbonChat, () -> { Component component = selectedChannel.sendMessage(user, recipients, event.getMessage(), false); - carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component) - .replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%")); + carbonChat.getAdventureManager().getAudiences().console().sendMessage(component); if (carbonChat.getConfig().getBoolean("show-tips")) { carbonChat.getLogger().info("Tip: Sync chat event! I cannot set the message format due to this. :("); diff --git a/src/main/java/net/draycia/carbon/messaging/MessageManager.java b/src/main/java/net/draycia/carbon/messaging/MessageManager.java index a16e0684..e63cd349 100644 --- a/src/main/java/net/draycia/carbon/messaging/MessageManager.java +++ b/src/main/java/net/draycia/carbon/messaging/MessageManager.java @@ -129,8 +129,7 @@ public class MessageManager { channel.sendComponent(user, component); - carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component) - .replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%")); + carbonChat.getAdventureManager().getAudiences().console().sendMessage(component); } });