#23: Fix format colorization
This commit is contained in:
@@ -7,6 +7,8 @@ import me.oskar3123.staffchat.util.StringUtils;
|
||||
|
||||
public class BungeeFormatUtils {
|
||||
|
||||
private BungeeFormatUtils() {}
|
||||
|
||||
public static String replacePlaceholders(
|
||||
String string,
|
||||
Function<String, String> colorize,
|
||||
|
||||
@@ -5,11 +5,14 @@ import java.util.function.Supplier;
|
||||
|
||||
public class FormatUtils {
|
||||
|
||||
private FormatUtils() {}
|
||||
|
||||
public static String replacePlaceholders(
|
||||
String string,
|
||||
Function<String, String> colorize,
|
||||
Supplier<String> nameSupplier,
|
||||
String message) {
|
||||
string = colorize.apply(string);
|
||||
string =
|
||||
string.replaceAll("\\{NAME}", StringUtils.sanitize(colorize.apply(nameSupplier.get())));
|
||||
string = string.replaceAll("\\{MESSAGE}", StringUtils.sanitize(message));
|
||||
|
||||
@@ -2,6 +2,8 @@ package me.oskar3123.staffchat.util;
|
||||
|
||||
public class StringUtils {
|
||||
|
||||
private StringUtils() {}
|
||||
|
||||
public static String sanitize(String string) {
|
||||
string = string.replaceAll("\\\\", "\\\\\\\\");
|
||||
string = string.replaceAll("\\$", "\\\\\\$");
|
||||
|
||||
Reference in New Issue
Block a user