v1.9.0
Ultra Update
This is the biggest release ever, containing alot of enhancements and bug fixes
✨ Enhancements
-
Improve workflow drastically for failure, Test allowing
@SubCommandto act as shortcuts for@Usageby @iiAhmedYT in #6 -
Allow
@ContextResolvedto be placed on a class of a custom type to remove the need
for the user to write the annotation every time on different command metods, by @iiAhmedYT in #7 -
Brigadier Internal Check
Introduces a safeguard against unsupported internal operations to improve stability. -
OptionalValueSupplier Refactor
Redesigned to accept only string values—generic parameters have been removed for clarity. -
ParameterType Refactor
- Streamlined parsing logic and data structures for more reliable type handling.
- Removed
fromStringmethod and addedString inputparameter to theresolvemethod. - The constructor requires
Typenow instead ofTypeWrap
-
Command Tree Optimization
Accelerates command-tree construction for snappier performance. -
Annotation Harmony
Allows@Usageand@SubCommandto coexist on the same method, boosting flexibility. -
Context Resolution Guard
Now enforces the@ContextResolvedannotation before any ContextResolved parameters. -
Annotation Map Preservation
Retains unreplaced annotations in the internal map for seamless downstream processing. -
Attachment Mode
Adds a newAttachmentModeenum which defines how sub commands are attached to its parent command.
The default value isUNSET.public enum AttachmentMode { /** * Attaches the subcommand to an empty usage of the {@link Command} */ EMPTY, /** * Attaches the subcommand to the default usage of a {@link Command}, * which may be empty or contain optional arguments/parameters. */ DEFAULT, /** * Attaches the sub command to the main {@link CommandUsage} of a {@link Command} * A main usage is a usage that contains required arguments/parameters. */ MAIN, /** * Behaves exactly like {@link AttachmentMode#MAIN}, * It's used internally to know when to prefer the global attachment mode over the per subcommand one. */ UNSET }
-
New Annotation
@GlobalAttachmentMode
Lets you define the default attachment mode
of a command's subcommands to reduce boilerplate code. -
Per command help provider
Added new@Helpto be placed below@Commandto set help providers per commands.
Example:@Command("mycommand") @Help(MyHelpProvider.class) public class MyCommand { //your command class } public class MyHelpProvider implements HelpProvider<YourPlatformSource> { @Override public void provide(ExecutionContext<S> context, S source) throws ImperatException { //implement your help sending logic here } }
-
API Update
- Some Public-facing methods are no longer marked internal, making your API boundaries clearer.
- Added
Command#setDefaultUsage - Added
Command#setHelpProviderand its builder methodCommand.Builder#helpProvider - Added a constant empty usage for every command being created, that can be fetched by calling
Command#getEmptyUsage()
🐛 Bug Fixes
-
Repeatable SubCommands
Fixed@SubCommandso you can now declare multiple methods with the same name to define different usages. -
Argument Requirement Relaxation
Removed the restriction that the first argument must be required, allowing optional-first usage. -
AnnotationReplacer Correction
Resolved an issue where certain annotations weren’t replaced when usingAnnotationReplacer.
Full Changelog:
https://github.com/VelixDevelopments/Imperat/releases/tag/v1.9.0