Class PlanFiles

java.lang.Object
com.djrapitops.plan.storage.file.PlanFiles
All Implemented Interfaces:
SubSystem
Direct Known Subclasses:
SpongePlanFiles

@Singleton public class PlanFiles extends Object implements SubSystem
Abstracts File methods of Plugin classes so that they can be tested without Mocks.
  • Field Details

  • Constructor Details

  • Method Details

    • getDataFolder

      public File getDataFolder()
    • getDataDirectory

      public Path getDataDirectory()
    • getLogsFolder

      public File getLogsFolder()
    • getLogsDirectory

      public Path getLogsDirectory()
    • getConfigFile

      public File getConfigFile()
    • getLocaleFile

      public File getLocaleFile()
    • getFileFromPluginFolder

      public File getFileFromPluginFolder(String name)
    • enable

      public void enable()
      Description copied from interface: SubSystem
      Performs enable actions for the subsystem.
      Specified by:
      enable in interface SubSystem
    • disable

      public void disable()
      Description copied from interface: SubSystem
      Performs disable actions for the subsystem
      Specified by:
      disable in interface SubSystem
    • getResourceFromJar

      public Resource getResourceFromJar(String resourceName)
      Get a file in the jar as a Resource.
      Parameters:
      resourceName - Path to the file inside jar/assets/plan/ folder.
      Returns:
      a Resource for accessing the resource.
    • getLastModifiedForJarResource

      @NotNull protected @NotNull Long getLastModifiedForJarResource(String resourceName)
    • getResourceFromPluginFolder

      public Resource getResourceFromPluginFolder(String resourceName)
      Get a file from plugin folder as a Resource.
      Parameters:
      resourceName - Path to the file inside the plugin folder.
      Returns:
      a Resource for accessing the resource.
    • getCustomizableResource

      public Optional<Resource> getCustomizableResource(String resourceName)
    • attemptToFind

      public Optional<File> attemptToFind(String resourceName)
    • getJSONStorageDirectory

      public Path getJSONStorageDirectory()