feat: dynamic command registration + Maven publication setup

CRCore.registerCommand() now falls back to dynamic registration via the
server's internal CommandMap (reflection on CraftServer.commandMap) when
the command is absent from the host plugin's plugin.yml. Game plugins can
now use CR-Core with zero plugin.yml changes — just instantiate CRCore.
If the command IS declared in plugin.yml, CR-Core detects it and uses
setExecutor/setTabCompleter as before.

pom.xml: distributionManagement targeting Gitea Packages
(https://gitea.luc-rival.fr/api/packages/admin/maven), plus
maven-source-plugin (3.3.0) and maven-javadoc-plugin (3.6.3) so each
mvn deploy publishes the main jar, a -sources.jar and a -javadoc.jar.
doclint=none on javadoc to tolerate partial doc.

docs/setup.md: clarifies that the commands: entry in plugin.yml is now
optional. docs/decisions.md: new decision logged for the dynamic
registration approach.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Antone Barbaud
2026-06-09 11:33:45 +02:00
parent c1b414f400
commit 7ee349f206
4 changed files with 173 additions and 12 deletions
+15 -5
View File
@@ -48,13 +48,23 @@ name: MyGame
main: fr.exemple.mygame.MyGamePlugin
version: 1.0
api-version: 1.16
commands:
core:
description: Commandes CR-Core
# aliases optionnels — équivalents au point de vue Bukkit
aliases: [cr, crcore]
```
> **Pas besoin de déclarer la commande `core`** : CR-Core l'enregistre
> dynamiquement via le `CommandMap` du serveur quand elle est absente du
> plugin.yml. Si tu préfères la déclarer quand même (pour customiser la
> description ou les aliases côté Bukkit), tu peux ajouter :
>
> ```yaml
> commands:
> core:
> description: Commandes CR-Core
> aliases: [cr, crcore]
> ```
>
> Dans ce cas, CR-Core détecte la commande déclarée et s'y branche
> normalement via `setExecutor` (pas d'enregistrement dynamique).
### Code minimal
```java