mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-08 01:17:41 +01:00
Fixes #1637 /mail stripped colors from the entire message before as reported by the issue. The desired fix was to only strip the color from the sent message rather than from the entire message format (e.g. prefixes coming before the message itself). Fixed by formatting only the message before passing it to the localization. Also had a minor issue with FormatUtil in which it failed to strip ampersand (&)-formatted color codes, which was amended by stripping both VANILLA_*_PATTERN as well as REPLACE_*_PATTERN in FormatUtil#formatString(...). It's not necessary to actualy strip any vanilla (i.e. section-prefixed) color codes since that's already done by FormatUtil#stripFormat(String), but I'd like to keep the changes as non-invasive as possible at the current moment. Demo: git-Spigot-d20369f-7fc5cd8 (MC: 1.9) (Implementing API version 1.9-R0.1-SNAPSHOT) https://streamable.com/umyi8 This is my first time contributing so please be gentle :)
This commit is contained in:
parent
d581f48cd1
commit
fb5ebdb0c2
@ -56,8 +56,7 @@ public class Commandmail extends EssentialsCommand {
|
||||
throw new Exception(tl("playerNeverOnServer", args[1]));
|
||||
}
|
||||
|
||||
String mail = tl("mailFormat", user.getName(), StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2))));
|
||||
mail = FormatUtil.formatMessage(user, "essentials.mail", mail);
|
||||
String mail = tl("mailFormat", user.getName(), FormatUtil.formatMessage(user, "essentials.mail", StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2)))));
|
||||
if (mail.length() > 1000) {
|
||||
throw new Exception(tl("mailTooLong"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user