Commit 13bf2c4
committed
Initial implementation of
Changes:
- Implemented `FlagsArgument` (#483)
- Moved var handles for `CommandNode` `children`,`literals`, and `arguments` to `CommandAPIHandler`
- Added `FlagsArgumentCommon` FlagsArgumentRootNode` and `FlagsArgumentEndingNode` to handle the special node structure and parsing required
- Updated `CustomArgument`
- All `AbstractArgument` builder methods are delegated to the base argument
- Replaced `CommandAPIExecutor` parameter of `AbstractArgument#addArgumentNodes` to a `Function` to allow object that hold arguments to better control how those arguments are executed
- Added package `dev.jorel.commandapi.commandnodes` for class that extend `CommandNode` and related classes
- Tweaked some exceptions
- `GreedyArgumentException`
- Changed because the `FlagsArgument` is sometimes greedy - only greedy iff it has no terminal branches
- Greedy arguments are now detected when `AbstractArgument#addArgumentNodes` returns an empty list
- Tweaked the exception message
- `DuplicateNodeNameException`
- Changed because literal arguments can conflict with other nodes if they are listed
- Now thrown when two listed arguments have the same node name
- Added `UnnamedArgumentCommandNode` to make sure unlisted arguments do not conflict
- Renamed `MultiLiteralCommandNode` to `NamedLiteralCommandNode` for use by listed `Literal` arguments
- Tweaked the exception message
TODO:
- Clean up code
- Add tests
- Remove test commands in CommandAPIMain
- Add javadocs and documentation
- Hope Mojang/brigadier#144 is resolved, otherwise be annoyed :(FlagsArgument (and other changes)1 parent c0260f6 commit 13bf2c4
26 files changed
Lines changed: 1301 additions & 317 deletions
File tree
- commandapi-core/src/main/java/dev/jorel/commandapi
- arguments
- commandnodes
- exceptions
- commandapi-platforms
- commandapi-bukkit
- commandapi-bukkit-core/src/main/java/dev/jorel/commandapi
- arguments
- commandapi-bukkit-plugin/src/main/java/dev/jorel/commandapi
- commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test
- commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/arguments
Lines changed: 10 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
135 | | - | |
| 133 | + | |
136 | 134 | | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | | - | |
| 144 | + | |
| 145 | + | |
149 | 146 | | |
150 | 147 | | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
154 | | - | |
| 151 | + | |
155 | 152 | | |
156 | 153 | | |
157 | 154 | | |
158 | 155 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | 156 | | |
Lines changed: 6 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
324 | | - | |
| 326 | + | |
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
329 | 331 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 332 | + | |
344 | 333 | | |
345 | 334 | | |
346 | 335 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
Lines changed: 75 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
68 | 81 | | |
69 | | - | |
70 | | - | |
| 82 | + | |
71 | 83 | | |
| 84 | + | |
| 85 | + | |
72 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
73 | 90 | | |
74 | 91 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| |||
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
144 | | - | |
| 156 | + | |
145 | 157 | | |
146 | 158 | | |
147 | 159 | | |
| |||
431 | 443 | | |
432 | 444 | | |
433 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
434 | 450 | | |
435 | 451 | | |
436 | 452 | | |
| |||
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
455 | | - | |
| 471 | + | |
456 | 472 | | |
457 | 473 | | |
458 | 474 | | |
| |||
469 | 485 | | |
470 | 486 | | |
471 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
472 | 536 | | |
473 | 537 | | |
474 | 538 | | |
| |||
522 | 586 | | |
523 | 587 | | |
524 | 588 | | |
525 | | - | |
| 589 | + | |
526 | 590 | | |
527 | 591 | | |
528 | 592 | | |
| |||
564 | 628 | | |
565 | 629 | | |
566 | 630 | | |
567 | | - | |
| 631 | + | |
568 | 632 | | |
569 | 633 | | |
570 | 634 | | |
| |||
0 commit comments