public interface Plugin extends TabExecutor
这只是一个接口,若要实际上实现该接口,建议使用 PluginBase
.
原文:Represents a Plugin.
The use of PluginBase
is recommended for actual Implementation
限定符和类型 | 方法和说明 |
---|---|
FileConfiguration |
getConfig()
获取这个插件的
FileConfiguration 实例, 它将读取config.yml中的内容. |
java.io.File |
getDataFolder()
返回插件的数据文件夹, 该文件夹可能尚未创建.
|
ChunkGenerator |
getDefaultWorldGenerator(java.lang.String worldName,
java.lang.String id)
获取在服务器配置中指定的默认世界中使用的
ChunkGenerator . |
PluginDescriptionFile |
getDescription()
返回包含该插件详细信息的 plugin.yaml 文件.
|
java.util.logging.Logger |
getLogger()
返回与此服务器日志记录器关联的插件日志记录器.返回的日志记录器自动地用插件的名称标记所有日志消息.
|
java.lang.String |
getName()
返回插件的名称.
|
PluginLoader |
getPluginLoader()
获取对此插件负责的关联PluginLoader.
|
java.io.InputStream |
getResource(java.lang.String filename)
获取此插件包中的资源.
|
Server |
getServer()
返回当前运行此插件的服务器实例.
|
boolean |
isEnabled()
返回一个布尔值,表示该插件此时是否已经启动.
|
boolean |
isNaggable()
使用一个简单的布尔值表达 我们是否可以把一些东西记录到日志文件.
|
void |
onDisable()
当这个插件被关闭时调用.
|
void |
onEnable()
启用此插件时调用.
|
void |
onLoad()
在一个插件被加载之后启动之前调用.
|
void |
reloadConfig()
丢弃
getConfig() 中所有数据并且从磁盘重载. |
void |
saveConfig()
保存插件的
FileConfiguration , 这可以使用getConfig() 获取. |
void |
saveDefaultConfig()
将默认的config.yml文件数据保存到
getConfig() 获取的config.yml所在的位置. |
void |
saveResource(java.lang.String resourcePath,
boolean replace)
保存内置于插件的.jar文件的某个资源的原始内容(假使该资源可以使用
getResource(String) 找到). |
void |
setNaggable(boolean canNag)
设置 Naggable 状态
原文: Set naggable state
|
onTabComplete
onCommand
java.io.File getDataFolder()
原文:Returns the folder that the plugin data's files are located in. The folder may not yet exist.
PluginDescriptionFile getDescription()
原文:Returns the plugin.yaml file containing the details for this plugin
FileConfiguration getConfig()
FileConfiguration
实例, 它将读取config.yml中的内容.
如果这个插件中含有config.yml文件, 那么这个config.yml将作为默认的配置文件.
原文:Gets a FileConfiguration
for this plugin, read through
"config.yml"
If there is a default config.yml embedded in this plugin, it will be
provided as a default for this Configuration.
java.io.InputStream getResource(java.lang.String filename)
原文: Gets an embedded resource in this plugin
filename
- 资源文件名void saveConfig()
FileConfiguration
, 这可以使用getConfig()
获取.
原文: Saves the FileConfiguration
retrievable by getConfig()
.
void saveDefaultConfig()
getConfig()
获取的config.yml所在的位置.
原文:Saves the raw contents of the default config.yml file to the location
retrievable by getConfig()
.
This should fail silently if the config.yml already exists.
void saveResource(java.lang.String resourcePath, boolean replace)
getResource(String)
找到).
原文:Saves the raw contents of any resource embedded with a plugin's .jar file
assuming it can be found using getResource(String)
.
The resource is saved into the plugin's data folder using the same hierarchy
as the .jar file (subdirectories are preserved).
resourcePath
- 在插件的.jar文件中查找的内置资源路径.(没有前面的斜杠)replace
- 如果为true,则内置的资源将覆盖现有文件的内容java.lang.IllegalArgumentException
- 如果资源路径为null/空,或指向不存在的资源则抛出void reloadConfig()
getConfig()
中所有数据并且从磁盘重载.
原文:Discards any data in getConfig()
and reloads from disk.
PluginLoader getPluginLoader()
原文:Gets the associated PluginLoader responsible for this plugin
Server getServer()
原文:Returns the Server instance currently running this plugin
boolean isEnabled()
原文:Returns a value indicating whether or not this plugin is currently enabled
void onDisable()
原文:Called when this plugin is disabled
void onLoad()
原文:Called after a plugin is loaded but before it has been enabled.
When multiple plugins are loaded, the onLoad() for all plugins is
called before any onEnable() is called.
void onEnable()
原文:Called when this plugin is enabled
boolean isNaggable()
原文:Simple boolean if we can still nag to the logs about things
void setNaggable(boolean canNag)
原文: Set naggable state
canNag
- 这个插件是可以被记录的吗ChunkGenerator getDefaultWorldGenerator(java.lang.String worldName, java.lang.String id)
ChunkGenerator
.
原文:Gets a ChunkGenerator
for use in a default world, as specified
in the server configuration
worldName
- 将应用于世界的名称id
- 唯一 ID,如果有的话,被指定来指示哪个生成器被调用java.util.logging.Logger getLogger()
原文: Returns the plugin logger associated with this server's logger. The returned logger automatically tags all log messages with the plugin's name.
java.lang.String getName()
原文:Returns the name of the plugin.
This should return the bare name of the plugin and should be used for
comparison.