Skip to content

Commit

Permalink
Fix newline pattern conflicting with new chatcolors
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jun 11, 2020
1 parent 5ae1b4a commit cc91489
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ public String[] getPaddedSlice(int index, int padding) {
public Location getSenderLocation() throws CommandException {
if (location != null || sender == null)
return location;
if (sender instanceof Player)
if (sender instanceof Player) {
location = ((Player) sender).getLocation();
else if (sender instanceof BlockCommandSender)
} else if (sender instanceof BlockCommandSender) {
location = ((BlockCommandSender) sender).getBlock().getLocation();
}
if (hasValueFlag("location")) {
location = parseLocation(location, getFlag("location"));
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/citizensnpcs/api/util/Messaging.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.common.base.Splitter;

import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.trait.trait.Owner;

public class Messaging {
private static class DebugFormatter extends Formatter {
Expand Down Expand Up @@ -111,7 +110,7 @@ private static String prettify(String message) {
}
message = message.replace("[[", HIGHLIGHT_COLOUR);
message = message.replace("{{", ERROR_COLOUR);
return CHAT_NEWLINE.matcher(message).replaceAll("<n>]]").replace("]]", messageColour);
return CHAT_NEWLINE.matcher(message).replaceAll("<br>]]").replace("]]", messageColour);
}

public static void send(CommandSender sender, Object... msg) {
Expand Down Expand Up @@ -169,7 +168,7 @@ public static String tryTranslate(Object possible) {
return count >= 2 ? tr(message) : message;
}

private static final Pattern CHAT_NEWLINE = Pattern.compile("<br>|<n>|\\n", Pattern.MULTILINE);
private static final Pattern CHAT_NEWLINE = Pattern.compile("<br>|\\n", Pattern.MULTILINE);
private static final Splitter CHAT_NEWLINE_SPLITTER = Splitter.on(CHAT_NEWLINE);
private static boolean DEBUG = false;
private static Logger DEBUG_LOGGER;
Expand Down

0 comments on commit cc91489

Please sign in to comment.