Class SkriptAddon

java.lang.Object
ch.njol.skript.SkriptAddon

public final class SkriptAddon extends Object
Utility class for Skript addons. Use Skript.registerAddon(JavaPlugin) to create a SkriptAddon instance for your plugin.
  • Field Details

    • plugin

      public final org.bukkit.plugin.java.JavaPlugin plugin
    • version

      public final Version version
  • Method Details

    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
    • loadClasses

      public SkriptAddon loadClasses(String basePackage, String... subPackages) throws IOException
      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)
      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

      public @Nullable String getLanguageFileDirectory()
    • getFile

      public @Nullable File getFile()
      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.