-
-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🛠 Fix toFormattedString for null nodes #5303
🛠 Fix toFormattedString for null nodes #5303
Conversation
// Replace configured messages chat styles without user variables | ||
String lineInfoMsg = replaceNewline(Utils.replaceEnglishChatStyles(lineInfo.getValue() == null ? lineInfo.key : lineInfo.getValue())); | ||
String detailsMsg = replaceNewline(Utils.replaceEnglishChatStyles(details.getValue() == null ? details.key : details.getValue())); | ||
String lineDetailsMsg = replaceNewline(Utils.replaceEnglishChatStyles(LINE_DETAILS.getValue() == null ? LINE_DETAILS.key : LINE_DETAILS.getValue())); | ||
|
||
if (node == null) | ||
return String.format(detailsMsg.replaceAll("(\\s){2,}", ""), message); // Remove line beginning spaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if replacing 2+ whitespace is the best approach here.
Also the group isn't needed I think: \\s{2,}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding upon what TP said, you can use String#stripLeading
to remove the leading whitespaces in a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String#stripLeading
Java 12 11 feature :(
Description
This PR fixes logger level color for messages that doesn't have a node.
Before:
After:
Target Minecraft Versions: Any
Requirements: None
Related Issues: None