Fix plot kick args

This commit is contained in:
Jesse Boyd 2016-03-29 18:57:35 +11:00
parent 19ef76de33
commit 512ae38392
2 changed files with 6 additions and 0 deletions

View File

@ -35,6 +35,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
aliases = {"k"},
description = "Kick a player from your plot",
permission = "plots.kick",
usage = "<player>",
category = CommandCategory.TELEPORT,
requiredType = RequiredType.PLAYER)
public class Kick extends SubCommand {

View File

@ -336,6 +336,11 @@ public abstract class Command {
String[] baseSplit = getCommandString().split(" ");
String[] fullSplit = getUsage().split(" ");
String base = getCommandString();
if (fullSplit.length - baseSplit.length < reqArgs.length) {
String[] tmp = new String[baseSplit.length + reqArgs.length];
System.arraycopy(fullSplit, 0, tmp, 0, fullSplit.length);
fullSplit = tmp;
}
for (int i = 0; i < reqArgs.length; i++) {
fullSplit[i + baseSplit.length] = reqArgs[i].getExample().toString();
failed = failed || reqArgs[i].parse(args[i]) == null;