diff --git a/commons/src/main/java/me/filoghost/commons/config/ConfigErrors.java b/commons/src/main/java/me/filoghost/commons/config/ConfigErrors.java index 2e425c9..aa65f2c 100644 --- a/commons/src/main/java/me/filoghost/commons/config/ConfigErrors.java +++ b/commons/src/main/java/me/filoghost/commons/config/ConfigErrors.java @@ -49,7 +49,7 @@ public class ConfigErrors { return "value of type \"" + value.getClass() + "\" couldn't be converted by \"" + converter.getClass() + "\""; } - private static String formatPath(Path rootDataFolder, Path path) { + public static String formatPath(Path rootDataFolder, Path path) { if (path.startsWith(rootDataFolder)) { // Remove root data folder prefix return path.subpath(rootDataFolder.getNameCount(), path.getNameCount()).toString(); diff --git a/plugin/src/main/java/me/filoghost/chestcommands/logging/Errors.java b/plugin/src/main/java/me/filoghost/chestcommands/logging/Errors.java index 0d2ff88..05b9f03 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/logging/Errors.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/logging/Errors.java @@ -8,6 +8,7 @@ package me.filoghost.chestcommands.logging; import me.filoghost.chestcommands.ChestCommands; import me.filoghost.chestcommands.parsing.icon.AttributeType; import me.filoghost.chestcommands.parsing.icon.IconSettings; +import me.filoghost.commons.config.ConfigErrors; import org.bukkit.ChatColor; import java.nio.file.Path; @@ -213,12 +214,7 @@ public class Errors { } private static String formatPath(Path path) { - if (path.startsWith(ChestCommands.getDataFolderPath())) { - // Remove "/plugins/ChestCommands" prefix - return path.subpath(ChestCommands.getDataFolderPath().getNameCount(), path.getNameCount()).toString(); - } else { - return path.toString(); - } + return ConfigErrors.formatPath(ChestCommands.getDataFolderPath(), path); } }