Class ItemPredicateLoader

java.lang.Object
com.github.darksoulq.abyssallib.world.item.ItemPredicateLoader

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

    • ItemPredicateLoader

      public ItemPredicateLoader()
  • 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 ItemPredicate load(Path path)
      Reads a YAML file from the file system and decodes it into an ItemPredicate instance.
      Parameters:
      path - The Path to the YAML file to read.
      Returns:
      The parsed ItemPredicate, or null if parsing fails.
    • loadResource

      public static ItemPredicate 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 ItemPredicate, or null if the resource is missing or parsing fails.