Class FileUtils

java.lang.Object
org.mvplugins.multiverse.core.utils.FileUtils

@Service public final class FileUtils extends Object
File-utilities.
  • Method Details

    • getServerFolder

      public File getServerFolder()
      The root server folder where Multiverse-Core is installed.
      Returns:
      The root server folder
    • getBukkitConfig

      @Nullable public @Nullable File getBukkitConfig()
      The bukkit.yml file
      Returns:
      The bukkit.yml file if exist, else null.
    • getServerProperties

      @Nullable public @Nullable File getServerProperties()
      The server.properties file
      Returns:
      The server.properties file if exist, else null.
    • deleteFolder

      public io.vavr.control.Try<Void> deleteFolder(File file)
      Deletes the given folder completely.
      Parameters:
      file - The folder to delete.
      Returns:
      A Try that will contain null if the folder was deleted successfully, or an exception if the folder could not be deleted.
    • deleteFolder

      public io.vavr.control.Try<Void> deleteFolder(File file, Collection<String> keepFiles)
    • deleteFolder

      public io.vavr.control.Try<Void> deleteFolder(Path path, Collection<String> keepFiles)
      Deletes the given folder completely.
      Parameters:
      path - The folder to delete.
      Returns:
      A Try that will contain null if the folder was deleted successfully, or an exception if the folder could not be deleted.
    • copyFolder

      public io.vavr.control.Try<Void> copyFolder(File sourceDir, File targetDir)
      Copies all the content of the given folder to the given target folder.
      Parameters:
      sourceDir - The folder to copy.
      targetDir - The target folder to copy to.
      Returns:
      A Try that will contain null if the folder was copied successfully, or an exception if the folder could not be copied.
    • copyFolder

      public io.vavr.control.Try<Void> copyFolder(File sourceDir, File targetDir, List<String> excludeFiles)
      Copies most of the content of the given folder to the given target folder, except the list of excluded files specified.
      Parameters:
      sourceDir - The folder to copy.
      targetDir - The target folder to copy to.
      excludeFiles - The list of files to exclude from copying.
      Returns:
      A Try that will contain null if the folder was copied successfully, or an exception if
    • copyFolder

      public io.vavr.control.Try<Void> copyFolder(Path sourceDir, Path targetDir)
      Copies all the content of the given folder to the given target folder.
      Parameters:
      sourceDir - The folder to copy.
      targetDir - The target folder to copy to.
      Returns:
      A Try that will contain null if the folder was copied successfully, or an exception if the folder could not be copied.
    • copyFolder

      public io.vavr.control.Try<Void> copyFolder(Path sourceDir, Path targetDir, List<String> excludeFiles)
      Copies most of the content of the given folder to the given target folder, except the list of excluded files specified.
      Parameters:
      sourceDir - The folder to copy.
      targetDir - The target folder to copy to.
      excludeFiles - The list of files to exclude from copying.
      Returns:
      A Try that will contain null if the folder was copied successfully, or an exception if