mirror of
https://github.com/filoghost/ChestCommands.git
synced 2025-02-15 19:11:41 +01:00
Use common formatPath method
This commit is contained in:
parent
de5dd3b3ef
commit
94ab7624f7
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user