This commit is contained in:
1 parent
01c0e27a61
commit
5d42b48c8b
1 file changed
+6
-3
@@ -60,6 +60,7 @@ import com.sun.net.httpserver.HttpServer;
|
||||
|
||||
public final class AsminDiscordBridge extends JavaPlugin {
|
||||
private static final Pattern LEGACY_COLOR = Pattern.compile("(?i)§[0-9A-FK-OR]");
|
||||
private static final Pattern HEX_COLOR = Pattern.compile("(?i)&#[0-9A-F]{6}");
|
||||
|
||||
private JDA jda;
|
||||
private LuckPerms luckPerms;
|
||||
@@ -498,9 +499,11 @@ public final class AsminDiscordBridge extends JavaPlugin {
|
||||
}
|
||||
|
||||
private String formatPrefix(String prefix) {
|
||||
String translated = ChatColor.translateAlternateColorCodes('&', prefix);
|
||||
String plain = ChatColor.stripColor(translated);
|
||||
if (plain == null || plain.isEmpty()) return "";
|
||||
if (prefix == null) return "";
|
||||
String translated = HEX_COLOR.matcher(prefix).replaceAll("");
|
||||
translated = ChatColor.translateAlternateColorCodes('&', translated);
|
||||
String plain = ChatColor.stripColor(translated).trim();
|
||||
if (plain.isEmpty()) return "";
|
||||
return LEGACY_COLOR.matcher(translated).find() && translated.matches("(?s).*§[lL].*")
|
||||
? "**" + plain + "** " : plain + " ";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user