Commit e77649c
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 objects 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 ace4942 commit e77649c
26 files changed
Lines changed: 1279 additions & 302 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-common/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 | | |
| |||
161 | 159 | | |
162 | 160 | | |
163 | 161 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
168 | 166 | | |
169 | 167 | | |
170 | 168 | | |
171 | | - | |
| 169 | + | |
172 | 170 | | |
| 171 | + | |
| 172 | + | |
173 | 173 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | 174 | | |
179 | 175 | | |
180 | 176 | | |
181 | 177 | | |
182 | 178 | | |
183 | 179 | | |
184 | | - | |
| 180 | + | |
| 181 | + | |
185 | 182 | | |
186 | 183 | | |
187 | 184 | | |
188 | 185 | | |
189 | 186 | | |
190 | | - | |
| 187 | + | |
191 | 188 | | |
192 | 189 | | |
193 | 190 | | |
194 | 191 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | 192 | | |
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 | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
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