ServerUtils
ServerUtils 允许你在游戏中管理你的插件。
支持在运行时从 plugins 文件夹重新加载、卸载和加载插件。
ServerUtils 还提供便捷的方法来查找命令和插件,
并提供有关它们的有用信息。
功能特性
- 兼容 Spigot/Paper、BungeeCord/Waterfall 和 Velocity!
- 替换(可禁用)
/pl 和 /plugins (bukkit) 命令为自定义消息格式的插件版本列表。添加 -v 标签将在输出中包含所有版本!请注意:命令 [plain]/bukkit:pl[/plain] 和 [plain]/bukkit:plugins[/plain] 不会被替换,因此你仍然可以使用它们!
- 一个整洁且可配置的 BungeeCord 插件命令
/bpl!使用 -v 标志输出插件的版本,使用 -m 标志在插件列表中包含模块(例如 cmd_send.jar, cmd_server.jar 等)。
- 通过
/su (load/reload/unload)plugin <plugin> 即时重载插件!(BungeeCord:主命令是 /bsu)支持 Tab 补全,以便快速从 plugins 文件夹中的 jar 包加载新插件 :)
- 监听插件文件的变化并自动重新加载它们!使用
/su watchplugin!
- 卸载未使用的命令 (spigot/paper):你可以在配置文件中定义哪些命令将由 ServerUtils 在启动时卸载。这些命令将不再对任何游戏内玩家或控制台可用。
- 重新加载插件并清理相关资源,如 PluginClassLoader 及其配方。配方清理仅适用于 1.12+ 版本,因为在低于该版本的 Minecraft 中,插件不与特定配方关联,因此 ServerUtils 无法知道某个配方属于哪个插件。
- ServerUtils 还可以自我重启/更新,作为一个小彩蛋 (:
- 无需执行整个服务器重载或重启即可即时重载 commands.yml!这对于快速创建别名非常有用。请注意:目前这仅在 1.8 - 1.16 版本上有效。
- 无需执行整个服务器重载或重启即可即时重载 bukkit 配置文件!请注意:某些配置选项可能不会被重新加载,如果你认为这是错误,请与我联系。Spigot/Paper 配置文件不会被重新加载,你可以使用
/paper reload 或 /spigot reload 来重新加载它们。请注意:目前这仅在 1.8 - 1.16 版本上有效。
- 自动更新器。插件可以配置为在服务器启动或检查更新时自动下载并安装新版本。此功能默认关闭,但可以在每个配置文件中精确配置。
插件可以监听变化!ServerUtils 提供了一个事件 API,可以精确通知插件各个组件何时被加载、启用、禁用或卸载——并且都包含 Pre(前置)和 Post(后置)阶段。请查看 Bukkit 和 Bungee 的事件!
插件的加载阶段 (Spigot/Paper):
为了理解加载 / 启用 / 禁用 / 卸载插件之间的区别,我将描述以下加载阶段:
完全加载一个插件(如启动时):
- 首先,插件从 plugins 目录中的 .jar 文件加载。这称为插件加载。此时插件在
/plugin 列表中显示为“红色”,因为它尚未启用。
- 在第二步中,插件被启用。这会导致插件在控制台中输出各种信息(开发者认为在启动时需要通知你的内容),例如设置数据库连接等。
完全禁用一个插件(如同关闭服务器)
- 首先,插件会被禁用。这会导致插件失去其所有功能,例如命令、事件监听器等。禁用后,插件仍会保留在内存中加载状态,但在
/plugin 列表中显示为“红色”。
- 随后,插件将从内存中卸载,因此它将不再出现在
/plugin 列表中。
免责声明 ‼️
请注意,重新加载可能并不兼容所有插件!依赖于被重新加载的插件的其他插件,在重新加载时很可能出现错误。清理不当或启动实践不规范也可能导致插件(重新/取消)加载失败。请谨慎操作!
统计数据
编译 ServerUtils
有两种方式可以编译 ServerUtils:
1. 安装 Gradle(推荐)
- 确保您已安装 Gradle。
- 运行
gradle build 以使用依赖项进行编译。
2. 使用 Wrapper
Windows: gradlew.bat build
Linux/macOS: ./gradlew build
开发者 API
仓库 / 依赖
如果您希望使用 ServerUtils 的快照版本,可以使用以下仓库:
https://repo.fvdh.dev/snapshots
Gradle:
repositories {
compileOnly("net.frankheijden.serverutils:ServerUtils:VERSION")
}
dependencies {
maven("https://repo.fvdh.dev/releases")
}
Maven:
<project>
<repositories>
<!-- ServerUtils repo -->
<repository>
<id>fvdh</id>
<url>https://repo.fvdh.dev/releases</url>
</repository>
</repositories>
<dependencies>
<!-- ServerUtils dependency -->
<dependency>
<groupId>net.frankheijden.serverutils</groupId>
<artifactId>ServerUtils</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
命令与权限
有关命令和权限的最新概览,请参阅 Wiki 页面。
ServerUtils
ServerUtils allows you to manage your plugins in-game.
Featuring reloading, unloading and loading of plugins from your plugins folder at runtime.
ServerUtils also has handy methods to lookup commands and plugins,
and provides you with handy information about them.
Features
- Spigot/Paper, BungeeCord/Waterfall and Velocity compatible!
- Replaces (you can disable this) the /pl and /plugins (bukkit) commands with a customisable message plugins version. Adding the -v tag will add all versions to the output! Please note: the commands [plain]/bukkit:pl[/plain] and [plain]/bukkit:plugins[/plain] are not replaced, so you can still use those!
- A neat configurable /bpl plugins command for bungeecord! Use the -v flag to output the versions of the plugin and -m flag to also include modules in the plugin list (e.g. cmd_send.jar, cmd_server.jar etc.)
- Reload plugins on the fly with /su (load/reload/unload)plugin <plugin>! (BungeeCord: the main command is /bsu) Supports tabcomplete to quickly load new plugins from a jar in your plugins folder :)
- Watch plugin files for changes and automatically reload them! /su watchplugin!
- Unloading unused commands (spigot/paper): You can define in the config commands which will be unloaded by ServerUtils at boot. These commands will not be accessible anymore to any in-game player, nor the console.
- Reloading plugins and cleaning things up, like their PluginClassLoader and their recipes, recipe cleanup only works 1.12+, as below those versions a plugin is not associated with a recipe, so there's no way ServerUtils can know a recipe belongs to a plugin.
- ServerUtils can also restart / update itself, as a gimmick (:
- Reload commands.yml on the fly without performing a whole reload or restart on the server! Useful to quickly make aliases :) Please note: currently, this only works on 1.8 - 1.16.
- Reload the bukkit configuration on the fly without performing a whole reload or restart on the server! Please note: some configuration options may not be reloaded, please contact me if you think this is an error. Spigot/Paper configs are not reloaded, you can reload those with /paper reload or /spigot reload. Please note: currently, this only works on 1.8 - 1.16.
- Automatic updater. The plugin can be configured to automatically download & install new updates of the plugin on server boot or when updates are checked. This feature is disabled by default, but can be precisely configured per config.
Plugins can listen for changes! ServerUtils offers an event API which can notify plugins precisely what component has been loaded, enabled, disabled or unloaded -- all with a Pre and Post stage. Please take a look at the Bukkit and Bungee events!
Load stages of a plugin (Spigot/Paper):
To understand the difference between loading / enabling / disabling / unloading of plugins, I will describe the load stages below:
Fully loading a plugin (like at startup):
- First, the plugin is loaded from a .jar file from the plugins directory. This is called loading of a plugin. The plugin is now "red" in the /plugin list, because it is not yet enabled.
- At the second step, a plugin is enabled. This causes the plugin to spit all sorts of things in the console (which the developer found important to notify you about at startup), like database connections being setup etc.
Fully disabling a plugin (like closing the server)
- First the plugin is disabled. This causes the plugin to lose all of it's features, like commands, event listeners, etc. After disabling, the plugin is still loaded in memory, but it is seen "red" in the /plugin list.
- Then the plugin will be unloaded from the memory, so the plugin won't appear at all anymore in the /plugin list.
Disclaimer ‼️
Please note that reloading may not be compatible with each and every plugin! Plugins which depend on a reloaded plugin, are likely to be error-prone for reloading. Improper cleanup, or improper startup practises may break plugin (re/un)loading as well. Please be careful!
Statistics
Compiling ServerUtils
There are two ways to compile ServerUtils:
1. Installing gradle (recommended)
- Make sure you have gradle installed.
- Run the project with
gradle build to compile it with dependencies.
2. Using the wrapper
Windows: gradlew.bat build
Linux/macOS: ./gradlew build
Developer API
Repository / Dependency
If you wish to use snapshot versions of ServerUtils, you can use the following repo:
https://repo.fvdh.dev/snapshots
Gradle:
repositories {
compileOnly("net.frankheijden.serverutils:ServerUtils:VERSION")
}
dependencies {
maven("https://repo.fvdh.dev/releases")
}
Maven:
<project>
<repositories>
<!-- ServerUtils repo -->
<repository>
<id>fvdh</id>
<url>https://repo.fvdh.dev/releases</url>
</repository>
</repositories>
<dependencies>
<!-- ServerUtils dependency -->
<dependency>
<groupId>net.frankheijden.serverutils</groupId>
<artifactId>ServerUtils</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Commands and Permissions
Please refer to the Wiki page for an updated overview of the commands and permissions.
评论 0
登录后参与评分
还没有评论,来抢沙发吧