Interface AddonModule
- All Known Implementing Classes:
BlockModule, BookModule, BreedingModule, BrewingModule, BukkitModule, CommonModule, DamageSourceModule, DisplayModule, EntityModule, EquippableModule, FishingModule, FurnaceModule, HierarchicalAddonModule, InputModule, InteractionModule, ItemComponentModule, ItemModule, LootTableModule, MiscModule, ParticleModule, PDCModule, PlayerModule, PotionModule, PropertiesModule, SignModule, TagModule, TextModule
public interface AddonModule
A module is a component of a
Modules have two loading phases:
The
The
For modules that are nested within other modules, use
SkriptAddon used for registering syntax and other Skript components.
Modules have two loading phases:
init(SkriptAddon) followed by load(SkriptAddon).
The
init phase should be used for loading components that are needed first or that may be used by other modules,
such as class infos (think numeric types that are used everywhere).
The
load phase should be used for loading components more specific to the module, such as syntax.
register(SkriptAddon, Registrar...) provides a helper method to register many syntax elements and handles
assigning proper origins to the registered syntax.
For modules that are nested within other modules, use
HierarchicalAddonModule. It provides automatic handling
for child modules and proper origins.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn origin to be used for something provided by one or more modules of an addon.static interfaceA method of registration via aSyntaxRegistry -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanLoad(SkriptAddon addon) Allow addons to specify whether they can load or not.default voidinit(SkriptAddon addon) Used for loading the components of this module that are needed first or by other modules (e.g.voidload(SkriptAddon addon) Used for loading the components (e.g.default SyntaxRegistrymoduleRegistry(SkriptAddon addon) Provides a syntax registry that auto-applies the origin of this module/addon.name()default Originorigin(SkriptAddon addon) static AddonModule.ModuleOriginorigin(SkriptAddon addon, AddonModule module) Constructs an origin from an addon and a single module.static AddonModule.ModuleOriginorigin(SkriptAddon addon, AddonModule... modules) Constructs an origin from an addon and module chain.default voidregister(SkriptAddon addon, AddonModule.Registrar... registrationMethods) Helper method that calls the given methods with a origin-applyingSyntaxRegistry
-
Method Details
-
origin
Constructs an origin from an addon and a single module.- Parameters:
addon- The addon providing the module.module- The module to construct this origin from.- Returns:
- An origin from the provided information.
-
origin
Constructs an origin from an addon and module chain.- Parameters:
addon- The addon providing the modules.modules- The module chain, from most specific to root.- Returns:
- An origin from the provided information.
-
canLoad
Allow addons to specify whether they can load or not. Called prior toinit(SkriptAddon)- Parameters:
addon- The addon this module belongs to.- Returns:
- Whether this module can load.
-
init
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 beforeload(SkriptAddon).- Parameters:
addon- The addon this module belongs to.- See Also:
-
load
Used for loading the components (e.g. syntax) of this module.- Parameters:
addon- The addon this module belongs to.- See Also:
-
name
String name()- Returns:
- The name of this module.
-
origin
- Returns:
- An origin representing this module.
-
moduleRegistry
Provides a syntax registry that auto-applies the origin of this module/addon.- Parameters:
addon- The addon to register with- Returns:
- An origin-applying
SyntaxRegistry.
-
register
Helper method that calls the given methods with a origin-applyingSyntaxRegistry- Parameters:
addon- The addon to register with.registrationMethods- A series of consumers to call to register syntax.
-