Skip to content

Commit

Permalink
Should fix #334
Browse files Browse the repository at this point in the history
  • Loading branch information
MuresanSergiu committed Oct 26, 2015
1 parent 67c851d commit f8d2dbc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/myessentials/utils/ChatUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package myessentials.utils;

import myessentials.Localization;
import myessentials.MyEssentialsCore;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

Expand All @@ -20,12 +21,17 @@ private ChatUtils() {
public static void sendChat(ICommandSender sender, String msg, Object... args) {
if (sender == null) return;
String[] lines;
if(args == null)
if(args == null) {
lines = msg.split("\\\\n");
else
} else {
lines = String.format(msg, args).split("\\\\n");
for (String line : lines) {
sender.addChatMessage(new ChatComponentText(line));
}
try {
for (String line : lines) {
sender.addChatMessage(new ChatComponentText(line));
}
} catch (Exception ex) {
MyEssentialsCore.instance.LOG.error("Failed to send chat message! Message: {}", msg);
}
}

Expand Down

0 comments on commit f8d2dbc

Please sign in to comment.