Class HierarchicalAddonModule

java.lang.Object
org.skriptlang.skript.addon.HierarchicalAddonModule
All Implemented Interfaces:
AddonModule
Direct Known Subclasses:
BlockModule, BookModule, BreedingModule, BrewingModule, BukkitModule, CommonModule, DamageSourceModule, DisplayModule, EntityModule, EquippableModule, FishingModule, FurnaceModule, InputModule, InteractionModule, ItemComponentModule, ItemModule, LootTableModule, MiscModule, ParticleModule, PDCModule, PlayerModule, PotionModule, PropertiesModule, SignModule, TagModule, TextModule

public abstract class HierarchicalAddonModule extends Object implements AddonModule
An AddonModule that supports parent/child hierarchies with automatic lifecycle forwarding.

Modules extending this class should:

Lifecycle methods (canLoad(org.skriptlang.skript.addon.SkriptAddon), init(org.skriptlang.skript.addon.SkriptAddon), load(org.skriptlang.skript.addon.SkriptAddon)) are automatically forwarded to children. Origin chains are built automatically from the parent hierarchy.

  • Constructor Details

    • HierarchicalAddonModule

      protected HierarchicalAddonModule()
      Constructs a module with no parent.
    • HierarchicalAddonModule

      protected HierarchicalAddonModule(@Nullable @Nullable AddonModule parentModule)
      Constructs a child module with the given parent.
      Parameters:
      parentModule - The parent module that created this child module.
  • Method Details

    • parent

      @Nullable public @Nullable AddonModule parent()
      Returns the parent module, or null if this is a root module.
      Returns:
      The parent module, or null.
    • children

      public Iterable<AddonModule> children()
      Override to provide child modules. Default returns an empty list.
      Returns:
      An iterable of child modules.
    • canLoadSelf

      protected boolean canLoadSelf(SkriptAddon addon)
      Override for module-specific canLoad logic. Default returns true.
      Parameters:
      addon - The addon this module belongs to.
      Returns:
      Whether this module can load.
    • canLoad

      public final boolean canLoad(SkriptAddon addon)
      Description copied from interface: AddonModule
      Allow addons to specify whether they can load or not. Called prior to AddonModule.init(SkriptAddon)
      Specified by:
      canLoad in interface AddonModule
      Parameters:
      addon - The addon this module belongs to.
      Returns:
      Whether this module can load.
    • initSelf

      protected void initSelf(SkriptAddon addon)
      Override for module-specific initialization.
      Parameters:
      addon - The addon this module belongs to.
    • init

      public final void init(SkriptAddon addon)
      Description copied from interface: AddonModule
      Used for loading the components of this module that are needed first or by other modules (e.g. class infos). This method will always be called before AddonModule.load(SkriptAddon).
      Specified by:
      init in interface AddonModule
      Parameters:
      addon - The addon this module belongs to.
      See Also:
    • loadSelf

      protected abstract void loadSelf(SkriptAddon addon)
      Override for module-specific loading.
      Parameters:
      addon - The addon this module belongs to.
    • load

      public final void load(SkriptAddon addon)
      Description copied from interface: AddonModule
      Used for loading the components (e.g. syntax) of this module.
      Specified by:
      load in interface AddonModule
      Parameters:
      addon - The addon this module belongs to.
      See Also:
    • origin

      public final AddonModule.ModuleOrigin origin(SkriptAddon addon)
      Specified by:
      origin in interface AddonModule
      Returns:
      An origin representing this module.