mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Fix format parsing in local spy chat format (Fixes #5665)
This commit is contained in:
parent
1dccfbfcee
commit
82606a7ced
@ -125,6 +125,13 @@ public final class AdventureUtil {
|
||||
return COLORS[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for submodules to escape MiniMessage tags.
|
||||
*/
|
||||
public static String escapeTags(final String input) {
|
||||
return miniMessage().escapeTags(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters for a translation message are not parsed for MiniMessage by default to avoid injection. If you want
|
||||
* a parameter to be parsed for MiniMessage you must wrap it in a ParsedPlaceholder by using this method.
|
||||
|
@ -227,8 +227,10 @@ public abstract class AbstractChatHandler {
|
||||
server.getPluginManager().callEvent(spyEvent);
|
||||
|
||||
if (!spyEvent.isCancelled()) {
|
||||
final String legacyString = AdventureUtil.miniToLegacy(String.format(spyEvent.getFormat(), AdventureUtil.legacyToMini(user.getDisplayName()), AdventureUtil.escapeTags(spyEvent.getMessage())));
|
||||
|
||||
for (final Player onlinePlayer : spyEvent.getRecipients()) {
|
||||
onlinePlayer.sendMessage(String.format(spyEvent.getFormat(), user.getDisplayName(), spyEvent.getMessage()));
|
||||
onlinePlayer.sendMessage(legacyString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user