Package com.djrapitops.plan.storage.file
Class PlanFiles
- java.lang.Object
-
- com.djrapitops.plan.storage.file.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected JarResource.StreamFunction
getResourceStream
-
Constructor Summary
Constructors Constructor Description PlanFiles(java.io.File dataFolder, JarResource.StreamFunction getResourceStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disable()
Performs disable actions for the subsystemvoid
enable()
Performs enable actions for the subsystem.java.io.File
getConfigFile()
java.util.Optional<Resource>
getCustomizableResource(java.lang.String resourceName)
java.nio.file.Path
getCustomizationDirectory()
java.nio.file.Path
getDataDirectory()
java.io.File
getDataFolder()
java.io.File
getFileFromPluginFolder(java.lang.String name)
java.nio.file.Path
getJSONStorageDirectory()
java.io.File
getLocaleFile()
java.nio.file.Path
getLogsDirectory()
java.io.File
getLogsFolder()
Resource
getResourceFromJar(java.lang.String resourceName)
Get a file in the jar as aResource
.Resource
getResourceFromPluginFolder(java.lang.String resourceName)
Get a file from plugin folder as aResource
.
-
-
-
Field Detail
-
getResourceStream
protected final JarResource.StreamFunction getResourceStream
-
-
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.
-
disable
public void disable()
Description copied from interface:SubSystem
Performs disable actions for the subsystem
-
getResourceFromJar
public Resource getResourceFromJar(java.lang.String resourceName)
Get a file in the jar as aResource
.- 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 aResource
.- 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()
-
-