The string to search for color codes
- * @returnThe message with color codes translated
- */ - public static String translateAllColorCodes(String message) { - message = ChatColor.translateAlternateColorCodes('&', message); - Pattern pattern = Pattern.compile("(#[a-fA-F0-9]{6})"); - Matcher matcher = pattern.matcher(message); - while (matcher.find()) { - message = message.replace(matcher.group(), "" + ChatColor.of(matcher.group())); - } - return message; - } - } diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java index 6fe0158..8dd0f70 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java @@ -6,11 +6,7 @@ import net.knarcraft.bookswithoutborders.state.BookDirectory; import net.md_5.bungee.api.ChatColor; import org.bukkit.command.CommandSender; -import java.io.BufferedReader; import java.io.File; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -187,15 +183,4 @@ public final class FileHelper { return foundDuplicates; } - /** - * Gets a buffered reader given an input stream - * - * @param inputStreamThe input stream to read
- * @returnA buffered reader reading the input stream
- */ - public static BufferedReader getBufferedReaderFromInputStream(InputStream inputStream) { - InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); - return new BufferedReader(inputStreamReader); - } - } diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionHelper.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeHelper.java similarity index 51% rename from src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionHelper.java rename to src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeHelper.java index b40454c..a2b105a 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionHelper.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeHelper.java @@ -6,43 +6,9 @@ import java.util.List; /** * Helper class for getting string lists required for auto-completion */ -public final class TabCompletionHelper { +public final class TabCompletionTypeHelper { - private TabCompletionHelper() { - } - - /** - * Finds tab complete values that contain the typed text - * - * @param valuesThe values to filter
- * @param typedTextThe text the player has started typing
- * @returnThe given string values that contain the player's typed text
- */ - public static ListThe values to filter
- * @param typedTextThe text the player has started typing
- * @returnThe given string values that start with the player's typed text
- */ - public static ListThe new available plugin version
- * @param oldVersionThe old (current) plugin version
- * @returnThe string to display
- */ - public static String getUpdateAvailableString(String newVersion, String oldVersion) { - return String.format(updateNotice, newVersion, oldVersion); - } - - /** - * Decides whether one version number is higher than another - * - * @param oldVersionThe old version to check
- * @param newVersionThe new version to check
- * @returnTrue if the new version is higher than the old one
- */ - public static boolean isVersionHigher(String oldVersion, String newVersion) { - String[] oldVersionParts = oldVersion.split("\\."); - String[] newVersionParts = newVersion.split("\\."); - int versionLength = Math.max(oldVersionParts.length, newVersionParts.length); - for (int i = 0; i < versionLength; i++) { - int oldVersionNumber = oldVersionParts.length > i ? Integer.parseInt(oldVersionParts[i]) : 0; - int newVersionNumber = newVersionParts.length > i ? Integer.parseInt(newVersionParts[i]) : 0; - if (newVersionNumber != oldVersionNumber) { - return newVersionNumber > oldVersionNumber; - } - } - return false; - } - -}