diff --git a/src/main/java/dev/spexx/configurationAPI/configuration/yaml/YamlConfig.java b/src/main/java/dev/spexx/configurationAPI/configuration/yaml/YamlConfig.java index 2b11d15..9153ede 100644 --- a/src/main/java/dev/spexx/configurationAPI/configuration/yaml/YamlConfig.java +++ b/src/main/java/dev/spexx/configurationAPI/configuration/yaml/YamlConfig.java @@ -4,7 +4,6 @@ import dev.spexx.configurationAPI.exceptions.ConfigFileException; import dev.spexx.configurationAPI.exceptions.ConfigParseException; import dev.spexx.configurationAPI.exceptions.ConfigPermissionException; -import dev.spexx.configurationAPI.file.PermissionChecker; import dev.spexx.configurationAPI.utils.FileChecksum; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -82,8 +81,7 @@ public YamlConfig(@NotNull File file) throws ConfigException { throw new ConfigFileException(file, "File does not exist. Did you forget to call create()?"); } - PermissionChecker checker = new PermissionChecker(file); - if (!checker.canRead()) { + if (!file.canRead()) { throw new ConfigPermissionException(file, "read"); } @@ -153,8 +151,7 @@ public void reload() */ public void save() throws ConfigFileException, ConfigPermissionException { - PermissionChecker checker = new PermissionChecker(file); - if (!checker.canWrite()) { + if (!file.canWrite()) { throw new ConfigPermissionException(file, "write"); } diff --git a/src/main/java/dev/spexx/configurationAPI/file/PermissionChecker.java b/src/main/java/dev/spexx/configurationAPI/file/PermissionChecker.java deleted file mode 100644 index ddcf5c6..0000000 --- a/src/main/java/dev/spexx/configurationAPI/file/PermissionChecker.java +++ /dev/null @@ -1,50 +0,0 @@ -package dev.spexx.configurationAPI.file; - -import org.jetbrains.annotations.NotNull; - -import java.io.File; - -/** - * Utility for checking file system permissions on a {@link File}. - * - *

Provides direct access to the file's readable, writable, and executable - * states using the standard {@link File} API.

- * - *

This is typically used for validation before performing file operations - * such as loading or saving configurations.

- * - * @param file the file to check, must not be {@code null} - * @since 1.3.0 - */ -public record PermissionChecker(@NotNull File file) { - - /** - * Returns whether the file is readable. - * - * @return {@code true} if the file can be read, otherwise {@code false} - * @since 1.3.0 - */ - public boolean canRead() { - return file.canRead(); - } - - /** - * Returns whether the file is writable. - * - * @return {@code true} if the file can be written to, otherwise {@code false} - * @since 1.3.0 - */ - public boolean canWrite() { - return file.canWrite(); - } - - /** - * Returns whether the file is executable. - * - * @return {@code true} if the file can be executed, otherwise {@code false} - * @since 1.3.0 - */ - public boolean canExecute() { - return file.canExecute(); - } -} \ No newline at end of file