From 38eb0f9a44421e6de8b8bdf0aa01e082f186077e Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 28 Feb 2024 15:38:05 +0000 Subject: [PATCH] Remove ResourceUtils This isn't, nor ever was, used anywhere. --- .../civmodcore/utilities/ResourceUtils.java | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 plugins/civmodcore-paper/src/main/java/vg/civcraft/mc/civmodcore/utilities/ResourceUtils.java diff --git a/plugins/civmodcore-paper/src/main/java/vg/civcraft/mc/civmodcore/utilities/ResourceUtils.java b/plugins/civmodcore-paper/src/main/java/vg/civcraft/mc/civmodcore/utilities/ResourceUtils.java deleted file mode 100644 index e276c760c..000000000 --- a/plugins/civmodcore-paper/src/main/java/vg/civcraft/mc/civmodcore/utilities/ResourceUtils.java +++ /dev/null @@ -1,53 +0,0 @@ -package vg.civcraft.mc.civmodcore.utilities; - -import com.google.common.base.Strings; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.function.Consumer; -import vg.civcraft.mc.civmodcore.ACivMod; - -public final class ResourceUtils { - - /** - * Iterates through the lines of a resource file. Good for CSV, TSV, LSV.. etc - * - * @param plugin The plugin to get the resource from. - * @param resource The resource path. - * @param parser The line parser. - * @return Returns true if the resource was iterated. - */ - public static boolean iterateResourceLines(ACivMod plugin, String resource, Consumer parser) { - if (plugin == null) { - throw new IllegalArgumentException("Cannot iterate resource with a null plugin."); - } - if (Strings.isNullOrEmpty(resource)) { - throw new IllegalArgumentException("Resource path must be valid."); - } - if (parser == null) { - throw new IllegalArgumentException("Not parser was given."); - } - InputStream input = plugin.getClass().getResourceAsStream(resource); - if (input == null) { - return false; - } - BufferedReader reader = new BufferedReader(new InputStreamReader(input)); - String line = null; - while (true) { - try { - line = reader.readLine(); - } - catch (IOException error) { - plugin.warning("Could not read line.", error); - continue; - } - if (line == null) { - break; - } - parser.accept(line); - } - return true; - } - -}