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
Abstracts File methods of Plugin classes so that they can be tested without Mocks.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPlanFiles
(File dataFolder, JarResource.StreamFunction getResourceStream, dagger.Lazy<AssetVersions> assetVersions) -
Method Summary
Modifier and TypeMethodDescriptionattemptToFind
(Path dir, String resourceName) void
disable()
Performs disable actions for the subsystemvoid
enable()
Performs enable actions for the subsystem.protected @NotNull Long
getLastModifiedForJarResource
(String resourceName) getResourceFromJar
(String resourceName) Get a file in the jar as aResource
.getResourceFromPluginFolder
(String resourceName) Get a file from plugin folder as aResource
.
-
Field Details
-
getResourceStream
-
-
Constructor Details
-
PlanFiles
@Inject public PlanFiles(@Named("dataFolder") File dataFolder, JarResource.StreamFunction getResourceStream, dagger.Lazy<AssetVersions> assetVersions)
-
-
Method Details
-
getDataFolder
-
getDataDirectory
-
getLogsFolder
-
getLogsDirectory
-
getConfigFile
-
getLocaleFile
-
getFileFromPluginFolder
-
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
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.
-
getLastModifiedForJarResource
-
getResourceFromPluginFolder
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.
-
attemptToFind
-
getJSONStorageDirectory
-