mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
fix child command issues
This commit is contained in:
@@ -50,8 +50,9 @@ public class TerraCommandManager implements CommandManager {
|
||||
|
||||
boolean req = true;
|
||||
for(Argument argument : command.arguments()) {
|
||||
if(!req && argument.required())
|
||||
if(!req && argument.required()) {
|
||||
throw new MalformedCommandException("Required arguments must come first! Arguments: " + Arrays.toString(command.arguments()));
|
||||
}
|
||||
req = argument.required();
|
||||
|
||||
if(args.isEmpty()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ public class CommandTest {
|
||||
manager.execute("test", Arrays.asList("s2", "first", "2"));
|
||||
manager.execute("test", Arrays.asList("sub1", "first", "2", "3.4"));
|
||||
manager.execute("test", Arrays.asList("sub2", "first", "2"));
|
||||
manager.execute("test", Arrays.asList("first", "2")); // Parent command args
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user