Commit graph

273 commits

Author SHA1 Message Date
jmp
e9134efad6 Add more tests for ambiguous command registration
Also clean up after leaving the Command Tree in an invalid state during tests
2020-12-07 20:05:45 +01:00
jmp
7df6917fe4 Added CommandExecutionException which wraps any exception thrown during the execution of command handlers. Should be handled using CommandManager#registerExceptionHandler, similar to NoSuchCommandException, ArgumentParseException, etc. 2020-12-07 20:05:45 +01:00
jmp
fc1a613463 Allow for use of named suggestion providers in @Flag annotated command method parameters, add methods to FlagContext to work with flag values as optionals 2020-12-07 20:05:45 +01:00
jmp
dbdafed273 🐛 Fix Bukkit alias command suggestions without Brigadier 2020-12-07 20:05:45 +01:00
jmp
e6af4e6caa Add a method to get the failure reason of SelectorParseExceptions 2020-12-07 20:05:45 +01:00
jmp
f1cc2689a0 Add a test for ambiguous command registration 2020-12-07 20:05:45 +01:00
jmp
5e27148d82 Throw AmbiguousNodeException for more ambiguous cases 2020-12-07 20:05:45 +01:00
jmp
9c9e13e8b8 Allow for use of @Completions annotation with argument types other than String 2020-12-07 20:05:45 +01:00
jmp
9a5c674f0d 🐛 Use the correct default values for Double and Float ranges in the StandardParserRegistry 2020-12-07 20:05:45 +01:00
Alexander Söderberg
d484b99fc4 Store the currently parsing argument in the command context
This fixes #101
2020-12-07 20:05:45 +01:00
Alexander Söderberg
c2065aabd1 Add parameter injectors (#104) 2020-12-07 20:05:45 +01:00
Alexander Söderberg
cfac2639ad Add errorprone and fix warnings/errors
The compiler will also treat all warnings as errors from now on.
2020-10-24 19:52:44 +02:00
jmp
6ffee9d04f Make changes from PR comments 2020-10-24 19:52:44 +02:00
Alexander Söderberg
3c7bd63f07 Add named suggestion providers
This allows for pre-registration of command suggestion providers, that can then be used in annotated command methods.
2020-10-24 19:52:44 +02:00
Alexander Söderberg
37e0b4e91b 📚 Change false to true in method javadoc 2020-10-24 19:52:44 +02:00
Alexander Söderberg
65b7cb6c69 🔥 Fix super important issues 2020-10-24 19:52:44 +02:00
Alexander Söderberg
bd19e1be56 Make the flag parser smarter
It will now allow multiple presence flag aliases to be joined into a single flag, such that `-a -b -c <=> -abc`.

This fixes #75
2020-10-24 19:52:44 +02:00
Alexander Söderberg
da0d586e52 📚 Add missing @Since annotations 2020-10-24 19:52:44 +02:00
Alexander Söderberg
d6ccc1d59b 🧹 Clean up the gradle build scripts a little
Changes:
- Move all dependency versions to a shared file
- Order the projects in settings.gradle
2020-10-24 19:52:44 +02:00
Alexander Söderberg
ad3ca86f42 Add a lockable command manager
This will be used for Sponge & Fabric, that both require command registration to happen (at latest) in specific events. This way we lock writing after that event has occurred.

As a side effect, we're able to collect & merge all commands before registering them to the platform, which means we don't have to hackily force-inject duplicate commands.
2020-10-24 19:52:44 +02:00
jmp
15c6c8a2a1 🐛 Suggest the right amount of arguments with >1 requestedArgumentCount 2020-10-24 19:52:44 +02:00
Alexander Söderberg
79aefb05b5 Add LocationArgument to cloud-bukkit (#63)
*  Add LocationArgument to cloud-bukkit

* 🎨 Use the Bukkit CommandSender from the command context in LocationArgument

* 🐛 Fixed quoted parsing in StringArgument

* 📚 Fix code style

Co-authored-by: jmp <jasonpenilla2@me.com>
2020-10-24 19:52:44 +02:00
Alexander Söderberg
1249b74e83 📚 Add since annotations to new classes 2020-10-24 19:52:44 +02:00
jmp
fba29041e6 🎨 Add caption for string "No input was provided" 2020-10-24 19:52:44 +02:00
Alexander Söderberg
366c4f2ce5 Add an adventure text colour parser 2020-10-24 19:52:44 +02:00
dependabot[bot]
fadd9578ec ⬆️ Bump jmh-generator-annprocess from 1.25.2 to 1.26
Bumps jmh-generator-annprocess from 1.25.2 to 1.26.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-23 22:44:16 +02:00
Jason
c051ff20df 🐛 Fix wrong suggestions following an invalid literal (#72)
*  Add a test for suggestions after an invalid literal

* 🐛 Fix wrong suggestions following an invalid literal

* 📚 Document literal suggestion fix in CHANGELOG

Co-authored-by: Alexander Söderberg <sauilitired@gmail.com>
2020-10-19 10:03:56 +02:00
Alexander Söderberg
27d228cb4c Implement PR comments 2020-10-19 10:03:56 +02:00
Alexander Söderberg
720019b508 🐛 Fixed quoted parsing in StringArgument 2020-10-19 10:03:56 +02:00
jmp
9bfb0f17d6 Use the correct failure reason for quoted StringArguments 2020-10-19 10:03:56 +02:00
Alexander Söderberg
6c63b47e5e
🐛 Fix multiple chained optionals not working correctly (#73)
* 🐛 Fix multiple chained optionals not working correctly

There is a problem where the child arguments never forwarded their commands correctly. This will now fix itself when necessary.

* 📚 Add CHANGELOG entry for change
2020-10-18 21:36:58 +02:00
Alexander Söderberg
de0666aa73 📚 Improve the CommandManager documentation 2020-10-17 19:03:52 +02:00
Alexander Söderberg
fd0658d320
🐛 Fix number suggestions. Again. 2020-10-14 01:07:56 +02:00
jmp
15526c95ed 🐛 Make number argument suggestions respect minimum 2020-10-13 13:38:12 -07:00
jmp
78796255a2 Only suggest each flag one time 2020-10-13 20:26:39 +02:00
Alexander Söderberg
06a34651bf
🐛 Fix brigadier suggestion building
An offset will be added pointing to the last occurrence of a blank space. This fixes incorrect tab completions for greedy strings
2020-10-13 19:53:01 +02:00
jmp
5f466fcbc0 Fix parsing of flag arguments that start with '-', i.e. a negative integer, add captions for flag argument 2020-10-13 15:07:40 +02:00
Alexander Söderberg
1bc2af8eed
🐛 Fix duplicate caption key names 2020-10-12 18:42:27 +02:00
Alexander Söderberg
6ab1c8a2e0
Merge pull request #43
*  Add a new caption system to allow for the configuration of…

*  Add caption support to all numerical types

* Add more standard pasres to the registry

* Add default messages for captions

*  Improve captions in core

* Add captions for Bukkit

*  Add FactoryDelegatingCaptionRegistry.java
2020-10-12 18:13:23 +02:00
Alexander Söderberg
0af788fa1d
🐛 Fix issue with permissions
Essentially, when there's an intermediary command and a child command with a variable leading argument, only the permission for the leading argument would be checked. In this case, that permission should only be considered if there's no more input. This fixes #46.
2020-10-12 01:43:50 +02:00
jmp
454ceb318a 🐛 Only print flags once in command syntax 2020-10-11 17:46:28 +02:00
Alexander Söderberg
1f3c3f2bd9
Add command argument preprocessors 2020-10-10 01:24:16 +02:00
Alexander Söderberg
fcd269b6e7
Add String[] args 2020-10-09 20:44:17 +02:00
Alexander Söderberg
16623969ad
🧹 Clean up CommandManager 2020-10-09 20:02:28 +02:00
Alexander Söderberg
423b29ee3c
Clean up StandardCommandSyntaxFormatter and make it easier to extend 2020-10-09 14:26:43 +02:00
Josh Taylor
fdb80b304c
Rename methods (#41) 2020-10-09 13:30:08 +02:00
Jason
882154a6a8
🐛 Fix async completions (#38)
Co-authored-by: Alexander Söderberg <sauilitired@gmail.com>
2020-10-08 13:12:07 +02:00
Alexander Söderberg
aa572e3533
🐛 Remove rogue print statement 2020-10-08 11:57:13 +02:00
Alexander Söderberg
c4abf4eca3
🐛 Fix float/double arguments 2020-10-07 23:40:48 +02:00
Alexander Söderberg
63dce244aa
🐛 Fix argument flags 2020-10-07 23:28:56 +02:00