Interface SkriptAddon

All Superinterfaces:
ViewProvider<SkriptAddon>
All Known Subinterfaces:
Skript
All Known Implementing Classes:
SkriptAddon

@Experimental public interface SkriptAddon extends ViewProvider<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 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

      <R extends Registry<?>> void storeRegistry(Class<R> registryClass, R registry)
      Stores a registry under registryClass. If a registry is already stored under registryClass, it will be replaced.
      Type Parameters:
      R - The type of registry.
      Parameters:
      registryClass - The class (key) to store registry under.
      registry - The registry to store.
    • removeRegistry

      void removeRegistry(Class<? extends Registry<?>> registryClass)
      Removes the registry stored under registryClass. It is safe to call this method even if a registry is not stored under registryClass.
      Parameters:
      registryClass - The class (key) that the registry to remove is under.
    • hasRegistry

      boolean hasRegistry(Class<? extends Registry<?>> registryClass)
      Determines whether a registry has been stored under registryClass.
      Parameters:
      registryClass - The class (key) to search for a registry under.
      Returns:
      Whether a registry is stored under registryClass.
    • registry

      <R extends Registry<?>> R registry(Class<R> registryClass)
      Obtains the registry stored under registryClass. This method will never return null, meaning it may be necessary to call hasRegistry(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

      <R extends Registry<?>> R registry(Class<R> registryClass, Supplier<R> putIfAbsent)
      Searches for a registry stored under registryClass. 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 under registryClass.
      Returns:
      The registry stored under registryClass or created from putIfAbsent.
    • syntaxRegistry

      SyntaxRegistry syntaxRegistry()
      Returns:
      A syntax registry for this addon's syntax.
    • localizer

      Localizer localizer()
      Returns:
      A localizer for this addon's localizations.
    • loadModules

      default void loadModules(AddonModule... modules)
      A helper method for loading addon modules. Modules will be loaded as described by AddonModule.
      Parameters:
      modules - The modules to load.
    • unmodifiableView

      @Contract("-> new") default SkriptAddon unmodifiableView()
      Constructs an unmodifiable view of this addon. That is, the returned addon will return unmodifiable views of its syntaxRegistry() and localizer().
      Specified by:
      unmodifiableView in interface ViewProvider<SkriptAddon>
      Returns:
      An unmodifiable view of this addon.
      See Also: