Releases: Traqueur-dev/CommandsAPI
5.0.2
Full Changelog: 5.0.0...5.0.2
5.0.0
CommandsAPI v5.0.0
🚨 Breaking Changes
- Repository Migration: JitPack →
repo.groupez.dev - GroupId Change:
com.github.Traqueur-dev.CommandsAPI→fr.traqueur.commands - Java 21 Required
- Removed deprecated
getAsInt(),getAsDouble()methods → Useargs.<T>get()orargs.<T>getOptional()
✨ New Features
Annotations Addon
New optional module for declarative command definition using annotations.
@CommandContainer public class MyCommands {@Command(name = "heal", permission = "admin.heal") @Alias({"h", "health"}) public void heal(Player sender, @Arg("target") Optional<Player> target) { Player toHeal = target.orElse(sender); toHeal.setHealth(20); } @Command(name = "admin.reload") // Hierarchical via dot notation public void reload(CommandSender sender) { } @TabComplete(command = "heal", arg = "target") public List<String> completeTarget(Player sender, String current) { return Bukkit.getOnlinePlayers().stream() .map(Player::getName) .filter(n -> n.startsWith(current)) .toList(); }
}
Annotations: @CommandContainer, @Command, @Arg, @Infinite, @Alias, @TabComplete
CommandBuilder - Fluent API
Create commands without subclassing:
manager.command("hello")
.description("Say hello")
.permission("myplugin.hello")
.arg("player", Player.class)
.optionalArg("message", String.class)
.executor((sender, args) -> {
Player target = args.get("player");
sender.sendMessage("Hello " + target.getName());
})
.register();
SenderResolver
Automatic sender type resolution for annotations. Each platform provides its own resolver:
- Bukkit:
CommandSender,Player,ConsoleCommandSender - Velocity:
CommandSource,Player,ConsoleCommandSource - JDA:
SlashCommandInteractionEvent,User,Member
ArgumentParser System
New extensible parsing system with typed error handling:
ParseResultwith success/error statesParseErrorwith types:MISSING_REQUIRED,TYPE_NOT_FOUND,CONVERSION_FAILED
⚡ Performance Improvements
- Player/OfflinePlayer argument caching - Tab completion cached with 1s/5s TTL
- CommandTree optimizations - Precompiled patterns, HashMap lookups
- Async version checker - Non-blocking update check with 5s timeout
🔧 Improvements
- Sealed
ArgumentTypeinterface (Simple|Infinite) - Better label validation (max 64 chars/segment, max 10 depth)
- Improved Javadoc across all modules
- Code cleanup and formatting
📦 Installation
<repository> <id>groupez-releases</id> <url>https://repo.groupez.dev/releases</url> </repository><dependency>
<groupId>fr.traqueur.commands</groupId>
<artifactId>platform-spigot</artifactId> <!-- or platform-velocity, platform-jda -->
<version>5.0.0</version>
</dependency>
<!-- Optional: Annotations Addon -->
<dependency>
<groupId>fr.traqueur.commands</groupId>
<artifactId>annotations-addon</artifactId>
<version>5.0.0</version>
</dependency>
repositories {
maven { url 'https://repo.groupez.dev/releases' }
}
dependencies {
implementation 'fr.traqueur.commands:platform-spigot:5.0.0'
implementation 'fr.traqueur.commands:annotations-addon:5.0.0' // Optional
}
🎯 3 Ways to Create Commands
| Method | Style | Best For |
|---|---|---|
| Inheritance | extends Command<T,S> | Complex commands, full control |
| Builder | manager.command() | Quick inline commands |
| Annotations | @ Command | Clean, declarative style |
Full Changelog: See MIGRATION_v4_to_v5.md for detailed migration guide.
Full Changelog: 4.3.1...5.0.0
4.3.1
📦 Changelog – Version 4.3.0
This minor release introduces full JDA (Java Discord API) support for Discord bots, improves error handling, and includes several bug fixes.
✨ New Features
Full JDA (Discord) Support
- New
jdamodule: Native support for Discord bots with JDA 6.1.2Command<T>: Base class for Discord slash commandsJDAPlatform<T>:CommandPlatformimplementation for DiscordJDAExecutor: Event handler for Discord interactionsJDAArguments: Extension ofArgumentswith Discord-specific methods (getUser, getChannel, etc.)RoleRequirement: Discord role validation system for commands
New jda-test-bot module
- Demo Discord bot including:
PingCommand: Latency test commandMathCommand: Command with subcommands (add, subtract, multiply, divide)UserInfoCommand: User information display with embeds
🔧 Improvements
Exception Handling
- New custom exceptions:
CommandRegistrationException: Dedicated exception for command registration errorsUpdaterInitializationException: Exception for updater initialization errors
- Replaced generic
RuntimeException:- In
CommandManager: UsingCommandRegistrationExceptionwith contextual messages - In
SpigotPlatform: More explicit error messages during registration
- In
Arguments API Improvements
- Visibility changes:
argumentsandloggerare nowprotectedinstead ofprivate- Allows extension by classes like
JDAArguments
- New utility methods:
has(String key): Check if an argument existsgetLogger(): Protected access to the logger
CommandInvoker Optimization
- Improved support for commands without arguments
- Better execution context handling
Bug Fixes
- Fixed name duplication: Corrected alias addition logic in
registerSubCommandsandunregisterSubCommandsgetAliases()already returns[name, ...aliases], no need to add the name manually- Prevents command name duplication in the alias list
🏗️ Infrastructure & Configuration
Java 21 Migration
- GitHub Actions: Updated test workflow to Java 21
- JDA Module: Java 21 compatibility (sourceCompatibility and targetCompatibility)
Gradle Configuration
- Added JDA module in
settings.gradleandjitpack.yml - Workflow simplification: Removed redundant
testtask in CI workflow (keeps onlytestAll)
📂 Architecture
New Modules
jda/: Discord/JDA support- Main classes:
Command,JDAPlatform,JDAExecutor,JDAArguments,RoleRequirement
- Main classes:
jda-test-bot/: Demo bot- Classes:
TestBot,PingCommand,MathCommand,UserInfoCommand
- Classes:
New Core Classes
CommandRegistrationExceptionUpdaterInitializationException
📝 Migration Notes
For API Users
- No breaking changes: All modifications are backward compatible
- Classes inheriting from
Argumentscan now accessargumentsandloggeras protected members
For New Discord Projects
- Add the
platform-jdadependency to use CommandsAPI with Discord - Check the
jda-test-botmodule for implementation examples
Java Requirements
- JDA module requires Java 21 minimum
- Other modules remain compatible with their previous Java versions
Full Changelog: 4.2.3...4.3.1
4.2.3
📦 Changelog – Version 4.2.3
This patch release updates project dependencies and improves module configuration for better API exposure.
🔧 Improvements
Gradle & Build System Updates
- Upgraded Gradle wrapper from
8.7to8.14 - Enhanced module dependencies: Changed
implementationtoapifor core module in bothspigotandvelocitysubprojects- This ensures transitive dependencies are properly exposed to consumers
- Java compatibility update for Velocity module:
- Set
sourceCompatibilityto Java 21 - Set
targetCompatibilityto Java 21
- Set
Documentation Updates
- Updated installation examples to use
[version]placeholder instead of hardcoded version numbers - Fixed Gradle publish command in README: corrected module names from
platform-spigot/platform-velocitytospigot/velocity
📝 Migration Notes
- Non-breaking patch release
- Projects depending on
spigotorvelocitymodules will now automatically receivecoremodule dependencies - Velocity module now requires Java 21 (previously unspecified)
Full Changelog: 4.2.2...4.2.3
4.2.2
📦 Changelog – Version 4.2.2
This patch release fixes generic type declarations in the EnumArgument class for better type safety.
🐛 Bug Fixes
🔧 Fixed Enum Argument Type Safety
- Updated
EnumArgument<T, S>generic types:- Changed
ArgumentConverter<Enum<T>>toArgumentConverter<T> - Updated
apply()method return type fromEnum<T>toT
- Changed
📝 Migration Notes
- Non-breaking patch release
- No API changes or migration required
Full Changelog: 4.2.1...4.2.2
4.2.1
📦 Changelog – Version 4.2.1
This patch release fixes edge cases in tab-completion behavior for hierarchical commands registered via CommandTree.
It ensures suggestions are accurate and context-aware based on cursor position and partially typed input.
🐛 Bug Fixes
🎯 Improved Tab-Completion Suggestions
-
Fixed incorrect suggestions when the cursor is placed immediately after a valid argument without a trailing space (e.g.
/test sub<CURSOR>):-
Suggestions now differentiate between:
- Cursor at end of argument ➜ sibling and matching suggestions.
- Cursor after space ➜ child/subcommand suggestions.
-
-
Handled partial alias paths consistently:
- Suggestions work correctly for commands registered under aliases (e.g.
"parent.child") and their subcommands.
- Suggestions work correctly for commands registered under aliases (e.g.
🔧 Internal Improvements
- Refactored fallback suggestion logic in
CommandInvoker#suggest(...):- Clean separation of "argument-in-progress" vs "ready for next argument" cases.
📝 Migration Notes
This is a non-breaking patch release:
- No API changes.
- No migration required.
Full Changelog: 4.2.0...4.2.1
4.2.0
📦 Changelog – Version 4.2.0
This release adds a hierarchical command tree, improves default usage formatting, and lays the groundwork for more flexible subcommand management. It remains backward-compatible with 4.1.x.
🚨 Major Changes
🌲 Prefix-Tree Command Registry
-
Replaced the flat
Map<String, Command>with a newCommandTree<T, S>data structure.- Commands and subcommands are now stored in a trie, keyed by dot-separated paths (e.g.
"base.sub.subsub"). - Lookup via
findNode(base, rawArgs)returns the most specific matching node plus any leftover arguments. - Removal via
removeCommand(label, prune)can either clear a single node or prune an entire subtree.
- Commands and subcommands are now stored in a trie, keyed by dot-separated paths (e.g.
-
Introduced
CommandNode<T, S>to represent each segment in the tree, with optionalcommandpayload and child-tracking (hadChildren) flags.
🔄 Refactored Default Usage Generation
-
Overhauled
generateDefaultUsage(...)to show only one level of subcommands, then required and optional arguments.-
Usage now prints:
- Full command path (
/parent child …) - First-level subcommand choices (
<sub1|sub2>) - Required args (
<arg>…) and optional args ([opt]…)
- Full command path (
-
-
Backward-compatible: existing explicit
setUsage(...)overrides still apply.
✨ New Features
🔍 Improved Lookup & Autocomplete
- Subcommands are no longer flat—autocomplete and invocation automatically traverse the tree.
- Arguments fallback correctly when a node has no children but still accepts parameters.
🧪 Expanded Test Coverage
-
Added unit tests for
CommandTreeandCommandNodecovering:- Adding and finding nested commands
- Matching with extra args and partial paths
- Removing nodes with both prune and “clear only” semantics
-
Updated existing
CommandInvokertests to work against the new tree-based lookup.
🐛 Bug Fixes & Tweaks
-
Fixed edge cases in
removeCommand:- Pruning a branch now properly removes children and resets parent flags.
- Clearing a command on a leaf node without children now unregisters that node.
-
Cleaned up legacy methods that referenced the old flat map.
🧹 General Improvements
- Simplified the
addCommand(label, command)API to accept full paths directly. - Streamlined tree traversal code with clearer branch and command-presence checks.
- Minor logging enhancements when adding or removing commands from the tree.
⚠️ Migration Guide
-
Update your dependency to 4.2.0:
implementation "com.github.Traqueur-dev:core:4.2.0" implementation "com.github.Traqueur-dev:CommandsAPI-platform-<your-platform>:4.2.0"
-
Review any custom invocation code: switch from
manager.getCommands().get(label)tomanager.getCommands().findNode(base, rawArgs)inCommandInvoker. -
Adjust tests or tooling that assumed a flat map of labels. All lookups now go through
CommandTree. -
Verify your usage messages: autogenerated usage strings now show only one subcommand level; if you relied on deeper nesting, update your custom
setUsage(...)or test expectations.
Full Changelog: 4.1.0...4.2.0
4.1.0
📦 Changelog – Version 4.1.0
This release focuses on refactoring invocation logic, improving testability, and expanding converter functionality. It remains backward-compatible with 4.0.x.
🚨 Major Changes
🔄 Centralized Command Invocation
- Introduced a new
CommandInvoker<T, S>class to encapsulate the shared “execute” and “suggest” flows. - All platform executors (Spigot, Velocity) now delegate to
CommandInvoker, eliminating duplicate code and simplifying maintenance.
🛠️ Updater Testability Enhancements
- Made the GitHub-releases URL and logger instance in
Updaterconfigurable viasetUrlLatestRelease(URL)andsetLogger(Logger)so you can mock HTTP calls and logging in tests. - Refactored
fetchLatestVersion()andgetString()to use the injected URL, streamlining the code and removing hard-coded values.
✨ New Features
🧪 Comprehensive Test Suite
- Added unit tests for core classes:
Arguments,CommandManager, and the newCommandInvoker. - Platform adapters (Spigot & Velocity) now have integration tests covering end-to-end parsing, permission checks, and tab-completion.
- Converter tests for Boolean, Integer, Double, Long, Short, Byte, Character, and the brand-new
EnumArgument.of(...)helper (#34).
🔤 Improved Argument Converters
BooleanArgumentnow explicitly returnsnullon empty/null input, matching the behavior of other numeric converters.- Introduced
EnumArgumentto parse enums by name and supply their constants for tab-completion.
🐛 Bug Fixes
- Suppressed warnings in platform code (e.g. discarded
Bukkit.getServer()results). - Fixed
Updater.getVersion()to consistently load from theVERSION_PROPERTY_FILEconstant. - Handled the edge case where infinite arguments consume all remaining tokens, with added tests to verify behavior.
🧹 General Improvements
- Smoothed out error-handling paths: non-existent types now log a clear message and return false rather than throwing unchecked exceptions.
- Reduced cyclomatic complexity in
invoke(...)andsuggest(...)by factoring out shared steps intoCommandInvoker. - Enhanced log messages for better developer diagnostics when argument parsing or permission checks fail.
⚠️ Migration Guide
This minor bump (4.1.0) is fully backward-compatible. To upgrade:
-
Update your dependency:
implementation "com.github.Traqueur-dev:core:4.1.0" implementation "com.github.Traqueur-dev:CommandsAPI-platform-<your-platform>:4.1.0"
-
If you have custom tests that stub
Updater, switch to the newUpdater.setUrlLatestRelease(...)/Updater.setLogger(...)hooks. -
Take advantage of the new
EnumArgument.of(MyEnum.class)for enum-typed parameters.
Full Diff: v4.0.0...v4.1.0
4.0.0
📦 Changelog – Version 4.0.0
This version introduces a full modular refactor, enabling multi-platform support and significantly improving flexibility, scalability, and maintainability of the API.
🚨 Major Changes
🧱 Modular Platform Architecture
-
The codebase has been restructured into multiple modules:
core: platform-agnostic logic (commands, arguments, permissions, etc.)platform-spigot: implementation for Spigot/Bukkitplatform-velocity: initial implementation for Velocity support
-
The new structure allows platform-specific adapters to be plugged into the same command core engine.
🔁 New CommandPlatform Abstraction
- Introduced
CommandPlatform<T, S>interface to isolate platform-specific behavior (e.g. permissions, sender types). - Makes the core engine reusable for other platforms such as Fabric or BungeeCord.
⚙️ CommandManager is now fully generic
- Signature changed to
CommandManager<T, S>for better type safety and separation between plugin and sender. - Requires platform adapters to inject the plugin and sender types explicitly.
📦 Platform-specific artifacts
-
Each platform has its own artifact:
com.github.Traqueur-dev.CommandsAPI:platform-<platform>:4.0.0e.g.
platform-spigot,platform-velocity
✨ New Features
📖 Usage Message Auto-Generation
- If no usage is explicitly defined, a usage string is generated dynamically based on the command's structure and sender permissions.
🧠 Multi-Platform Ready
- Developers can now implement their own adapters to support new environments.
- Velocity support is scaffolded and can be extended using the core system.
🐛 Bug Fixes
✅ In-Game Only Enforcement
- Improved player-only command handling.
- Commands can now reliably prevent execution from the console using in-game checks.
🧹 General Improvements
- Cleaner separation of concerns: core vs. platform logic
- Improved internal logging via injected
Logger - Better extensibility and type safety
- Codebase modernization (Java 21 features, stricter nullability, etc.)
- Tab-completion and argument parsing have been made more robust and flexible
⚠️ Migration Guide
This update is not backward compatible with v3.x.
You must:
-
Replace your dependency with:
com.github.Traqueur-dev.CommandsAPI:platform-spigot:4.0.0 -
Relocate CommandsAPI when shading to avoid classpath conflicts
-
Replace any platform-bound logic with core + platform adapter model
-
Update
CommandManagerusage to use the new generic format -
Migrate any custom message handling, requirements, or command registration accordingly
🛣️ Next Steps
Update your plugin(s) to the new modular structure to take advantage of:
- Cleaner API boundaries
- Better testability
- Support for multiple platforms in a single codebase
Full Changelog: 3.0.1...4.0.0
3.0.1
Changelog – Version 3.0.1
Bugs Fixs
- Fix bug when addition of aliases creating autocompletion failure and miss registeration