mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +00:00
Reorder methods to follow conventions
This commit is contained in:
1 file changed
+16
-16
@@ -46,6 +46,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public final class CarbonUtils {
|
public final class CarbonUtils {
|
||||||
|
|
||||||
|
private static final String[] colors;
|
||||||
|
|
||||||
public static Component createComponent(final Player player) {
|
public static Component createComponent(final Player player) {
|
||||||
if (!FunctionalityConstants.HAS_HOVER_EVENT_METHOD) {
|
if (!FunctionalityConstants.HAS_HOVER_EVENT_METHOD) {
|
||||||
return net.kyori.adventure.text.TextComponent.empty();
|
return net.kyori.adventure.text.TextComponent.empty();
|
||||||
@@ -78,6 +80,10 @@ public final class CarbonUtils {
|
|||||||
return BungeeCordComponentSerializer.get().deserialize(component.create());
|
return BungeeCordComponentSerializer.get().deserialize(component.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TextColor parseColor(String input) {
|
||||||
|
return parseColor(null, input);
|
||||||
|
}
|
||||||
|
|
||||||
public static TextColor parseColor(ChatUser user, String input) {
|
public static TextColor parseColor(ChatUser user, String input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
input = "white";
|
input = "white";
|
||||||
@@ -102,10 +108,6 @@ public final class CarbonUtils {
|
|||||||
return TextColor.fromCSSHexString(input);
|
return TextColor.fromCSSHexString(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextColor parseColor(String input) {
|
|
||||||
return parseColor(null, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Argument onlineChatUserArgument() {
|
public static Argument onlineChatUserArgument() {
|
||||||
return new CustomArgument<>((input) -> {
|
return new CustomArgument<>((input) -> {
|
||||||
CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||||
@@ -144,18 +146,6 @@ public final class CarbonUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] colors;
|
|
||||||
|
|
||||||
static {
|
|
||||||
ArrayList<String> colorList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NamedTextColor color : NamedTextColor.values()) {
|
|
||||||
colorList.add(color.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
colors = colorList.toArray(new String[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Argument textColorArgument() {
|
public static Argument textColorArgument() {
|
||||||
return new CustomArgument<>((input) -> {
|
return new CustomArgument<>((input) -> {
|
||||||
TextColor color = parseColor(input);
|
TextColor color = parseColor(input);
|
||||||
@@ -196,4 +186,14 @@ public final class CarbonUtils {
|
|||||||
throw new NotImplementedException("Not implemented yet.");
|
throw new NotImplementedException("Not implemented yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
ArrayList<String> colorList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (NamedTextColor color : NamedTextColor.values()) {
|
||||||
|
colorList.add(color.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
colors = colorList.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user