Class SkriptAddon

java.lang.Object
ch.njol.skript.SkriptAddon
All Implemented Interfaces:
SkriptAddon, ViewProvider<SkriptAddon>

@Deprecated(since="2.14", forRemoval=true) public final class SkriptAddon extends Object implements SkriptAddon
Deprecated, for removal: This API element is subject to removal in a future version.
Use SkriptAddon instead. Register using Skript.registerAddon(Class, String). Obtain a Skript instance with Skript.instance().
Utility class for Skript addons. Use Skript.registerAddon(JavaPlugin) to create a SkriptAddon instance for your plugin.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final org.bukkit.plugin.java.JavaPlugin
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    final Version
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable File
    Deprecated, for removal: This API element is subject to removal in a future version.
    The first invocation of this method uses reflection to invoke the protected method JavaPlugin.getFile() to get the plugin's jar file.
    @Nullable String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    hasRegistry(Class<? extends Registry<?>> registryClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Determines whether a registry has been stored under registryClass.
    loadClasses(String basePackage, String... subPackages)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Loads classes of the plugin by package.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <R extends Registry<?>>
    R
    registry(Class<R> registryClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Obtains the registry stored under registryClass.
    <R extends Registry<?>>
    R
    registry(Class<R> registryClass, Supplier<R> putIfAbsent)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Searches for a registry stored under registryClass.
    void
    removeRegistry(Class<? extends Registry<?>> registryClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Removes the registry stored under registryClass.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Makes Skript load language files from the specified directory, e.g.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <R extends Registry<?>>
    void
    storeRegistry(Class<R> registryClass, R registry)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Stores a registry under registryClass.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.skriptlang.skript.addon.SkriptAddon

    loadModules, unmodifiableView
  • Field Details

    • plugin

      public final org.bukkit.plugin.java.JavaPlugin plugin
      Deprecated, for removal: This API element is subject to removal in a future version.
    • version

      public final Version version
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • toString

      public final String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object
    • getName

      public String getName()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • loadClasses

      public SkriptAddon loadClasses(String basePackage, String... subPackages) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Loads classes of the plugin by package. Useful for registering many syntax elements like Skript does it.
      Parameters:
      basePackage - The base package to add to all sub packages, e.g. "ch.njol.skript".
      subPackages - Which subpackages of the base package should be loaded, e.g. "expressions", "conditions", "effects". Subpackages of these packages will be loaded as well. Use an empty array to load all subpackages of the base package.
      Returns:
      This SkriptAddon
      Throws:
      IOException - If some error occurred attempting to read the plugin's jar file.
    • setLanguageFileDirectory

      public SkriptAddon setLanguageFileDirectory(String directory)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Makes Skript load language files from the specified directory, e.g. "lang" or "skript lang" if you have a lang folder yourself. Localised files will be read from the plugin's jar and the plugin's data folder, but the default English file is only taken from the jar and must exist!
      Parameters:
      directory - Directory name
      Returns:
      This SkriptAddon
    • getLanguageFileDirectory

      @Nullable public @Nullable String getLanguageFileDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getFile

      @Nullable public @Nullable File getFile()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The first invocation of this method uses reflection to invoke the protected method JavaPlugin.getFile() to get the plugin's jar file. The file is then cached and returned upon subsequent calls to this method to reduce usage of reflection. Only nullable if there was an exception thrown.
      Returns:
      The jar file of the plugin.
    • source

      public Class<?> source()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      source in interface SkriptAddon
      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

      public String name()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      name in interface SkriptAddon
      Returns:
      The name of this addon.
    • storeRegistry

      public <R extends Registry<?>> void storeRegistry(Class<R> registryClass, R registry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SkriptAddon
      Stores a registry under registryClass. If a registry is already stored under registryClass, it will be replaced.
      Specified by:
      storeRegistry in interface SkriptAddon
      Type Parameters:
      R - The type of registry.
      Parameters:
      registryClass - The class (key) to store registry under.
      registry - The registry to store.
    • removeRegistry

      public void removeRegistry(Class<? extends Registry<?>> registryClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SkriptAddon
      Removes the registry stored under registryClass. It is safe to call this method even if a registry is not stored under registryClass.
      Specified by:
      removeRegistry in interface SkriptAddon
      Parameters:
      registryClass - The class (key) that the registry to remove is under.
    • hasRegistry

      public boolean hasRegistry(Class<? extends Registry<?>> registryClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SkriptAddon
      Determines whether a registry has been stored under registryClass.
      Specified by:
      hasRegistry in interface SkriptAddon
      Parameters:
      registryClass - The class (key) to search for a registry under.
      Returns:
      Whether a registry is stored under registryClass.
    • registry

      public <R extends Registry<?>> R registry(Class<R> registryClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SkriptAddon
      Obtains the registry stored under registryClass. This method will never return null, meaning it may be necessary to call SkriptAddon.hasRegistry(Class) if you are not sure whether the registry you need exists.
      Specified by:
      registry in interface SkriptAddon
      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

      public <R extends Registry<?>> R registry(Class<R> registryClass, Supplier<R> putIfAbsent)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SkriptAddon
      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.
      Specified by:
      registry in interface SkriptAddon
      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

      public SyntaxRegistry syntaxRegistry()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      syntaxRegistry in interface SkriptAddon
      Returns:
      A syntax registry for this addon's syntax.
    • localizer

      public Localizer localizer()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      localizer in interface SkriptAddon
      Returns:
      A localizer for this addon's localizations.