Package ch.njol.skript
Class SkriptAddon
java.lang.Object
ch.njol.skript.SkriptAddon
Utility class for Skript addons. Use
Skript.registerAddon(JavaPlugin)
to create a SkriptAddon instance for your plugin.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable File
getFile()
The first invocation of this method uses reflection to invoke the protected methodJavaPlugin.getFile()
to get the plugin's jar file.@Nullable String
getName()
loadClasses
(String basePackage, String... subPackages) Loads classes of the plugin by package.setLanguageFileDirectory
(String directory) Makes Skript load language files from the specified directory, e.g.final String
toString()
-
Field Details
-
plugin
public final org.bukkit.plugin.java.JavaPlugin plugin -
version
-
-
Method Details
-
toString
-
getName
-
loadClasses
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
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
-
getFile
The first invocation of this method uses reflection to invoke the protected methodJavaPlugin.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.
-