minecraft-plugin-dev

Minecraft 插件开发:为当前 Paper 26.x(Java 25)或传统 Bukkit 衍生 1.21.x(Java 21)服务器创建、修改与调试服务端插件,使用 JavaPlugin API(事件、命令、调度、配置、PDC 与 Adventure)。不涉及客户端模组或原版数据包。

仓库最近推送
GitHub Stars
218
Forks
12
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "minecraft-plugin-dev":https://skillpi.com/zh/skills/deepskill-5d21f7d966b835fc35a6cba206e717140b0292ab06ab90e50a32a929bc475b21。安装前核对上游来源和版本:https://github.com/Jahrome907/minecraft-agent-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

Minecraft 插件开发:为当前 Paper 26.x(Java 25)或传统 Bukkit 衍生 1.21.x(Java 21)服务器创建、修改与调试服务端插件,使用 JavaPlugin API(事件、命令、调度、配置、PDC 与 Adventure)。不涉及客户端模组或原版数据包。

0 下载

介绍来源: third_party · Jahrome907 · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: minecraft-plugin-dev
description: "Develop Minecraft server plugins using the Paper/Bukkit/Spigot API for Minecraft 26.x (and the 1.21.x line). Handles creating Paper plugins with JavaPlugin, event listeners with @EventHandler, commands, schedulers (sync/async/Folia-safe), Persistent Data Container (PDC), Adventure text components, Vault economy integration, BungeeCord/Velocity messaging, plugin.yml and paper-plugin.yml configuration, YAML config management, and Paper-specific enhancement APIs. Targets Paper API 26.2 (Java 25; 1.21.x servers use Java 21) with Gradle (Kotlin DSL). Plugins run server-side only and do not require client installation. Use when creating or modifying Minecraft server plugins, working with Paper/Bukkit/Spigot APIs, or developing server-side features involving event handlers, commands, or plugin.yml configuration."

Minecraft Plugin Development Skill

Platform Overview

Platform Base API Notes
Paper Bukkit/Spigot + Paper extensions Recommended; async chunk loading, Adventure native
Spigot Bukkit + Spigot extensions Legacy; fewer APIs, slower
Bukkit Base API only Avoid for new plugins
Folia Paper fork Region-threaded; requires special scheduler APIs

Paper is the recommended target. Paper includes all Bukkit and Spigot APIs plus significant performance improvements and additional APIs.

Routing Boundaries

  • Use when: the target is server-side Paper/Bukkit/Spigot plugin behavior with JavaPlugin APIs.
  • Do not use when: the task requires client-side installable mods or loader APIs (minecraft-modding / minecraft-multiloader).
  • Do not use when: the task is pure vanilla datapack/command content (minecraft-datapack / minecraft-commands-scripting).
  • Do not use when: the task is a Bedrock add-on or Script API pack (minecraft-bedrock-addon-dev).
  • Do not use when: the task is installing, configuring or operating an existing plugin (minecraft-server-admin, minecraft-permissions-admin, minecraft-essentials-ops).
  • Do not use when: the task is writing automated tests (minecraft-testing) or release pipelines (minecraft-ci-release).

Bundled References

  • Read references/runtime-patterns.md when the task touches scheduling, Folia support, PDC, Adventure/MiniMessage, YAML config, Vault, or Paper-specific APIs.

Project Setup

settings.gradle.kts

rootProject.name = "my-plugin"

build.gradle.kts

plugins {
    java
    id("com.gradleup.shadow") version "8.3.0"
}

group = "com.example"
version = "1.0.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
    // For Vault (economy API)
    maven("https://jitpack.io")
}

dependencies {
    compileOnly("io.papermc.paper:paper-api:26.2.build.+")
    // Optional: Vault economy/permission integration
    compileOnly("com.github.MilkBowl:VaultAPI:1.7")
}

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(25))
}

tasks {
    processResources {
        // Substitutes ${version} in plugin.yml with the Gradle project version
        filesMatching(listOf("plugin.yml", "paper-plugin.yml")) {
            expand("version" to project.version)
        }
    }
    shadowJar {
        archiveClassifier.set("")
    }
    build {
        dependsOn(shadowJar)
    }
}

gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip

Project Layout

my-plugin/
├── build.gradle.kts
├── settings.gradle.kts
├── gradle/
│   └── wrapper/
│       └── gradle-wrapper.properties
└── src/main/
    ├── java/com/example/myplugin/
    │   ├── MyPlugin.java          ← main class (extends JavaPlugin)
    │   ├── listeners/
    │   │   └── PlayerListener.java
    │   ├── commands/
    │   │   └── MyCommand.java
    │   └── managers/
    │       └── DataManager.java
    └── resources/
        ├── plugin.yml
        ├── paper-plugin.yml      ← optional, Paper-only metadata
        └── config.yml

Core Files

plugin.yml (Bukkit-compatible default)

name: MyPlugin
version: "${version}"
main: com.example.myplugin.MyPlugin
description: An example Paper plugin
author: YourName
website: https://github.com/example/my-plugin
api-version: '26.2'

commands:
  myplugin:
    description: Main plugin command
    usage: /myplugin <subcommand>
    permission: myplugin.use
    aliases: [mp]

permissions:
  myplugin.use:
    description: Allows use of /myplugin
    default: true
  myplugin.admin:
    description: Admin access
    default: op

Minecraft Java now uses year-based versions (26.1, 26.2, 26.3). Use api-version: '26.2' to target Paper 26.2. Older servers on the 1.21 line still use api-version: '1.21' or '1.21.<patch>'. In this repo, the validator accepts 1.21, positive 1.21.<patch> values, and 26.<minor> or 26.<minor>.<hotfix> values. A 26.x minor newer than the documented example (26.2) is allowed but warned, so new Paper releases do not force an immediate validator edit. Values such as 1.21.0, 1.21.01, 1.22 or 26.0 are rejected. Paper 26.x needs Java 25. Paper 26.3 is still beta; confirm the build on https://papermc.io/downloads/paper before you pin it.

paper-plugin.yml (Paper-only metadata)

Use paper-plugin.yml when you need Paper-specific metadata such as folia-supported or server/bootstrap dependency ordering. Keep plugin.yml if you must stay portable to Bukkit-derived servers that do not understand the Paper-specific file.

name: MyPlugin
version: "${version}"
main: com.example.myplugin.MyPlugin
api-version: '26.2'
folia-supported: true

dependencies:
    server:
        Vault:
            load: BEFORE
            required: false

Main Plugin Class

package com.example.myplugin;

import com.example.myplugin.commands.MyCommand;
import com.example.myplugin.listeners.PlayerListener;
import org.bukkit.plugin.java.JavaPlugin;

public final class MyPlugin extends JavaPlugin {

    private static MyPlugin instance;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        // Register listeners
        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);

        // Register commands
        var cmd = getCommand("myplugin");
        if (cmd != null) {
            cmd.setExecutor(new MyCommand(this));
            cmd.setTabCompleter(new MyCommand(this));
        }

        getLogger().info("MyPlugin enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("MyPlugin disabled.");
    }

    public static MyPlugin getInstance() {
        return instance;
    }
}

Event Listeners

package com.example.myplugin.listeners;

import com.example.myplugin.MyPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

public class PlayerListener implements Listener {

    private final MyPlugin plugin;

    public PlayerListener(MyPlugin plugin) {
        this.plugin = plugin;
    }

    @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
    public void onPlayerJoin(PlayerJoinEvent event) {
        event.joinMessage(
            Component.text(event.getPlayer().getName() + " joined!", NamedTextColor.GREEN)
        );
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
        event.quitMessage(
            Component.text(event.getPlayer().getName() + " left.", NamedTextColor.YELLOW)
        );
    }

    @EventHandler(ignoreCancelled = true)
    public void onPlayerDeath(PlayerDeathEvent event) {
        // Modify death message using Adventure components
        event.deathMessage(
            Component.text("☠ ", NamedTextColor.RED)
                .append(Component.text(event.getPlayer().getName(), NamedTextColor.WHITE))
                .append(Component.text(" died!", NamedTextColor.RED))
        );
    }
}

EventPriority order

LOWEST → LOW → NORMAL → HIGH → HIGHEST → MONITOR
Use MONITOR for logging only (never modify outcome). Use ignoreCancelled = true unless you have a specific reason to handle cancelled events.

Cancellable events

@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
    if (event.getPlayer().hasPermission("myplugin.break.deny")) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(Component.text("You cannot break blocks!", NamedTextColor.RED));
    }
}

Commands

package com.example.myplugin.commands;

import com.example.myplugin.MyPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class MyCommand implements CommandExecutor, TabCompleter {

    private final MyPlugin plugin;

    public MyCommand(MyPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
                             @NotNull String label, @NotNull String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage(Component.text("Only players can use this command.", NamedTextColor.RED));
            return true;
        }

        if (!player.hasPermission("myplugin.use")) {
            player.sendMessage(Component.text("No permission.", NamedTextColor.RED));
            return true;
        }

        if (args.length == 0) {
            player.sendMessage(Component.text("Usage: /myplugin <reload|info>", NamedTextColor.YELLOW));
            return true;
        }

        return switch (args[0].toLowerCase()) {
            case "reload" -> {
                plugin.reloadConfig();
                player.sendMessage(Component.text("Config reloaded.", NamedTextColor.GREEN));
                yield true;
            }
            case "info" -> {
                player.sendMessage(Component.text("Version: " + plugin.getDescription().getVersion(), NamedTextColor.AQUA));
                yield true;
            }
            default -> {
                player.sendMessage(Component.text("Unknown subcommand.", NamedTextColor.RED));
                yield false;
            }
        };
    }

    @Override
    public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command,
                                                @NotNull String label, @NotNull String[] args) {
        if (args.length == 1) {
            return List.of("reload", "info").stream()
                .filter(s -> s.startsWith(args[0].toLowerCase()))
                .toList();
        }
        return List.of();
    }
}

Schedulers

For classic Paper plugins, BukkitScheduler is still fine. If you claim Folia support, route player, entity, region, global, and async work through the matching Folia-aware scheduler. Keep scheduling behind a small project-local interface when one plugin must support both Paper and Folia.

See references/runtime-patterns.md for copy-ready sync, async, cancelable, and Folia-safe scheduler examples.


Persistent Data Container (PDC)

PDC stores arbitrary data on any PersistentDataHolder (players, entities, items, chunks). Data is saved with the world and persists across restarts.

Create NamespacedKey instances once, keep data types stable after release, and use PDC for small metadata rather than large datasets. Prefer config files or a database for large or query-heavy plugin state.

See references/runtime-patterns.md for player, item, chunk, and world PDC examples.


Adventure Text Components

Paper uses Adventure natively for all text. No legacy chat colors. Use Component builders for code-owned messages and MiniMessage for config-driven messages. Avoid legacy ChatColor unless the target project already depends on it for compatibility.

See references/runtime-patterns.md for simple messages, hover/click events, MiniMessage parsing, titles, and action bars.


Configuration (YAML)

src/main/resources/config.yml

# Default config
settings:
  max-players: 20
  welcome-message: "<green>Welcome to the server!"
  cooldown-seconds: 30

database:
  host: localhost
  port: 3306
  name: myplugin_db

Accessing config values

Call saveDefaultConfig() in onEnable(), provide explicit defaults when reading values, and validate config shape before starting long-running tasks.

Custom config file

Use custom YAML files only when separating user config from mutable plugin data is worth the extra file handling. Keep blocking disk writes off hot event paths.

See references/runtime-patterns.md for config read/write and custom YAML examples.


Vault Integration (Economy / Permissions)

Declare Vault as compileOnly, soft-depend on it in plugin metadata, and disable economy features cleanly when the service provider is unavailable. Never assume a Vault-compatible economy plugin is installed just because Vault itself is present.

See references/runtime-patterns.md for a minimal economy setup and charge example.


Paper-Specific APIs

Use Paper APIs when they remove main-thread blocking or simplify Adventure-native behavior. Keep optional plugin integrations behind presence checks and metadata soft-dependencies.

See references/runtime-patterns.md for async chunk loading, custom item meta, profile lookup, and protection-plugin integration examples.


Common Tasks Checklist

Creating a new event listener

  • [ ] Create class implementing Listener
  • [ ] Annotate methods with @EventHandler
  • [ ] Call getServer().getPluginManager().registerEvents(listener, plugin) in onEnable()
  • [ ] Add ignoreCancelled = true unless you need cancelled events

Adding a new command

  • [ ] Define command in plugin.yml under commands:
  • [ ] Create executor class implementing CommandExecutor
  • [ ] (Optional) implement TabCompleter for autocomplete
  • [ ] Register with getCommand("name").setExecutor(new MyExecutor())

Saving plugin data

  • [ ] For simple values: use config.yml via getConfig() / saveConfig()
  • [ ] For per-entity data: use PDC with a NamespacedKey
  • [ ] For large datasets: use async scheduler + file I/O or a database

Scheduling a repeating task

  • [ ] Determine if task needs main thread (use runTaskTimer) or is I/O (use runTaskTimerAsynchronously)
  • [ ] Store the BukkitTask reference so you can cancel in onDisable()
  • [ ] Cancel all tasks in onDisable() or use getServer().getScheduler().cancelTasks(plugin)

Build, Validate, and Run

  1. Build the plugin JAR:
    ./gradlew shadowJar
    # Output: build/libs/my-plugin-1.0.0-SNAPSHOT.jar
  2. Run the bundled validator to catch config and layout errors:
    ./scripts/validate-plugin-layout.sh --root /path/to/plugin-project
    # Strict mode treats warnings as failures:
    ./scripts/validate-plugin-layout.sh --root /path/to/plugin-project --strict
  3. Fix any reported errors and re-run until clean.
  4. Deploy: copy JAR to server/plugins/ and restart, or use the dev server:
    ./gradlew runServer

The validator checks:

  • plugin.yml required keys (name, version, main, api-version) and repo-supported 1.21, positive 1.21.<patch> and 26.<minor>[.<hotfix>] api-version values, with warnings for versions newer than the repo's current example
  • Main class path exists and extends JavaPlugin
  • /reload anti-pattern detection in source snippets

References

版本历史

  1. v2.5.4 GitHub ↗
    原版更新说明

    - Correct version-specific examples and source links across the skill library. - Trim obsolete snippets, preserve legacy guidance, and sync all skill copies. Validated with the repository checks and all 13 skill validators. No game runtime testing was performed.

  2. v2.5.3 GitHub ↗
    原版更新说明

    Updates the 13-skill Minecraft bundle for GPT-6 Astra and Claude Fable 5.1 workflows while preserving existing project versions and host tool boundaries. - Refreshes current Minecraft 26.x / Java 25 guidance and keeps explicit Minecraft 1.21.x / Java 21 and Forge 1.20.1 / Java 17 lanes. - Corrects pack metadata, resource references, mod and GameTest registration, Paper commands, world-generation examples, server operations, and publishing instructions. - Addresses all PR #11 review findings and strengthens regression coverage for implicit legacy GameTest templates and class-specific registration. - Synchronizes Codex, Claude Code, and plugin skill copies; package, lockfile, and both plugin manifests are version 2.5.3. Validation: full repository checks and focused positive/negative regression cases passed locally. GitHub Skills Audit and secret scanning passed on the released commit. These are content, packaging, and static-validator checks; they do not certify Java compilation or in-game behavior. Fable 5.1 guidance was checked against official documentation, without a live authenticated model evaluation. See the [September skill audit](https://github.com/Jahrome907/minecraft-agent-skills/blob/v2.5.3/docs/skill-audit-2026-09.md) for sources, coverage, and validation limits. Changes: https://github.com/Jahrome907/minecraft-agent-skills/pull/11

  3. v2.5.2 GitHub ↗
    原版更新说明

    Refreshes the skill set for current Minecraft 26.2 and Java 25 while preserving explicit Minecraft 1.21.x and Forge 1.20.1 legacy lanes. Adds current pack metadata, Paper and MockBukkit examples, 26.2 multiloader validation, corrected GameTest structure paths, refreshed self-contained YAML tooling and Markdown lint dependencies, and Node 24-compatible pinned GitHub Actions. Validated by the full repository check and secret scan.

  4. v2.5.1 GitHub ↗
    原版更新说明

    ## Added - Added a README quick-install prompt for installing the Codex or Claude Code skill bundle without manually cloning the repo. ## Changed - Corrected worldgen, resource-pack, command-script, and server-ops examples. - Hardened datapack, worldgen, Paper plugin, testing, multiloader, and workflow validation coverage. - Clarified Codex plugin install requirements and aligned CI with the full local check gate. - Pinned workflow actions to full commit SHAs. - Bumped package and plugin metadata to version 2.5.1.

  5. v2.5.0 GitHub ↗
    原版更新说明

    ### Changed - Refreshed 1.21.x version guidance for Fabric 1.21.11, Architectury multiloader artifacts, MockBukkit 4.x, and Gradle setup actions. - Corrected 1.21.9+ datapack/resource-pack metadata examples and validators to use exact `[major, minor]` pack versions instead of JSON decimals. - Added resource-pack validator coverage for 1.21.4+ `assets/<namespace>/items/*.json` item model definitions. - Updated command examples for 1.21.9 spawn rotation syntax and 1.21.11 namespaced gamerules, and made the bundled stopwatch `.mcfunction` copyable. - Hardened server-admin, WorldEdit, and EssentialsX ops guidance around Velocity forwarding, backup quiescing, WorldEdit history cleanup, sign-shop permissions, and spawn-module checks. - Added local mirror-sync validation to `npm run check` and aligned CI to use the same npm script entrypoints. - Clarified that this bundle remains centered on 1.21.x and that Minecraft 26.1.x requires a separate Java/API/data-format verification pass. - Bumped package and plugin metadata to version `2.5.0`.

此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 提供完整的Minecraft服务端插件开发指南,涵盖从项目搭建到部署的全流程
  • 针对Paper 26.x和Bukkit 1.21.x两大主流平台,实用性强
  • 包含详细的代码示例、配置模板和最佳实践,显著提升开发效率
触发精准95/100

亮点

  • 触发条件描述清晰,明确区分服务端插件开发与客户端模组、数据包等边界
  • 详细列出了适用和不适用场景,避免误触发
结构规范88/100

待提升项

  • 文档长度 原报告严重程度:轻微

    主文档内容较长(约800+行),可能影响阅读体验

    改进建议:考虑将部分内容拆分为独立的参考文件,保持主文档简洁

亮点

  • 结构清晰,分阶段组织内容,从概述到具体实现逐步深入
  • 包含完整的项目布局、核心文件模板和常用任务清单
  • 提供了丰富的代码示例和配置片段
执行可靠94/100

亮点

  • 所有依赖库版本明确指定,构建配置完整可靠
  • 代码示例展示了正确的错误处理和资源管理实践
  • 提供了验证脚本确保项目结构和配置正确性
  • 调度器使用示例包含了必要的取消机制
证据可验 (前四项均值)92/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • docs.advntr.dev
  • docs.papermc.io
  • github.com
  • javadoc.io
  • jd.papermc.io
  • jitpack.io
  • papermc.io
  • repo.papermc.io

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。