Fixed exception thrown by commands with multiple spaces between arguments.

Dieser Commit ist enthalten in:
Wizjany 2011-04-22 09:03:21 +08:00 committet von MonsieurApple
Ursprung 3f2afa9581
Commit 3c92fbe910

Datei anzeigen

@ -20,6 +20,7 @@ package com.sk89q.minecraft.util.commands;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.ArrayList;
public class CommandContext { public class CommandContext {
protected String[] args; protected String[] args;
@ -30,8 +31,15 @@ public class CommandContext {
} }
public CommandContext(String[] args) { public CommandContext(String[] args) {
int i = 1; ArrayList<String> splitArgs = new ArrayList<String>();
for (String arg : args) {
if (!arg.equals(null) && !arg.equals("")) {
splitArgs.add(arg);
}
}
args = splitArgs.toArray(new String[0]);
int i = 1;
for (; i < args.length; i++) { for (; i < args.length; i++) {
if (args[i].charAt(0) == '-' && args[i].matches("^-[a-zA-Z]+$")) { if (args[i].charAt(0) == '-' && args[i].matches("^-[a-zA-Z]+$")) {
for (int k = 1; k < args[i].length(); k++) { for (int k = 1; k < args[i].length(); k++) {