Class BlockPredicateLoader

java.lang.Object
com.github.darksoulq.abyssallib.world.block.BlockPredicateLoader

public class BlockPredicateLoader extends Object
Utility class responsible for loading and parsing data-driven BlockPredicate definitions. This loader scans the server's data folder for YAML files, deserializes them using the configured codec, and injects them into the global block predicate registry.
  • Constructor Details

    • BlockPredicateLoader

      public BlockPredicateLoader()
  • Method Details

    • loadPredicates

      public static void loadPredicates()
      Scans the predicates directory and loads all valid YAML configurations into the registry. If the base directory does not exist, it will be created automatically.
    • load

      public static BlockPredicate load(Path path)
      Reads a YAML file from the file system and decodes it into a BlockPredicate instance.
      Parameters:
      path - The Path to the YAML file to read.
      Returns:
      The parsed BlockPredicate, or null if parsing fails or the file is invalid.
    • loadResource

      public static BlockPredicate loadResource(org.bukkit.plugin.Plugin plugin, String resourcePath)
      Reads a YAML file bundled within a plugin's JAR resources and decodes it.
      Parameters:
      plugin - The Plugin instance owning the resource.
      resourcePath - The internal path to the YAML resource file.
      Returns:
      The parsed BlockPredicate, or null if the resource is missing or parsing fails.