PaperActions
PaperActions 是一个轻量级的 Paper API,允许插件在不直接相互依赖的情况下暴露和执行操作。
插件无需检查其他插件是否已安装并调用其 API,只需注册命名操作即可,其他插件均可调用这些操作。
功能特性
- 基于注解的操作注册
- 跨插件通信
- 命名参数
- 可选参数
- 自动类型验证
- 轻量级,无需配置
- 专为插件互操作性设计
工作原理
插件在启动期间注册操作。其他插件可以使用操作的唯一标识符来执行这些操作。
每个操作由以下标识符定义:
PluginName:ActionName
这使得插件能够在不产生硬依赖的情况下轻松进行通信。
示例用例
- NPC 交互系统
- 自定义事件回调
- 小游戏集成
- 跨插件兼容性
- 占位符或命令回调
- 通用插件 API
要求
为什么选择 PaperActions?
PaperActions 为插件提供了一种简单、标准化的通信方式。插件无需暴露庞大的 API 或依赖于实现细节,而是可以提供小巧、可重用的操作,便于发现和执行。
最终结果是更清晰的集成、更少的硬依赖以及更加模块化的插件生态系统。
PaperActions
PaperActions is a lightweight API for Paper that allows plugins to expose and execute actions without depending directly on each other.
Instead of checking whether another plugin is installed and calling its API, plugins can simply register named actions that any other plugin can invoke.
Features
- Annotation-based action registration
- Cross-plugin communication
- Named parameters
- Optional parameters
- Automatic type validation
- Lightweight with no configuration
- Designed for plugin interoperability
How it works
Plugins register actions during startup. Other plugins can execute those actions using the action's unique identifier.
Every action is identified by:
PluginName:ActionName
This makes it easy for plugins to communicate without creating hard dependencies.
Example Use Cases
- NPC interaction systems
- Custom event callbacks
- Minigame integrations
- Cross-plugin compatibility
- Placeholder or command callbacks
- Generic plugin APIs
Requirements
Why PaperActions?
PaperActions provides a simple, standardized way for plugins to communicate. Rather than exposing large APIs or depending on implementation details, plugins can offer small, reusable actions that are easy to discover and execute.
The result is cleaner integrations, fewer hard dependencies, and a more modular plugin ecosystem.
评论 0
登录后参与评分
还没有评论,来抢沙发吧