Commit Graph
147 Commits
Author SHA1 Message Date
slicedlime (Mikael Hedberg)andslicedlime (Mikael Hedberg) 60a94e529d Cache lowercase versions of inputs and literals to avoid repeated calls to toLowerCase().
Thank you to Spottedleaf.
2021-03-23 12:52:01 +01:00
242de3fe73 Don't sort children on node addition to save on performance (#68)
* Use a Tree Map for children to save on performance

Everytime a child is added to the CommandNode, the children was sorted.
This action is extremely heavy with large node trees such as Minecraft.

From what I can see, sort order was not even needed by type since
the dispatcher parse checks argument and literal nodes instead.

Testing on /bossbar command seemed to have no impact to behavior.

Credit to https://github.com/PaperMC/Paper/commit/dda9680be520bba8cc8b4a20072af42bd8420e7a

Co-authored-by: virustotalop <[email protected]>

* Restore back to a LinkedHashMap

since iteration order isn't important anyways.

Co-authored-by: virustotalop <[email protected]>
2021-03-18 15:36:43 +01:00
boqandNathan Adams 559d8f3972 Allow single quote in strings 2019-02-19 13:34:51 +01:00
MrMickyandNathan Adams 7ee589b29b Remove unnecessary Guava usages (#13) 2018-10-04 13:29:08 +02:00
EarthcomputerandNathan Adams e60b24f36b Fix long argument examples 2018-09-28 14:04:53 +02:00
boqandNathan Adams bbfb8a7da1 Remove unused generic 2018-09-26 20:43:26 +02:00
boqandNathan Adams 107b852c74 Implement calculation of suggestions for any text position 2018-09-26 20:43:26 +02:00
EarthcomputerandNathan Adams b10b4479e2 Add string reader long tests 2018-09-26 20:43:13 +02:00
EarthcomputerandNathan Adams 88714288a7 Add long argument 2018-09-26 20:43:13 +02:00
Nathan Adams 8e9859e471 Added javadoc to CommandDispatcher 2018-09-26 10:42:35 +02:00
Nathan Adams 872658c737 Add copyright to all code 2018-09-26 10:42:35 +02:00
boqandErik Broes 019c0e3727 Pass StringReader instead of strings to CommandDispatcher 2018-07-24 14:52:17 +02:00
Nathan Adams 631096e871 Changed exceptions to Messages, to allow translations via library holders (ie minecraft game) 2018-05-30 12:45:07 +02:00
SeargeandNathan Adams 19c991b8b2 Added tests for suggesting numerical values instead of string values in suggestion builder 2018-05-02 15:06:33 +02:00
SeargeandNathan Adams 5c50fa7691 Support lists of integers as suggestions 2018-05-02 15:06:33 +02:00
Nathan Adams 0b2414808e Version 0.1.24 2018-02-07 13:45:50 +01:00
Nathan Adams ed3ecfbae3 Add tooltips to command suggestions 2018-02-06 11:30:39 +01:00
Nathan Adams ecfa4b31dd Suggestions:getList() now returns <Suggestion> not <String> 2018-02-05 16:28:48 +01:00
Nathan Adams 2def16ba85 Sort suggestions case-insensitively 2018-02-05 15:57:01 +01:00
Nathan Adams 182168acd5 Don't automatically remove common prefixes from suggestions 2018-02-05 15:51:48 +01:00
Nathan Adams 482e8601da Fixed crash in tab-completion 2018-01-31 11:17:59 +01:00
Nathan Adams 0827fe17d4 Don't system.out spam 2018-01-31 09:31:38 +01:00
Nathan Adams 69c2a248de Added functionality for finding ambiguities on-the-fly 2018-01-30 16:16:36 +01:00
Nathan Adams 3498398452 Fixed literals with special characters 2018-01-17 15:58:22 +01:00
Nathan Adams 928912de68 Catch redirect errors when forked 2018-01-17 12:46:19 +01:00
Nathan Adams 9fbf7bfe42 Distinguish forked redirect vs regular redirect 2018-01-17 12:13:29 +01:00
Nathan Adams 72817f8dd7 Improved parsing a bit 2018-01-17 11:22:54 +01:00
Nathan Adams 8d4d3cba80 Optimized parsing 2018-01-16 17:10:54 +01:00
Nathan Adams 8ed8f02bee Benchmark parsing 2018-01-16 17:10:42 +01:00
Nathan Adams 6a5289fa33 Fixed a bug in redirected contexts, version to 0.1.17 2018-01-16 15:14:30 +01:00
Nathan Adams a40cb8869f Optimized execute method, version 0.1.16 2018-01-16 14:22:47 +01:00
Nathan Adams f329f927e7 Improved the speed of redirected commands 2018-01-16 13:36:25 +01:00
Nathan Adams 5a8a8a29d2 Added benchmarks for simple & redirect command execution 2018-01-16 13:36:00 +01:00
Nathan Adams 6f04756d34 Don't stop when a forked command failed 2017-12-12 09:56:02 +01:00
Nathan Adams 4b64169b59 Catch any runtime exceptions from parsing 2017-12-11 16:04:22 +01:00
Nathan Adams 0a4d2363a2 Static helper methods for StringRange to make them more readable 2017-11-21 13:27:58 +01:00
Nathan Adams ab95e809e2 Suggestions should ultimately just contain a list of strings at a range, not each with an individual range 2017-11-21 10:51:56 +01:00
Nathan Adams 095498c94e New suggestion API 2017-11-20 13:45:05 +01:00
Nathan Adams 557352f289 Added double argument type 2017-11-16 14:31:50 +01:00
Nathan Adams 647f859b63 Added readFloat to StringReader 2017-11-16 14:28:46 +01:00
Nathan Adams 1b32233044 Don't add spaces to literal suggestions 2017-11-16 14:28:11 +01:00
Nathan Adams 1f201022dd Fixed issues with suggesting redirects 2017-11-15 16:13:52 +01:00
Nathan Adams 87f65f2bd2 Updated StringArgumentType.escapeIfRequired to new string rules 2017-11-14 15:20:06 +01:00
Nathan Adams 8bf57b4a9a Add the full input string to command context 2017-11-14 12:04:17 +01:00
Nathan Adams 45966d1d1e Changed custom suggestions to be nullable 2017-11-13 14:38:38 +01:00
Nathan Adams 1ce9894c07 Added methods for getting path by node & nodes by path 2017-11-13 12:42:31 +01:00
Nathan Adams 6b57d5f260 Expose information about the built-in arguments (bounds or type) 2017-11-13 11:15:04 +01:00
Nathan Adams fdff548a64 Forked commands should execute FIFO 2017-11-10 10:45:49 +01:00
Nathan Adams 1369eaf2c3 Allow mixed case literal suggestions 2017-11-09 12:25:29 +01:00
Nathan Adams b716f9a873 Executing forked commands should return the number of successes, and not fail on any errors 2017-11-09 12:11:08 +01:00