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
+71
View File
@@ -55,6 +55,26 @@
</dependency>
</dependencies>
<!--
Publication vers le registry Maven de Gitea (Gitea Packages).
URL = https://<gitea>/api/packages/<owner>/maven
Le même endpoint sert pour les releases et les snapshots ; Gitea
décide selon le suffixe -SNAPSHOT de la version.
L'<id> doit matcher l'entrée <server id="gitea-luc-rival"> dans
~/.m2/settings.xml (qui contient le PAT). Voir docs/setup.md.
-->
<distributionManagement>
<repository>
<id>gitea-luc-rival</id>
<url>https://gitea.luc-rival.fr/api/packages/admin/maven</url>
</repository>
<snapshotRepository>
<id>gitea-luc-rival</id>
<url>https://gitea.luc-rival.fr/api/packages/admin/maven</url>
</snapshotRepository>
</distributionManagement>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
@@ -67,6 +87,57 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!--
Publie un -sources.jar contenant le code source .java. Permet à
IntelliJ d'aller au source d'une classe CR-Core depuis un plugin
de jeu consommateur (Ctrl+Click).
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
Publie un -javadoc.jar contenant le HTML généré à partir des
commentaires /** ... */ du code. IntelliJ l'affiche en popup
au survol d'une méthode CR-Core.
doclint=none désactive les checks stricts (méthodes sans @param,
@return, etc.) — on accepte de la doc partielle plutôt que
bloquer le build.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<source>${maven.compiler.source}</source>
<doclint>none</doclint>
<quiet>true</quiet>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<charset>UTF-8</charset>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>