Interface IScriptLoader
A script loader allows to define a set of scripts that should be loaded at different points in time, allowing thus for different classes or functionality to be exposed to them.
Each loader is identified by a name. It is customary, although not required, for the name to be a single all lower-cased word. A loader can also inherit classes from other loaders, allowing for inheritance chains to be created. All loaders automatically inherit from the global loader: a fake loader used to represent classes that should be available everywhere regardless of configuration.
Each script loader needs to be registered through a
ICraftTweakerPlugin before it can be used.
- Since:
- 9.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault Collection<IScriptLoader> Gets aCollectionof all loaders from which this loader inherits from.static IScriptLoaderAttempts to find a loader with the given name in the registry.Gets aCollectionof the loaders from which this loader inherits directly.name()Gets the name of the loader.
-
Method Details
-
find
Attempts to find a loader with the given name in the registry.It is not allowed to call this method before registries have been properly initialized. If such an action is performed, then the result is undefined behavior. It is also not allowed to query the global loader.
- Parameters:
name- The name of the loader to find.- Returns:
- The loader with the given name.
- Throws:
IllegalArgumentException- If no such loader was registered or if the name identifies the global loader.- Since:
- 9.1.0
-
name
String name()Gets the name of the loader.- Returns:
- The name of the loader.
- Since:
- 9.1.0
-
inheritedLoaders
Collection<IScriptLoader> inheritedLoaders()Gets aCollectionof the loaders from which this loader inherits directly.- Returns:
- All direct parents of this loader.
- Since:
- 9.1.0
-
allInheritedLoaders
Gets aCollectionof all loaders from which this loader inherits from.- Returns:
- All parents of this loader.
- Since:
- 9.1.0
-