CommandsAPI v4.1.0: Added Enum-Argument Converter, Centralized Invoker & Full Test Suite
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 Updater configurable via setUrlLatestRelease(URL) and setLogger(Logger) so you can mock HTTP calls and logging in tests.
Refactored fetchLatestVersion() and getString() 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 new CommandInvoker.
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
BooleanArgument now explicitly returns null on empty/null input, matching the behavior of other numeric converters.
Introduced EnumArgument to 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 the VERSION_PROPERTY_FILE constant.
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(...) and suggest(...) by factoring out shared steps into CommandInvoker.
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: