mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 02:25:38 +01:00
Fix issue where the parser would try to parse too much
This commit is contained in:
parent
a76b60a3c7
commit
4047c6529d
@ -50,8 +50,6 @@ public class SimpleOptionParser implements OptionParser {
|
||||
|
||||
@Override
|
||||
public boolean parse(RandomSearcher searcher, String[] args) {
|
||||
boolean ret = false;
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].startsWith("-")) {
|
||||
String option = args[i].toLowerCase().substring(1);
|
||||
@ -65,13 +63,23 @@ public class SimpleOptionParser implements OptionParser {
|
||||
"option", option,
|
||||
"perm", "randomteleport.manual.option." + aliases.iterator().next()));
|
||||
}
|
||||
if (argsLength < 0 || i + argsLength < args.length) {
|
||||
ret |= parser.apply(searcher, Arrays.copyOfRange(args, i + 1, argsLength < 0 ? args.length : i + 1 + argsLength));
|
||||
i++;
|
||||
int argLength = argsLength > 0 ? argsLength : 0;
|
||||
for (int j = i + argLength; j < args.length; j++) {
|
||||
if (!args[j].startsWith("-")) {
|
||||
argLength++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i + argLength < args.length) {
|
||||
return parser.apply(searcher, Arrays.copyOfRange(args, i, i + argLength));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasAccess(CommandSender initiator) {
|
||||
|
Loading…
Reference in New Issue
Block a user