From e9fe182f564ec330a62789607f3f6546f4ffc0ac Mon Sep 17 00:00:00 2001 From: LemADEC Date: Thu, 18 Jun 2020 00:05:01 +0200 Subject: [PATCH] Improved speaker support for text formatting --- src/main/java/cr0s/warpdrive/Commons.java | 4 ++++ .../cr0s/warpdrive/block/detection/TileEntitySpeaker.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/cr0s/warpdrive/Commons.java b/src/main/java/cr0s/warpdrive/Commons.java index 9f8003fb..8ce5be48 100644 --- a/src/main/java/cr0s/warpdrive/Commons.java +++ b/src/main/java/cr0s/warpdrive/Commons.java @@ -248,6 +248,10 @@ public class Commons { public static void addChatMessage(final ICommandSender commandSender, @Nonnull final ITextComponent textComponent) { final String message = textComponent.getFormattedText(); + addChatMessage(commandSender, message); + } + + public static void addChatMessage(final ICommandSender commandSender, @Nonnull final String message) { if (commandSender == null) { WarpDrive.logger.error(String.format("Unable to send message to NULL sender: %s", message)); diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySpeaker.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySpeaker.java index f6c2e05c..3b9a3085 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntitySpeaker.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntitySpeaker.java @@ -67,7 +67,7 @@ public class TileEntitySpeaker extends TileEntityAbstractMachine { && entityPlayerMP.isEntityAlive() && !entityPlayerMP.isSpectator() ); for (final EntityPlayerMP entityPlayerMP : playersInRange) { - entityPlayerMP.sendMessage(messageFormatted); + Commons.addChatMessage(entityPlayerMP, messageFormatted); } rateMessaging++; }