mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Remove duplicate code in #parseColor
This commit is contained in:
1 file changed
+2
-18
@@ -83,7 +83,7 @@ public final class CarbonUtils {
|
||||
input = "white";
|
||||
}
|
||||
|
||||
if (user.isOnline()) {
|
||||
if (user != null && user.isOnline()) {
|
||||
input = PlaceholderAPI.setPlaceholders(user.asPlayer(), input);
|
||||
}
|
||||
|
||||
@@ -103,23 +103,7 @@ public final class CarbonUtils {
|
||||
}
|
||||
|
||||
public static TextColor parseColor(String input) {
|
||||
if (input == null) {
|
||||
input = "white";
|
||||
}
|
||||
|
||||
for (NamedTextColor namedColor : NamedTextColor.values()) {
|
||||
if (namedColor.toString().equalsIgnoreCase(input)) {
|
||||
return namedColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (input.contains("&") || input.contains("§")) {
|
||||
input = input.replace("&", "§");
|
||||
|
||||
return LegacyComponentSerializer.legacySection().deserialize(input).color();
|
||||
}
|
||||
|
||||
return TextColor.fromCSSHexString(input);
|
||||
return parseColor(null, input);
|
||||
}
|
||||
|
||||
public static Argument onlineChatUserArgument() {
|
||||
|
||||
Reference in new issue
Block a user