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