Fixes an ArrayOutOfBoundsException when command was at "top" level

This commit is contained in:
Florian CUNY 2018-07-18 15:49:05 +02:00
parent f8a7c1af48
commit 89b4b80208

View File

@ -198,7 +198,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
return false;
}
// Execute and trim args
return cmd.execute(user, args[cmd.subCommandLevel-1], Arrays.asList(args).subList(cmd.subCommandLevel, args.length));
return cmd.execute(user, (cmd.subCommandLevel > 0) ? args[cmd.subCommandLevel-1] : label, Arrays.asList(args).subList(cmd.subCommandLevel, args.length));
}
/**