From 29f5123f0118cb6070b8e427a1a21df1182fca98 Mon Sep 17 00:00:00 2001 From: Traqueur_ Date: Sun, 4 Jan 2026 20:51:16 +0100 Subject: [PATCH 1/3] feat(core): add wrapper and primitive type in internal converters --- .../java/fr/traqueur/commands/api/CommandManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/main/java/fr/traqueur/commands/api/CommandManager.java b/core/src/main/java/fr/traqueur/commands/api/CommandManager.java index a3782e2..73d9560 100644 --- a/core/src/main/java/fr/traqueur/commands/api/CommandManager.java +++ b/core/src/main/java/fr/traqueur/commands/api/CommandManager.java @@ -465,9 +465,18 @@ public CommandInvoker getInvoker() { */ private void registerInternalConverters() { this.registerConverter(String.class, (s) -> s); + + // Register both primitive and wrapper types for DefaultArgumentParser (Spigot/Velocity). + // JDA's ArgumentParser handles primitives internally, but text-based platforms need explicit registration. + // Wrapper types (Integer.class, Long.class, etc.) are registered for compatibility with wrapper usage. + // Primitive types (int.class, long.class, etc.) are registered to support primitive method parameters. this.registerConverter(Boolean.class, new BooleanArgument<>()); + this.registerConverter(boolean.class, new BooleanArgument<>()); this.registerConverter(Integer.class, new IntegerArgument()); + this.registerConverter(int.class, new IntegerArgument()); this.registerConverter(Double.class, new DoubleArgument()); + this.registerConverter(double.class, new DoubleArgument()); this.registerConverter(Long.class, new LongArgument()); + this.registerConverter(long.class, new LongArgument()); } } From ee31c9c278252d509fb9a74cf62376765481012e Mon Sep 17 00:00:00 2001 From: Traqueur_ Date: Sun, 4 Jan 2026 20:52:11 +0100 Subject: [PATCH 2/3] feat(core): version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f81469e..8656a1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=5.0.0 \ No newline at end of file +version=5.0.1 \ No newline at end of file From 0b12ab9d15c34b7e081f570291bf245598e0f43a Mon Sep 17 00:00:00 2001 From: Traqueur_ Date: Sun, 4 Jan 2026 21:01:04 +0100 Subject: [PATCH 3/3] feat(core&bom): add bom and fix converter --- bom/README.md | 96 +++++++++++++++++++ bom/build.gradle | 77 +++++++++++++++ build.gradle | 8 +- .../traqueur/commands/api/CommandManager.java | 2 +- .../commands/api/arguments/ArgumentType.java | 2 +- settings.gradle | 1 + 6 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 bom/README.md create mode 100644 bom/build.gradle diff --git a/bom/README.md b/bom/README.md new file mode 100644 index 0000000..723a30d --- /dev/null +++ b/bom/README.md @@ -0,0 +1,96 @@ +# CommandsAPI BOM (Bill of Materials) + +This module provides a BOM (Bill of Materials) for CommandsAPI, making it easier to manage consistent versions across all CommandsAPI modules. + +## Usage + +### Gradle (Kotlin DSL) + +```kotlin +dependencies { + // Import the BOM + implementation(platform("fr.traqueur.commands:bom:VERSION")) + + // Then add dependencies without specifying versions + implementation("fr.traqueur.commands:core") + implementation("fr.traqueur.commands:platform-spigot") + implementation("fr.traqueur.commands:platform-velocity") + implementation("fr.traqueur.commands:platform-jda") + implementation("fr.traqueur.commands:annotations-addon") +} +``` + +### Gradle (Groovy DSL) + +```groovy +dependencies { + // Import the BOM + implementation platform('fr.traqueur.commands:bom:VERSION') + + // Then add dependencies without specifying versions + implementation 'fr.traqueur.commands:core' + implementation 'fr.traqueur.commands:platform-spigot' + implementation 'fr.traqueur.commands:platform-velocity' + implementation 'fr.traqueur.commands:platform-jda' + implementation 'fr.traqueur.commands:annotations-addon' +} +``` + +### Maven + +```xml + + + + fr.traqueur.commands + bom + VERSION + pom + import + + + + + + + + fr.traqueur.commands + core + + + fr.traqueur.commands + platform-spigot + + + fr.traqueur.commands + platform-velocity + + + fr.traqueur.commands + platform-jda + + + fr.traqueur.commands + annotations-addon + + +``` + +## Benefits + +Using the BOM provides several advantages: + +1. **Version Consistency**: All CommandsAPI modules will use compatible versions +2. **Simplified Dependency Management**: No need to specify versions for each module +3. **Easier Updates**: Update all modules by changing only the BOM version +4. **Reduced Conflicts**: Ensures all modules work together correctly + +## Available Modules + +The BOM manages versions for the following modules: + +- `core` - Core functionality and API +- `platform-spigot` - Spigot/Bukkit platform support +- `platform-velocity` - Velocity proxy platform support +- `platform-jda` - JDA (Discord) platform support +- `annotations-addon` - Annotation-based command registration \ No newline at end of file diff --git a/bom/build.gradle b/bom/build.gradle new file mode 100644 index 0000000..cc95d7b --- /dev/null +++ b/bom/build.gradle @@ -0,0 +1,77 @@ +plugins { + id 'java-platform' + id 'maven-publish' +} + +description = 'CommandsAPI BOM (Bill of Materials)' + +javaPlatform { + allowDependencies() +} + +dependencies { + constraints { + api(project(':core')) + api(project(':spigot')) + api(project(':velocity')) + api(project(':jda')) + api(project(':annotations-addon')) + } +} + +publishing { + repositories { + maven { + def repository = System.getProperty('repository.name', 'snapshots') + def repoType = repository.toLowerCase() + + name = "groupez${repository.capitalize()}" + url = uri("https://repo.groupez.dev/${repoType}") + + credentials { + username = findProperty("${name}Username") ?: System.getenv('MAVEN_USERNAME') + password = findProperty("${name}Password") ?: System.getenv('MAVEN_PASSWORD') + } + + authentication { + create("basic", BasicAuthentication) + } + } + } + + publications { + create('maven', MavenPublication) { + from components.javaPlatform + + groupId = rootProject.group.toString() + artifactId = 'bom' + version = rootProject.version.toString() + + pom { + name = 'CommandsAPI BOM' + description = 'CommandsAPI Bill of Materials - Manages consistent versions across CommandsAPI modules' + url = 'https://github.com/Traqueur-dev/CommandsAPI' + + licenses { + license { + name = 'MIT License' + url = 'https://opensource.org/licenses/MIT' + } + } + + developers { + developer { + id = 'traqueur' + name = 'Traqueur' + } + } + + scm { + connection = 'scm:git:git://github.com/Traqueur-dev/CommandsAPI.git' + developerConnection = 'scm:git:ssh://github.com/Traqueur-dev/CommandsAPI.git' + url = 'https://github.com/Traqueur-dev/CommandsAPI' + } + } + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index d2e5a4b..f6300d2 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,10 @@ allprojects { group = 'fr.traqueur.commands' version = property('version') - apply { - plugin 'java-library' + if (project.name != 'bom') { + apply { + plugin 'java-library' + } } ext.classifier = System.getProperty('archive.classifier') @@ -27,7 +29,7 @@ allprojects { } subprojects { - if (project.name.contains('test-')) { + if (project.name.contains('test-') || project.name == 'bom') { return; } diff --git a/core/src/main/java/fr/traqueur/commands/api/CommandManager.java b/core/src/main/java/fr/traqueur/commands/api/CommandManager.java index 73d9560..af9f7bb 100644 --- a/core/src/main/java/fr/traqueur/commands/api/CommandManager.java +++ b/core/src/main/java/fr/traqueur/commands/api/CommandManager.java @@ -202,7 +202,7 @@ public void unregisterCommand(Command command, boolean subcommands) { * @param The type of the argument. */ public void registerConverter(Class typeClass, ArgumentConverter converter) { - this.typeConverters.put(typeClass.getSimpleName().toLowerCase(), new ArgumentConverter.Wrapper<>(typeClass, converter)); + this.typeConverters.put(typeClass.getName().toLowerCase(), new ArgumentConverter.Wrapper<>(typeClass, converter)); } /** diff --git a/core/src/main/java/fr/traqueur/commands/api/arguments/ArgumentType.java b/core/src/main/java/fr/traqueur/commands/api/arguments/ArgumentType.java index 55c958d..fc36b71 100644 --- a/core/src/main/java/fr/traqueur/commands/api/arguments/ArgumentType.java +++ b/core/src/main/java/fr/traqueur/commands/api/arguments/ArgumentType.java @@ -24,7 +24,7 @@ record Simple(Class clazz) implements ArgumentType { @Override public String key() { - return clazz.getSimpleName().toLowerCase(); + return clazz.getName().toLowerCase(); } } diff --git a/settings.gradle b/settings.gradle index 749e16c..564065b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ rootProject.name = 'CommandsAPI' +include 'bom' include 'velocity-test-plugin' include 'spigot-test-plugin' include 'spigot'