public abstract class BukkitPlugin extends JavaPlugin implements IPlugin
JavaPlugin in your plugins.
A few useful methods are provided within this, though mainly registration bits and bobs.
IPlugin.startup() and IPlugin.disable() are used instead of onEnable and onDisable.
| Modifier and Type | Class and Description |
|---|---|
static interface |
BukkitPlugin.ClosedListener<T extends Event>
Stub class to be used anonymously by consumer listeners.
|
IPlugin.PluginType| Modifier | Constructor and Description |
|---|---|
|
BukkitPlugin() |
protected |
BukkitPlugin(@NotNull JavaPluginLoader loader,
@NotNull PluginDescriptionFile description,
@NotNull File dataFolder,
@NotNull File file) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
areDependenciesMet() |
static <Z extends Event> |
callEvent(Z event)
Calls a Bukkit event
|
void |
disablePlugin() |
ch.njol.skript.SkriptAddon |
getAddon() |
String |
getAPIVersion() |
String |
getConfigPath() |
String |
getCraftVersion() |
String |
getFullName() |
static BukkitPlugin |
getInstance() |
static FixedMetadataValue |
getMetaValue(Object object)
Returns a metadata value for the object attached to your plugin.
|
static NamespacedKey |
getNamespacedKey(String string)
Generates a
NamespacedKey for your plugin |
String |
getPluginDescription() |
String |
getPrefix() |
String |
getVersion() |
static boolean |
isPaper() |
protected boolean |
isRegistered(CompleteCommand command) |
protected boolean |
isRegistered(String command) |
void |
onDisable()
This is called on disable.
|
void |
onEnable()
This is called on enable.
|
protected void |
register(CompleteCommand... commands)
This registers your
CompleteCommands. |
protected void |
register(CompleteRecipe... recipes)
This registers your complete recipes.
|
protected void |
register(Listener... listeners)
This registers your listeners.
|
protected Listener[] |
register(Listener<?>... listeners)
Used to register Mask Listeners, which are based on functional interfaces.
|
protected Listener |
register(Listener<?> listener) |
protected Listener |
register(Listener<?> listener,
long lifetime) |
protected Listener[] |
register(long lifetime,
Listener<?>... listeners)
Used to register Mask Listeners, which are based on functional interfaces.
|
protected void |
register(MenuGUI... guis)
This registers your menu templates.
|
protected void |
register(WrappedCommand... commands)
This registers multiple
WrappedCommands at once. |
protected void |
registerCommands()
This is called during enable.
|
protected void |
registerEvents()
This is called during enable.
|
protected void |
registerListeners()
This is called during enable.
|
protected void |
registerManagers()
This is called during enable.
|
protected void |
registerProtocol()
This is called during enable.
|
protected void |
registerRecipes()
This is called during enable.
|
protected void |
registerSyntax()
This is called during enable.
|
void |
resetConfig()
Stub
|
protected void |
setInstance(BukkitPlugin plugin) |
getClassLoader, getCommand, getConfig, getDataFolder, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onLoad, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toStringequals, getName, hashCodeclone, finalize, getClass, notify, notifyAll, wait, wait, waitdisable, getName, getPluginType, getResource, isBukkit, isBungee, startupgetSLF4JLoggerpublic BukkitPlugin()
protected BukkitPlugin(@NotNull
@NotNull JavaPluginLoader loader,
@NotNull
@NotNull PluginDescriptionFile description,
@NotNull
@NotNull File dataFolder,
@NotNull
@NotNull File file)
public static BukkitPlugin getInstance()
protected void setInstance(@Nullable BukkitPlugin plugin)
public static <Z extends Event> void callEvent(Z event)
Z - The typeevent - The eventpublic static FixedMetadataValue getMetaValue(Object object)
object - The objectpublic static NamespacedKey getNamespacedKey(String string)
NamespacedKey for your pluginstring - The keypublic static boolean isPaper()
public String getVersion()
public String getAPIVersion()
public String getPluginDescription()
public String getFullName()
public String getPrefix()
public boolean areDependenciesMet()
public String getCraftVersion()
public void disablePlugin()
public void onEnable()
It performs some internal operations, then calls the IPlugin.startup() method.
onEnable in interface PluginonEnable in class JavaPluginpublic void onDisable()
It performs some internal operations, then calls the IPlugin.disable() method.
onDisable in interface PluginonDisable in class JavaPluginpublic ch.njol.skript.SkriptAddon getAddon()
public String getConfigPath()
getConfigPath in interface IPluginpublic void resetConfig()
protected void register(WrappedCommand... commands)
WrappedCommands at once.
Wrapped commands are able to be configured entirely in their own class, and do not need to be added to your plugin.yml file.
They are registered to Bukkit's command map as regular plugin commands.
commands - Your wrapped commandsprotected boolean isRegistered(CompleteCommand command)
protected boolean isRegistered(String command)
protected void register(CompleteCommand... commands)
CompleteCommands.
You might find the register(WrappedCommand...) method more palatable.commands - Commandsprotected void register(MenuGUI... guis)
register(org.bukkit.event.Listener...).guis - Menusprotected void register(Listener... listeners)
listeners - Listenersprotected void register(CompleteRecipe... recipes)
recipes - Recipesprotected Listener[] register(Listener<?>... listeners)
listeners - Register fast, functional, consumer-based listeners.protected Listener[] register(long lifetime, Listener<?>... listeners)
listeners - Register fast, functional, consumer-based listeners.lifetime - The lifetime of the listener in ticks, until it is unregistered.protected void registerRecipes()
protected void registerListeners()
protected void registerCommands()
protected void registerManagers()
protected void registerProtocol()
protected void registerSyntax()
protected void registerEvents()
Copyright © 2020. All rights reserved.