mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +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";
|
input = "white";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.isOnline()) {
|
if (user != null && user.isOnline()) {
|
||||||
input = PlaceholderAPI.setPlaceholders(user.asPlayer(), input);
|
input = PlaceholderAPI.setPlaceholders(user.asPlayer(), input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,23 +103,7 @@ public final class CarbonUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TextColor parseColor(String input) {
|
public static TextColor parseColor(String input) {
|
||||||
if (input == null) {
|
return parseColor(null, input);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Argument onlineChatUserArgument() {
|
public static Argument onlineChatUserArgument() {
|
||||||
|
|||||||
Reference in new issue
Block a user