From 845f3e1f16ccbcc37f2d33fd4b203c72f27d6f87 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 16 Dec 2016 21:16:22 +0100 Subject: [PATCH] Added a workaround for the issue... Just realized that the match itself is null --- src/main/java/buttondevteam/chat/ChatProcessing.java | 2 -- .../buttondevteam/chat/formatting/ChatFormatter.java | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java index 232cfb8..238d28a 100644 --- a/src/main/java/buttondevteam/chat/ChatProcessing.java +++ b/src/main/java/buttondevteam/chat/ChatProcessing.java @@ -147,8 +147,6 @@ public class ChatProcessing { formatters.add(new ChatFormatterBuilder().setRegex(Pattern.compile(nicksb.toString())).setColor(Color.Aqua) .setOnmatch((String match) -> { - System.out.println("Match: " + match); - System.out.println("A nickname: " + PlayerListener.nicknames.keySet().stream().findAny()); if (PlayerListener.nicknames.containsKey(match)) { Player p = Bukkit.getPlayer(PlayerListener.nicknames.get(match)); if (p == null) { diff --git a/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java b/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java index 0594c93..762bc11 100644 --- a/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java +++ b/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java @@ -164,12 +164,15 @@ public final class ChatFormatter { section.Formatters.sort((cf2, cf1) -> cf1.priority.compareTo(cf2.priority)); for (ChatFormatter formatter : section.Formatters) { DebugCommand.SendDebugMessage("Applying formatter: " + formatter); - if (formatter.onmatch != null) - originaltext = formatter.onmatch.apply(originaltext); + if (formatter.onmatch != null) { + String f = formatter.onmatch.apply(originaltext); + if (f != null) + originaltext = f; //TODO: Find out... + } if (formatter.color != null) color = formatter.color; if (formatter.format != null) - format = formatter.format.getFlag(); //TODO: Fix + format = formatter.format.getFlag(); // TODO: Fix if (formatter.openlink != null) openlink = formatter.openlink; }