ForestCore

我的插件的API

资源图片
# ForestCore 一个一次性添加多个功能的插件 ## 核心功能 ### 1. 更新系统 - 通过Modrinth自动检查更新 - 在控制台中显示有关可用更新的通知 - 支持连接到 ForestCore 的所有插件 ### 2. 颜色系统 - HEX颜色支持(�) - 原生颜色支持(&f) - 插件中使用便捷的`ColorUtils.colorize()` 方法 ### 3. 插件管理菜单 - 查看所有连接的插件 - 显示每个插件的信息: - 名称 - 版本 - 插件ID - 运行状态 - 能够直接从菜单编辑插件配置 ### 4. 命令系统 - `/fcore` - 关于ForestCore的基本信息 - `/fcore help` - 列出所有命令 - `/fcore help ` - 特定插件的命令 - `/fcore reload ` - 重新加载插件配置 - `/fcore menu` - 打开插件管理菜单 - `/fcore ` - 特定插件的信息 ## 安装 ### 对于服务器 1. 在构建项目后,从 `target` 文件夹下载最新的 `ForestCore-1.0-SNAPSHOT.jar` 2. 将文件放入服务器的 `plugins` 文件夹中 3. 重新启动服务器 4. ForestCore已准备就绪! ### 对于开发者 ## 将插件连接到 ForestCore ### 1. 添加依赖 在插件的 `pom.xml` 中添加: ```xml github GitHub Packages https://maven.pkg.github.com/camper_crafting/ForestCore ru.forestcore ForestCore 1.0-SNAPSHOT provided ``` ### 2. 将依赖项添加到 plugin.yml ```yaml depend: [ForestCore] ``` ### 3. 注册插件 在插件的 `onEnable()` 方法中: ```java ForestCore forestCore = (ForestCore) Bukkit.getPluginManager().getPlugin("ForestCore"); if (forestCore != null) { ForestPlugin forestPlugin = new ForestPlugin( "Plugin Name", // 插件名称 getDescription().getVersion(), // 插件版本 "plugin-id", // 唯一的插件ID "camper_crafting", // 作者名称 "https://modrinth.com/plugin/your-plugin", // Modrinth 链接 "https://github.com/your-username/your-plugin", // GitHub 链接 Arrays.asList( // 插件命令列表 "/command1 - Command Description 1", "/command2 - Command Description 2" ) ); forestCore.getPluginManager().registerPlugin("plugin-id", forestPlugin); } ``` ## 颜色使用 ### HEX 颜色 ```java String message = ColorUtils.colorize("&#FF0000Red text"); ``` ### 原生颜色 ```java String message = ColorUtils.colorize("&cRed text"); ``` ### 颜色组合 ```java String message = ColorUtils.colorize("&#FF0000Red text &aand green text"); ``` ## 插件示例 仓库中有一个名为 `ExamplePlugin` 的 `example-plugin.yml`,它演示了: - 连接到 ForestCore - 使用颜色 - 注册命令 - 与 ForestCore 菜单集成 ## 要求 - Minecraft 1.16.5 - Paper/Spigot 服务器 - Java 8 或更高版本 ## 支持 如果您有任何问题,请在 GitHub 仓库中创建一个 Issue。