Releases: tmarback/ModularCommands
Version 1.2.1
Version 1.2.0
Changelog
-
Changed how the default help command uses the description.
The description of a command is now split in two parts: the short description (everything up to the first line break) and the extended description (everything after). When displaying command lists, only the short description of each command is shown next to the command aliases. When displaying the details of a command, the short description is displayed first, then on the next line the extended description is displayed.
If the command description has only one line, then it has no extended description. If it is empty (or only has blank space), it has a blank short description and no extended description.
Any leading and trailing whitespace in the description, as well as whitespace between the short and extended description, is removed. A side effect of this is that it is impossible to have a command that has an extended description and blank short description.
-
Added statistics tracking.
CommandStats
records how many commands were (actually) executed byCommandHandlers
since the program was started. This includes only actual executions, so commands that do not execute due to ignoring the call (ignoring a bot caller, for example), being disabled, the calling user not having the required permissions, etc, are not counted. Cases where the command executes but fails (bot missing permissions, an exception is thrown, discord error, etc) are counted, however.The amount of executed commands can be retrieved using
CommandStats#getCount()
.
Version 1.1.1
Quick fix for issues caused by CommandContext
's retrieved helper being an Optional
of unknown type.
Changelog
CommantContext#getHelper()
returnsOptional<Object>
instead ofOptional<?>
.
Version 1.1.0
Changes
- Added placeholder registries. They represent a subregistry that does not currently exist but might be created in the future.
- They cannot register commands, but they can have their own subregistries (including other placeholders).
- Placeholders (and their respective subregistries/placeholders) are not part of the registry hierarchy, and so aren't searched when parsing commands and are not counted by the default help command. They are searched when finding a command by name, however.
- When the subregistry it stands for is actually created, it absorbs all the subregistries (and placeholders) from the placeholder. The placeholder is then deleted.
- Added a way to get subregistries using their names, for when the actual object that the registry links to isn't available. If the subregistry doesn't exist, a placeholder for it is created.
- When a subregistry is removed, its subregistries are kept in a placeholder instead of being deleted too (unless
CommandRegistry#removeSubRegistryFull
is used). This way, if it is recreated later, the subregistries aren't lost. - Context checks in registries can now be added and removed (in addition to set) for easier managing of multiple context checks.
Bugfixes
- Fixed a bug in the default help command that would make it crash if encountered a subregistry with no commands.
Release
All intended functionality now implemented.
Now includes 3 default commands:
({}
= The effective prefix of the root registry)
{}help
: gives information on commands and registries;{}enable
: enables commands or registries;{}disable
: disables commands or registries.
Also available are annotations for IModule
classes that allows pre-configuring registries linked to them.
Argument pre-parsing
Words can now be surrounded by quotes to form a single argument.
Arguments can now be automatically parsed into what they reference (mentions, emojis, etc).
Command execution methods now return boolean to indicate whether the operation was successfull or not.
Annotated commands
Commands can now be created by adding annotations to methods.
Also fixed NullPointerException when using as an included dependency instead of a separate module jar.
CommandBuilder added
New way of making commands: the CommandBuilder
.
Much faster than implementing the interface every time.
Uses a default ICommand
implementation, Command
.
Also made registries a little more thread-safe.
First useable state
Core functionality pretty much completed. Should be possible to use the framework normally.
Only way of making commands right now is by implementing ICommand
.
More testing is needed. That means some stuff could be broken. But the main parts were tested and seems to work fine.