Class PlanFiles

  • All Implemented Interfaces:
    SubSystem
    Direct Known Subclasses:
    SpongePlanFiles

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

      • PlanFiles

        @Inject
        public PlanFiles​(@Named("dataFolder")
                         java.io.File dataFolder,
                         JarResource.StreamFunction getResourceStream)
    • Method Detail

      • getDataFolder

        public java.io.File getDataFolder()
      • getDataDirectory

        public java.nio.file.Path getDataDirectory()
      • getCustomizationDirectory

        public java.nio.file.Path getCustomizationDirectory()
      • getLogsFolder

        public java.io.File getLogsFolder()
      • getLogsDirectory

        public java.nio.file.Path getLogsDirectory()
      • getConfigFile

        public java.io.File getConfigFile()
      • getLocaleFile

        public java.io.File getLocaleFile()
      • getFileFromPluginFolder

        public java.io.File getFileFromPluginFolder​(java.lang.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​(java.lang.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.
      • getResourceFromPluginFolder

        public Resource getResourceFromPluginFolder​(java.lang.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 java.util.Optional<Resource> getCustomizableResource​(java.lang.String resourceName)
      • getJSONStorageDirectory

        public java.nio.file.Path getJSONStorageDirectory()