chat message manager: fix recoloring messages with embedded </col> tags
This commit is contained in:
@@ -164,7 +164,11 @@ public class ChatMessageManager
|
||||
continue;
|
||||
}
|
||||
|
||||
messageNode.setValue(ColorUtil.wrapWithColorTag(messageNode.getValue(), chatColor.getColor()));
|
||||
// Replace </col> tags in the message with the new color so embedded </col> won't reset the color
|
||||
final Color color = chatColor.getColor();
|
||||
messageNode.setValue(ColorUtil.wrapWithColorTag(
|
||||
messageNode.getValue().replace(ColorUtil.CLOSING_COLOR_TAG, ColorUtil.colorTag(color)),
|
||||
color));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ColorUtil
|
||||
public static final int MIN_RGB_VALUE = 0;
|
||||
private static final String OPENING_COLOR_TAG_START = "<col=";
|
||||
private static final String OPENING_COLOR_TAG_END = ">";
|
||||
private static final String CLOSING_COLOR_TAG = "</col>";
|
||||
public static final String CLOSING_COLOR_TAG = "</col>";
|
||||
private final static Pattern ALPHA_HEX_PATTERN = Pattern.compile("^(#|0x)?[0-9a-fA-F]{7,8}");
|
||||
private final static Pattern HEX_PATTERN = Pattern.compile("^(#|0x)?[0-9a-fA-F]{1,8}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user