Package org.skriptlang.skript.addon
Interface SkriptAddon
- All Superinterfaces:
ViewProvider<SkriptAddon>
- All Known Subinterfaces:
Skript
- All Known Implementing Classes:
SkriptAddon
A Skript addon is an extension to Skript that expands its features.
Typically, an addon instance may be obtained through
Skript.registerAddon(Class, String)
.-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasRegistry
(Class<? extends Registry<?>> registryClass) Determines whether a registry has been stored underregistryClass
.default void
loadModules
(AddonModule... modules) A helper method for loading addon modules.name()
<R extends Registry<?>>
RObtains the registry stored underregistryClass
.<R extends Registry<?>>
RSearches for a registry stored underregistryClass
.void
removeRegistry
(Class<? extends Registry<?>> registryClass) Removes the registry stored underregistryClass
.Class
<?> source()
<R extends Registry<?>>
voidstoreRegistry
(Class<R> registryClass, R registry) Stores a registry underregistryClass
.default SkriptAddon
Constructs an unmodifiable view of this addon.
-
Method Details
-
source
Class<?> source()- Returns:
- A class from the application that registered this addon. Typically, this is the main class or the specific class in which registration occurred.
-
name
String name()- Returns:
- The name of this addon.
-
storeRegistry
Stores a registry underregistryClass
. If a registry is already stored underregistryClass
, it will be replaced.- Type Parameters:
R
- The type of registry.- Parameters:
registryClass
- The class (key) to storeregistry
under.registry
- The registry to store.
-
removeRegistry
Removes the registry stored underregistryClass
. It is safe to call this method even if a registry is not stored underregistryClass
.- Parameters:
registryClass
- The class (key) that the registry to remove is under.
-
hasRegistry
Determines whether a registry has been stored underregistryClass
.- Parameters:
registryClass
- The class (key) to search for a registry under.- Returns:
- Whether a registry is stored under
registryClass
.
-
registry
Obtains the registry stored underregistryClass
. This method will never return null, meaning it may be necessary to callhasRegistry(Class)
if you are not sure whether the registry you need exists.- Type Parameters:
R
- The type of registry.- Parameters:
registryClass
- The class (key) that the registry is stored under.- Returns:
- The registry stored under
registryClass
.
-
registry
Searches for a registry stored underregistryClass
. If the search fails,putIfAbsent
will be used to get, store, and return a registry of the requested type.- Type Parameters:
R
- The type of registry.- Parameters:
registryClass
- The class (key) to search for a registry under.putIfAbsent
- A supplier to use for creating an instance of the desired type of registry if one is not already stored underregistryClass
.- Returns:
- The registry stored under
registryClass
or created fromputIfAbsent
.
-
syntaxRegistry
SyntaxRegistry syntaxRegistry()- Returns:
- A syntax registry for this addon's syntax.
-
localizer
Localizer localizer()- Returns:
- A localizer for this addon's localizations.
-
loadModules
A helper method for loading addon modules. Modules will be loaded as described byAddonModule
.- Parameters:
modules
- The modules to load.
-
unmodifiableView
Constructs an unmodifiable view of this addon. That is, the returned addon will return unmodifiable views of itssyntaxRegistry()
andlocalizer()
.- Specified by:
unmodifiableView
in interfaceViewProvider<SkriptAddon>
- Returns:
- An unmodifiable view of this addon.
- See Also:
-