mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 03:28:30 +01:00
Use Bukkit ChatColor instead of ess regex to strip colors.
This commit is contained in:
parent
28607ce58c
commit
d5301824fc
@ -4,6 +4,7 @@ import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
@ -86,7 +87,7 @@ public class SignBlockListener implements Listener {
|
||||
for (Signs signs : Signs.values()) {
|
||||
final EssentialsSign sign = signs.getSign();
|
||||
if (topLine.equalsIgnoreCase(sign.getSuccessName())) {
|
||||
event.setLine(0, FormatUtil.stripFormat(topLine));
|
||||
event.setLine(0, ChatColor.stripColor(topLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.earth2me.essentials.utils;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class FormatUtil {
|
||||
//Vanilla patterns used to strip existing formats
|
||||
static final transient Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]?");
|
||||
static final transient Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]");
|
||||
static final transient Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]");
|
||||
static final transient Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]");
|
||||
@ -27,7 +27,7 @@ public class FormatUtil {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
return stripColor(input, VANILLA_PATTERN);
|
||||
return ChatColor.stripColor(input);
|
||||
}
|
||||
|
||||
//This method is used to simply strip the & convention colour codes
|
||||
|
Loading…
Reference in New Issue
Block a user