mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Properly handle uppercase hex codes
This commit is contained in:
1 parent
066096dea4
commit
0045cebab3
1 file changed
+6
-6
@@ -51,10 +51,10 @@ public final class ColorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final @NonNull Pattern spigotLegacyRGB =
|
private static final @NonNull Pattern spigotLegacyRGB =
|
||||||
Pattern.compile("[§&]x[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])");
|
Pattern.compile("[§&]x[§&]([0-9a-fA-F])[§&]([0-9a-fA-F])[§&]([0-9a-fA-F])[§&]([0-9a-fA-F])[§&]([0-9a-fA-F])[§&]([0-9a-fA-F])");
|
||||||
|
|
||||||
private static final @NonNull Pattern pluginRGB =
|
private static final @NonNull Pattern pluginRGB =
|
||||||
Pattern.compile("[§&]#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])");
|
Pattern.compile("[§&]#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])");
|
||||||
|
|
||||||
public static @NonNull String translateAlternateColors(final @NonNull String input) {
|
public static @NonNull String translateAlternateColors(final @NonNull String input) {
|
||||||
// TODO: check if MiniMessage or MineDown
|
// TODO: check if MiniMessage or MineDown
|
||||||
@@ -80,8 +80,8 @@ public final class ColorUtils {
|
|||||||
|
|
||||||
if (!legacyCapable) {
|
if (!legacyCapable) {
|
||||||
// Legacy Colors
|
// Legacy Colors
|
||||||
for (final char c : "0123456789abcdef".toCharArray()) {
|
for (final char c : "0123456789abcdefABCDEF".toCharArray()) {
|
||||||
final LegacyFormat format = LegacyComponentSerializer.parseChar(c);
|
final LegacyFormat format = LegacyComponentSerializer.parseChar(Character.toLowerCase(c));
|
||||||
|
|
||||||
if (format != null) {
|
if (format != null) {
|
||||||
final TextColor color = format.color();
|
final TextColor color = format.color();
|
||||||
@@ -93,8 +93,8 @@ public final class ColorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Legacy Formatting
|
// Legacy Formatting
|
||||||
for (final char c : "klmno".toCharArray()) {
|
for (final char c : "klmnoKMNNO".toCharArray()) {
|
||||||
final LegacyFormat format = LegacyComponentSerializer.parseChar(c);
|
final LegacyFormat format = LegacyComponentSerializer.parseChar(Character.toLowerCase(c));
|
||||||
|
|
||||||
if (format != null) {
|
if (format != null) {
|
||||||
final TextDecoration decoration = format.decoration();
|
final TextDecoration decoration = format.decoration();
|
||||||
|
|||||||
Reference in new issue
Block a user