Improved speaker support for text formatting

This commit is contained in:
LemADEC 2020-06-18 00:05:01 +02:00
parent 38131f9b37
commit e9fe182f56
2 changed files with 5 additions and 1 deletions

View file

@ -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));

View file

@ -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++;
}