diff --git a/build-number.txt b/build-number.txt index f845c1c7..a01282d2 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1267 \ No newline at end of file +1270 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 80e6b17f..ec0eabdf 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { group = 'me.chayapak1' version = 'rolling' description = 'ChomeNS Bot' -java.sourceCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_21 repositories { mavenLocal() diff --git a/src/main/java/me/chayapak1/chomens_bot/util/ComponentUtilities.java b/src/main/java/me/chayapak1/chomens_bot/util/ComponentUtilities.java index e1e9c3d5..8ef0fe5e 100644 --- a/src/main/java/me/chayapak1/chomens_bot/util/ComponentUtilities.java +++ b/src/main/java/me/chayapak1/chomens_bot/util/ComponentUtilities.java @@ -149,12 +149,13 @@ public class ComponentUtilities { } public static PartiallyStringified stringifyPartially (Component message, boolean motd, boolean ansi, String lastColor, boolean noHex, int depth) { - if (message instanceof TextComponent) return stringifyPartially((TextComponent) message, motd, ansi, lastColor, noHex); - else if (message instanceof TranslatableComponent) return stringifyPartially((TranslatableComponent) message, motd, ansi, lastColor, noHex, depth); - else if (message instanceof SelectorComponent) return stringifyPartially((SelectorComponent) message, motd, ansi, lastColor, noHex); - else if (message instanceof KeybindComponent) return stringifyPartially((KeybindComponent) message, motd, ansi, lastColor, noHex); - - return new PartiallyStringified("", null); + return switch (message) { + case TextComponent t_component -> stringifyPartially(t_component, motd, ansi, lastColor, noHex); + case TranslatableComponent t_component -> stringifyPartially(t_component, motd, ansi, lastColor, noHex, depth); + case SelectorComponent t_component -> stringifyPartially(t_component, motd, ansi, lastColor, noHex); + case KeybindComponent t_component -> stringifyPartially(t_component, motd, ansi, lastColor, noHex); + default -> new PartiallyStringified("", null); + }; } public static String getStyle (Style textStyle, boolean motd) {