Skip to content

Add commands subfolder with template CommandExecutor#12

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-subfolder-for-command-templates
Draft

Add commands subfolder with template CommandExecutor#12
Copilot wants to merge 2 commits into
mainfrom
copilot/add-subfolder-for-command-templates

Conversation

Copilot AI commented Mar 31, 2026

Copy link
Copy Markdown

The template lacked any example of command handling, leaving developers without a starting point for adding slash commands to their plugins.

Changes

  • commands/PapermcPluginTemplateCommand.java — New commands/ package containing a CommandExecutor template with thorough Javadoc explaining the full command registration workflow (handler implementation, plugin.yml declaration, and main class wiring), mirroring the doc style of PapermcPluginTemplateListener
  • plugin.yml — Adds a commands: section registering the example /hello command
  • PapermcPluginTemplatePlugin.java — Wires up the executor in setup() via Objects.requireNonNull(getCommand("hello")).setExecutor(...)

Example

// commands/PapermcPluginTemplateCommand.java
public class PapermcPluginTemplateCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player player) {
            player.sendMessage("Hello " + player.getName() + "! (from PapermcPluginTemplate)");
        } else {
            sender.sendMessage("This command can only be run by a player.");
        }
        return true;
    }
}
# plugin.yml
commands:
  hello:
    description: Greet the player.
    usage: /hello

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hub.spigotmc.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.0.2-bin/25jlreiuz6u3xu2phlpa2vv4m/gradle-8.0.2/lib/gradle-launcher-8.0.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.0.2 (dns block)
  • repo.papermc.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.0.2-bin/25jlreiuz6u3xu2phlpa2vv4m/gradle-8.0.2/lib/gradle-launcher-8.0.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.0.2 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add subfolder for command templates Add commands subfolder with template CommandExecutor Mar 31, 2026
Copilot AI requested a review from thehale March 31, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add subfolder for command templates

2 participants