diff --git a/src/main/java/org/mineacademy/fo/ChatUtil.java b/src/main/java/org/mineacademy/fo/ChatUtil.java index 64b9f1983..8660f8c7b 100644 --- a/src/main/java/org/mineacademy/fo/ChatUtil.java +++ b/src/main/java/org/mineacademy/fo/ChatUtil.java @@ -1,6 +1,14 @@ package org.mineacademy.fo; -import java.awt.Color; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.bukkit.ChatColor; +import org.mineacademy.fo.MinecraftVersion.V; +import org.mineacademy.fo.model.Whiteblacklist; +import org.mineacademy.fo.plugin.SimplePlugin; +import org.mineacademy.fo.remain.CompChatColor; + +import java.awt.*; import java.text.Normalizer; import java.util.ArrayList; import java.util.Arrays; @@ -9,15 +17,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.bukkit.ChatColor; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.model.Whiteblacklist; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompChatColor; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - /** * Utility class for managing in-game chat. */ @@ -225,8 +224,7 @@ public static String capitalizeFirst(final String message) { * capitalizeFully("") = "" * capitalizeFully("i am FINE") = "I Am Fine" * - * - * @param message the String to capitalize, may be null + * @return capitalized String, null if null String input */ public static String capitalizeFully(String str) { @@ -262,7 +260,6 @@ private static String capitalizeFully(String str, char[] delimiters) { * * * @author Apache Commons - WordUtils - * @param message the String to capitalize, may be null * @return capitalized String, null if null String input */ public static String capitalize(String str) { @@ -299,6 +296,34 @@ private static String capitalize(String str, char[] delimiters) { return str; } + /** + * Converts UPPER_UNDERSCORE string to Capital_Underscore + */ + public static String upperToCapitalUnderscore(String s){ + char[] array = s.toLowerCase().toCharArray(); + StringBuilder sb = new StringBuilder(); + boolean capitalizeNext = false; + char next; + + sb.append(Character.toUpperCase(array[0])); + for (int i = 1; i < array.length; i++){ + if (array[i] == '_'){ + capitalizeNext = true; + next = array[i]; + } else { + if (capitalizeNext){ + next = Character.toUpperCase(array[i]); + capitalizeNext = false; + } + else{ + next = array[i]; + } + } + sb.append(next); + } + return sb.toString(); + } + private static boolean isDelimiter(char ch, char[] delimiters) { if (delimiters == null) return Character.isWhitespace(ch); diff --git a/src/main/java/org/mineacademy/fo/annotation/AutoConfig.java b/src/main/java/org/mineacademy/fo/annotation/AutoConfig.java index b9ac015eb..63b21da08 100644 --- a/src/main/java/org/mineacademy/fo/annotation/AutoConfig.java +++ b/src/main/java/org/mineacademy/fo/annotation/AutoConfig.java @@ -8,7 +8,8 @@ import java.lang.annotation.Target; /** - * This annotation automatically saves and loads fields between a file and a YamlConfig.

+ * This annotation automatically saves and loads fields between a file and your custom + * class extending {@link org.mineacademy.fo.settings.YamlConfig}.

* On class: *