Added a workaround for the issue...

Just realized that the match itself is null
This commit is contained in:
Norbi Peti 2016-12-16 21:16:22 +01:00
parent a09a30d460
commit 845f3e1f16
2 changed files with 6 additions and 5 deletions

View file

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

View file

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