Skip to content

Commit 220e5ac

Browse files
author
jiang
committed
feat: add minecraft-plugin-development skill
1 parent 63d08d5 commit 220e5ac

File tree

7 files changed

+754
-0
lines changed

7 files changed

+754
-0
lines changed

docs/README.skills.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
209209
| [microsoft-docs](../skills/microsoft-docs/SKILL.md) | Query official Microsoft documentation to find concepts, tutorials, and code examples across Azure, .NET, Agent Framework, Aspire, VS Code, GitHub, and more. Uses Microsoft Learn MCP as the default, with Context7 and Aspire MCP for content that lives outside learn.microsoft.com. | None |
210210
| [microsoft-skill-creator](../skills/microsoft-skill-creator/SKILL.md) | Create agent skills for Microsoft technologies using Learn MCP tools. Use when users want to create a skill that teaches agents about any Microsoft technology, library, framework, or service (Azure, .NET, M365, VS Code, Bicep, etc.). Investigates topics deeply, then generates a hybrid skill storing essential knowledge locally while enabling dynamic deeper investigation. | `references/skill-templates.md` |
211211
| [migrating-oracle-to-postgres-stored-procedures](../skills/migrating-oracle-to-postgres-stored-procedures/SKILL.md) | Migrates Oracle PL/SQL stored procedures to PostgreSQL PL/pgSQL. Translates Oracle-specific syntax, preserves method signatures and type-anchored parameters, leverages orafce where appropriate, and applies COLLATE "C" for Oracle-compatible text sorting. Use when converting Oracle stored procedures or functions to PostgreSQL equivalents during a database migration. | None |
212+
| [minecraft-plugin-development](../skills/minecraft-plugin-development/SKILL.md) | Use this skill when building or modifying Minecraft server plugins for Paper, Spigot, or Bukkit, including plugin.yml setup, commands, listeners, schedulers, player state, team or arena systems, configuration files, Adventure text, and version-safe API usage. Trigger for requests like "build a Minecraft plugin", "add a Paper command", "fix a Bukkit listener", "create plugin.yml", "implement a minigame mechanic", or "debug server plugin behavior". | `references/bootstrap-registration.md`<br />`references/config-data-and-async.md`<br />`references/maps-heroes-and-feature-modules.md`<br />`references/project-patterns.md`<br />`references/state-sessions-and-phases.md` |
212213
| [mkdocs-translations](../skills/mkdocs-translations/SKILL.md) | Generate a language translation for a mkdocs documentation stack. | None |
213214
| [model-recommendation](../skills/model-recommendation/SKILL.md) | Analyze chatmode or prompt files and recommend optimal AI models based on task complexity, required capabilities, and cost-efficiency | None |
214215
| [msstore-cli](../skills/msstore-cli/SKILL.md) | Microsoft Store Developer CLI (msstore) for publishing Windows applications to the Microsoft Store. Use when asked to configure Store credentials, list Store apps, check submission status, publish submissions, manage package flights, set up CI/CD for Store publishing, or integrate with Partner Center. Supports Windows App SDK/WinUI, UWP, .NET MAUI, Flutter, Electron, React Native, and PWA applications. | None |
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
---
2+
name: minecraft-plugin-development
3+
description: 'Use this skill when building or modifying Minecraft server plugins for Paper, Spigot, or Bukkit, including plugin.yml setup, commands, listeners, schedulers, player state, team or arena systems, configuration files, Adventure text, and version-safe API usage. Trigger for requests like "build a Minecraft plugin", "add a Paper command", "fix a Bukkit listener", "create plugin.yml", "implement a minigame mechanic", or "debug server plugin behavior".'
4+
---
5+
6+
# Minecraft Plugin Development
7+
8+
Use this skill for Minecraft server plugin work in the Paper, Spigot, and Bukkit ecosystem.
9+
10+
This skill is especially useful for gameplay-heavy plugins such as combat systems, wave or boss encounters, war or team modes, arenas, kit systems, cooldown-based abilities, scoreboards, and config-driven game rules.
11+
12+
For grounded implementation patterns drawn from real Paper plugins, load these references as needed:
13+
14+
- [`references/project-patterns.md`](references/project-patterns.md) for high-level architecture patterns seen in real gameplay plugins
15+
- [`references/bootstrap-registration.md`](references/bootstrap-registration.md) for `onEnable`, command wiring, listener registration, and shutdown expectations
16+
- [`references/state-sessions-and-phases.md`](references/state-sessions-and-phases.md) for player session modeling, game phases, match state, and reconnect-safe logic
17+
- [`references/config-data-and-async.md`](references/config-data-and-async.md) for config managers, database-backed player data, async flushes, and UI refresh tasks
18+
- [`references/maps-heroes-and-feature-modules.md`](references/maps-heroes-and-feature-modules.md) for map rotation, hero or class systems, and modular feature growth
19+
20+
## Scope
21+
22+
- In scope: Paper, Spigot, Bukkit plugin development
23+
- In scope: `plugin.yml`, commands, tab completion, listeners, schedulers, configs, permissions, Adventure text, player state, minigame flow
24+
- In scope: Java-based server plugin architecture, debugging, refactoring, and feature implementation
25+
- Out of scope by default: Fabric mods, Forge mods, client mods, Bedrock add-ons
26+
27+
If the user says "Minecraft plugin" but the stack is unclear, first determine whether the project is Paper/Spigot/Bukkit or a modding stack.
28+
29+
## Default Working Style
30+
31+
When this skill triggers:
32+
33+
1. Identify the server API and version target.
34+
2. Identify the build system and Java version.
35+
3. Inspect `plugin.yml`, the main plugin class, and command or listener registration.
36+
4. Map the gameplay flow before editing code:
37+
- player lifecycle
38+
- game phases
39+
- timers and scheduled tasks
40+
- team, arena, or match state
41+
- config and persistence
42+
5. Make the smallest coherent change that keeps registration, config, and runtime behavior aligned.
43+
44+
If the plugin is gameplay-heavy or stateful, read [`references/project-patterns.md`](references/project-patterns.md) and [`references/state-sessions-and-phases.md`](references/state-sessions-and-phases.md) before editing.
45+
46+
## Project Discovery Checklist
47+
48+
Check these first when present:
49+
50+
- `plugin.yml`
51+
- `pom.xml`, `build.gradle`, or `build.gradle.kts`
52+
- the plugin main class extending `JavaPlugin`
53+
- command executors and tab completers
54+
- listener classes
55+
- config bootstrap code for `config.yml`, messages, kits, arenas, or custom YAML files
56+
- scheduler usage through Bukkit scheduler APIs
57+
- any player data, team state, arena state, or match state containers
58+
59+
## Core Rules
60+
61+
### Prefer the concrete server API in the repo
62+
63+
- If the project already targets Paper APIs, keep using Paper-first APIs instead of downgrading to generic Bukkit unless compatibility is explicitly required.
64+
- Do not assume an API exists across all versions. Check the existing dependency and surrounding code style first.
65+
66+
### Keep registration in sync
67+
68+
When adding commands, permissions, or listeners, update the relevant registration points in the same change:
69+
70+
- `plugin.yml`
71+
- plugin startup registration in `onEnable`
72+
- any permission checks in code
73+
- any related config or message keys
74+
75+
### Respect main-thread boundaries
76+
77+
- Do not touch world state, entities, inventories, scoreboards, or most Bukkit API objects from async tasks unless the API explicitly permits it.
78+
- Use async tasks for external I/O, heavy computation, or database work, then switch back to the main thread before applying gameplay changes.
79+
80+
### Model gameplay as state, not scattered booleans
81+
82+
For gameplay plugins, prefer explicit state objects over duplicated flags:
83+
84+
- match or game phase
85+
- player role or class
86+
- cooldown state
87+
- team membership
88+
- arena assignment
89+
- alive, eliminated, spectating, or queued state
90+
91+
When the feature affects NightMare-style or War-style gameplay, look for hidden state transitions first before patching symptoms.
92+
93+
### Favor config-driven values
94+
95+
When the feature includes damage, cooldowns, rewards, durations, messages, map settings, or toggles:
96+
97+
- prefer config-backed values over hardcoding
98+
- provide sensible defaults
99+
- keep key names stable and readable
100+
- validate or sanitize missing values
101+
102+
### Be careful with reload behavior
103+
104+
- Avoid promising safe hot reload unless the code already supports it well.
105+
- On config reload, ensure in-memory caches, scheduled tasks, and gameplay state are handled consistently.
106+
107+
## Implementation Patterns
108+
109+
### Commands
110+
111+
For new commands:
112+
113+
- add the command to `plugin.yml`
114+
- implement executor and tab completion when needed
115+
- validate sender type before casting to `Player`
116+
- separate parsing, permission checks, and gameplay logic
117+
- send clear player-facing feedback for invalid usage
118+
119+
### Listeners
120+
121+
For event listeners:
122+
123+
- guard early and return early
124+
- check whether the current player, arena, or game phase should handle the event
125+
- avoid doing expensive work in hot events such as move, damage, or interact spam
126+
- centralize repeated checks where practical
127+
128+
### Scheduled Tasks
129+
130+
For timers, rounds, countdowns, cooldowns, or periodic checks:
131+
132+
- store task handles when cancellation matters
133+
- cancel tasks on plugin disable and when a match or arena ends
134+
- avoid multiple overlapping tasks for the same gameplay concern unless explicitly intended
135+
- prefer one authoritative game loop over many loosely coordinated repeating tasks
136+
137+
### Player and Match State
138+
139+
For per-player or per-match state:
140+
141+
- define ownership clearly
142+
- clean up on quit, kick, death, match end, and plugin disable
143+
- avoid memory leaks from stale maps keyed by `Player`
144+
- prefer `UUID` for persistent tracking unless a live player object is strictly needed
145+
146+
### Text and Messages
147+
148+
When the project uses Adventure or MiniMessage:
149+
150+
- follow the existing formatting approach
151+
- avoid mixing legacy color codes and Adventure styles without a reason
152+
- keep message templates configurable when messages are gameplay-facing
153+
154+
## High-Risk Areas
155+
156+
Pay extra attention when editing:
157+
158+
- damage handling and custom combat logic
159+
- death, respawn, spectator, and elimination flow
160+
- arena join and leave flow
161+
- scoreboard or boss bar updates
162+
- inventory mutation and kit distribution
163+
- async database or file access
164+
- version-sensitive API calls
165+
- shutdown and cleanup in `onDisable`
166+
167+
## Output Expectations
168+
169+
When implementing or revising plugin code:
170+
171+
- produce runnable Java code, not pseudo-code, unless the user asks for design only
172+
- mention any required updates to `plugin.yml`, config files, build files, or resources
173+
- call out version assumptions explicitly
174+
- point out thread-safety or API-compatibility risks when they exist
175+
- preserve the project's existing conventions and folder structure
176+
177+
When the requested change touches plugin startup, async data, match flow, class systems, or rotating maps, consult the matching reference file before editing.
178+
179+
## Validation Checklist
180+
181+
Before finishing, verify as many of these as the task allows:
182+
183+
- the command, listener, or feature is registered correctly
184+
- `plugin.yml` matches the implemented behavior
185+
- imports and API types match the targeted server stack
186+
- scheduler usage is safe
187+
- config keys referenced in code exist or have defaults
188+
- state cleanup paths exist for match end, player quit, and plugin disable
189+
- there are no obvious null, cast, or lifecycle hazards
190+
191+
## Common Gotchas
192+
193+
- Casting `CommandSender` to `Player` without checking
194+
- Updating Bukkit state from async tasks
195+
- Forgetting to register listeners or declare commands in `plugin.yml`
196+
- Using `Player` objects as long-lived map keys when `UUID` is safer
197+
- Leaving repeating tasks alive after a round, arena, or plugin shutdown
198+
- Hardcoding gameplay constants that should live in config
199+
- Assuming Paper-only APIs in a Spigot-targeted plugin
200+
- Treating reload as free even though stateful plugins often break under reload
201+
202+
## Preferred Response Shape
203+
204+
For substantial requests, structure work like this:
205+
206+
1. Current plugin context and assumptions
207+
2. Gameplay or lifecycle impact
208+
3. Code changes
209+
4. Required registration or config updates
210+
5. Validation and remaining risks
211+
212+
For small requests, keep the answer concise but still mention any needed `plugin.yml`, config, or lifecycle updates.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Bootstrap And Registration
2+
3+
Use this reference when changing `onEnable`, `onDisable`, command setup, event wiring, or startup ordering.
4+
5+
## Bootstrap pattern from real plugins
6+
7+
### NightMare-style bootstrap
8+
9+
Common traits:
10+
11+
- connect database first
12+
- register configuration serialization when needed
13+
- initialize multiple config managers
14+
- create gameplay managers and GUI helpers
15+
- apply lobby UI to already-online players
16+
- register many listeners explicitly
17+
- start repeating tasks
18+
- register commands and tab completers last
19+
20+
This pattern works well when startup must assemble many gameplay subsystems before the server can safely accept interactions.
21+
22+
### War-style bootstrap
23+
24+
Common traits:
25+
26+
- save default config and bundled resources first
27+
- construct config wrapper and progression config
28+
- connect database and create repository/service layers
29+
- construct scoreboard, map, hero, and game services
30+
- wire service dependencies together
31+
- start background tasks
32+
- preload async cache, then schedule main-thread UI refreshes
33+
- register listeners and commands after service graph is ready
34+
35+
This pattern works well when player data and async services are first-class dependencies.
36+
37+
## Command registration rules
38+
39+
Observed practices:
40+
41+
- `NightMare` declares all commands in `plugin.yml`, then sets executors and a tab completer in code.
42+
- `War` declares `leave` in `plugin.yml`, then checks for null before assigning the executor.
43+
44+
Recommended rules:
45+
46+
- always add new commands to `plugin.yml`
47+
- if a command may be optional or renamed, null-check `getCommand`
48+
- if tab completion exists, register it in the same change
49+
- keep usage, permission, and permission-message aligned with actual code behavior
50+
51+
## Listener registration rules
52+
53+
Observed practices:
54+
55+
- both plugins register listeners in one place during startup
56+
- listener constructors receive only the services they actually need
57+
58+
Recommended rules:
59+
60+
- keep registration centralized in the main plugin class or a clearly named bootstrap helper
61+
- inject services explicitly instead of having listeners discover globals everywhere
62+
- if a listener depends on a task, GUI, or manager, construct that dependency first
63+
64+
## Repeating tasks and startup ordering
65+
66+
Observed practices:
67+
68+
- `NightMare` starts periodic tasks directly from startup for height checks and spectator sidebar refreshes
69+
- `War` starts background tasks via services such as `PlayerDataService` and `GameService`
70+
71+
Recommended rules:
72+
73+
- start repeating tasks only after required state holders exist
74+
- cancel them in shutdown
75+
- if the task mutates gameplay state, ensure it runs on the main thread
76+
- if the task does I/O or cache rebuilds, prefer async execution and hop back to main thread for Bukkit work
77+
78+
## Shutdown expectations
79+
80+
Observed practices:
81+
82+
- `NightMare` deletes games, unloads maps, flushes pending stats, closes DB resources, and clears sidebars
83+
- `War` shuts down game service, player data service, map manager, then disconnects database
84+
85+
Recommended rules:
86+
87+
- stop tasks
88+
- flush dirty data
89+
- detach or clear UI objects
90+
- unload temporary worlds if your plugin creates them
91+
- close database pools last
92+
93+
## Contribution guidance for this skill
94+
95+
When generating code for startup or shutdown, mention:
96+
97+
- which config or resource files must exist
98+
- which commands or listeners must be registered
99+
- what tasks must be started or canceled
100+
- what resources require cleanup on disable

0 commit comments

Comments
 (0)