Fix -biome option not working when another option was passed behind it

This commit is contained in:
Max Lee 2016-04-17 16:08:00 +02:00
parent ce33cd01ae
commit b1e108c444

View File

@ -246,6 +246,9 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
return true;
}
for(i = i+1; i < args.length; i++) {
if(args[i].startsWith("-")) {
break;
}
try {
biomeList.add(Biome.valueOf(args[i].toUpperCase()));
} catch(IllegalArgumentException e) {
@ -253,6 +256,10 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
return true;
}
}
if(biomeList.size() == 0) {
sender.sendMessage(ChatColor.DARK_RED + "Error:" + ChatColor.RED + " Please specify at least one biome after the -biome option!");
return true;
}
// if -x/-z option is selected set x/z it to its values
} else if(args[i].equalsIgnoreCase("-x") || args[i].equalsIgnoreCase("-xPos")) {