allaymc-plugin-dev
Build, update, and troubleshoot AllayMC plugins in Java or other JVM languages. Use when creating a new AllayMC plugin, migrating an existing plugin to a new Allay API version, wiring commands/events/tasks/config, or setting up Gradle and plugin metadata (plugin.json or AllayGradle plugin block).
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
AllayMC Plugin Development
Overview
Create AllayMC plugins using the official Java template and the Allay API. Keep the workflow aligned with the latest Allay API and docs from the bundled references, and default to the template's Java 21 toolchain unless the user requests otherwise.
Null-safety policy
AllayMC currently does not use annotations such as JSpecify's @Nullable/@NonNull. Unless a method's Javadoc explicitly states that a parameter or return value may be null, treat it as non-null.
Workflow
1) Pick the starting point
- Prefer the official template at
references/JavaPluginTemplatefor new plugins. - If updating an existing plugin, diff its
build.gradle.ktsand plugin main class against the template.
2) Align Gradle and plugin metadata
- Update
group,description, andversioninbuild.gradle.kts. - Keep
groupaligned with the package of the plugin main class. - Keep the Java toolchain consistent with the template unless the user needs a different version.
- In the
allay {}block:- Set
apito the target Allay API version. - Set
plugin.entranceto the fully qualified main class (or short suffix as used in the template). - Update
authorsandwebsite.
- Set
- If the project does not use the AllayGradle plugin, create or update
plugin.jsonper the docs inreferences/Allay/docs/tutorials/create-your-first-plugin.md.
3) Implement the plugin entry class
- Extend
org.allaymc.api.plugin.Plugin. - Override lifecycle methods as needed:
-
onLoadfor lightweight setup. -
onEnablefor registrations and runtime wiring. -
onDisablefor cleanup.
-
- Keep the class name and
plugin.entrance/plugin.jsonentrance consistent. - If reloadable behavior is required, override
isReloadableand implementreload. - Reference the base class in
references/Allay/api/src/main/java/org/allaymc/api/plugin/Plugin.java.
4) Add core features (choose only what is needed)
- Commands: follow
references/Allay/docs/tutorials/register-commands.md. - Events: follow
references/Allay/docs/tutorials/register-event-listeners.md. - Tasks: follow
references/Allay/docs/tutorials/schedule-tasks.md. - Config: follow
references/Allay/docs/tutorials/use-config.md. - Permissions: follow
references/Allay/docs/tutorials/use-permission.md. - i18n: follow
references/Allay/docs/tutorials/use-i18n.md. - Forms/UI: follow
references/Allay/docs/tutorials/use-forms.md. - Data: follow
references/Allay/docs/tutorials/persistent-data-container.md. - Blocks/items: follow
references/Allay/docs/tutorials/block-api.mdandreferences/Allay/docs/tutorials/item-api.md.
5) Build and run
- Use
./gradlew runServerfor local testing when the AllayGradle plugin is configured. - Use
./gradlew shadowJarto build the shaded jar. - Copy the jar from
build/libs/*-shaded.jarinto the Allay serverpluginsdirectory.
6) Troubleshoot (only when asked)
- Plugin not loading: verify
plugin.entrance(orplugin.jsonentrance),api/api_version, and the jar location. - API mismatch: update the Gradle
allay.apiversion to a valid Allay API release. - Class not found: confirm the package name matches
groupand the compiled class name.
Reference map (load on demand)
- Template project:
references/JavaPluginTemplate-
build.gradle.ktsfor Gradle + AllayGradle conventions -
README.mdfor template initialization steps -
src/main/java/.../JavaPluginTemplate.javafor lifecycle structure
-
- AllayGradle:
references/AllayGradle- Gradle plugin sources and configuration patterns
- Allay source and API:
references/Allay- API entry points:
api/src/main/java/org/allaymc/api - Tutorials:
docs/tutorials/*.md
- API entry points:
Output expectations
- Keep Gradle config, plugin metadata, and main class in sync.
- Target the requested Allay API version and reflect it in Gradle metadata.
- Prefer the template conventions unless the user explicitly wants a custom structure.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-28
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!