public abstract class Plugin extends Object
PluginType to this class.| 限定符 | 构造器和说明 |
|---|---|
protected |
Plugin()
Provide a constructor to help
PluginType design. |
|
Plugin(String name,
String author,
Version version)
Initialize a Plugin instance by its name.
|
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
disable()
Used to save some data of the plugin
|
abstract void |
enable()
Used to initialize the plugin
|
boolean |
equals(Object o) |
String |
getAuthor() |
@NotNull YamlConfiguration |
getConfig() |
@NotNull File |
getConfigFile() |
DefaultConfig |
getDefaultConfig() |
@NotNull File |
getDefaultFolder() |
LangConfig |
getLangConfig() |
@NotNull String |
getName() |
static Plugin |
getPlugin(Class<? extends Plugin> plugin)
Get Plugin instance by the class instance
|
static Plugin |
getPlugin(String name)
Get Plugin instance by the name
|
PluginDescription |
getPluginDescription() |
Version |
getVersion() |
int |
hashCode() |
InputStream |
loadResource(String path) |
void |
registerBuffer(DataConverter<?> dataConverter,
DataCollection.BufferGetter bufferGetter)
Register the getter of the buffer
|
void |
registerCommand(Command command)
Register the command
|
void |
registerListener(Listener listener)
Register the listener into the Event chain
|
static @Nullable Plugin |
thisPlugin() |
public Plugin(String name, String author, Version version)
name - the plugin nameauthor - the plugin authorversion - the plugin versionPluginLoaderException - if the classloader of the plugin is not PluginClassLoaderprotected Plugin()
PluginType design.
Never instance it! It will be instanced when bot bootstraps automatically.public static Plugin getPlugin(Class<? extends Plugin> plugin)
plugin - the class instance of the pluginPluginClassLoader.getPlugin(Class)public static Plugin getPlugin(String name)
name - the name of the pluginPluginClassLoader.getPlugin(String)@Nullable public static @Nullable Plugin thisPlugin()
@NotNull public @NotNull String getName()
public abstract void enable()
public abstract void disable()
@NotNull public @NotNull File getDefaultFolder()
@NotNull public @NotNull File getConfigFile()
@NotNull public @NotNull YamlConfiguration getConfig()
public void registerListener(Listener listener)
listener - the listener need to be registeredpublic void registerCommand(Command command)
command - the command need to be registeredpublic void registerBuffer(DataConverter<?> dataConverter, DataCollection.BufferGetter bufferGetter)
dataConverter - the buffer data converterbufferGetter - the getter of the bufferpublic String getAuthor()
public Version getVersion()
public LangConfig getLangConfig()
public DefaultConfig getDefaultConfig()
public PluginDescription getPluginDescription()
public InputStream loadResource(String path)
Copyright © 2022. All rights reserved.