Class TagLoader
java.lang.Object
com.github.darksoulq.abyssallib.world.data.tag.TagLoader
A utility class responsible for loading, parsing, and registering data tags from external files.
This loader supports deep directory scanning and can parse both JSON and YAML file formats.
Files must define a type (to resolve the TagType and its codec) and an id
(to register the instantiated Tag into the central registry). It automatically handles
appending data to existing tags and recursively resolving cross-tag inclusions, unless the
replace boolean field is set to true, which will completely override previous entries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidLoads a single tag definition from the local file system.static intloadFolder(File folder) Recursively scans a system folder and loads all JSON and YAML files found as tags.static intloadFolder(org.bukkit.plugin.Plugin plugin, String resourcePath) Deeply scans and loads tags from a specific resource path within a plugin's embedded JAR file.static voidloadResource(org.bukkit.plugin.Plugin plugin, String resourcePath) Loads a single tag definition from an internal plugin resource.static voidFinalizes the tag loading phase by binding interdependent inclusions.
-
Constructor Details
-
TagLoader
public TagLoader()
-
-
Method Details
-
loadFolder
-
loadFolder
Deeply scans and loads tags from a specific resource path within a plugin's embedded JAR file.- Parameters:
plugin- ThePlugininstance owning the resources.resourcePath- The internal path directory (e.g., "tags/").- Returns:
- The total number of tag resources successfully processed.
-
loadFile
-
loadResource
Loads a single tag definition from an internal plugin resource.- Parameters:
plugin- ThePluginholding the resource.resourcePath- The relative path to the resource file.
-
resolveIncludes
public static void resolveIncludes()Finalizes the tag loading phase by binding interdependent inclusions.Iterates through all parsed
"includes"lists to dynamically link parent and child tags. Any unresolved or mismatched types are logged as warnings.
-