Fix ArrayOutOfBoundsException in getSpawn

This commit is contained in:
Xephi 2014-08-25 03:31:55 +02:00
parent 3f58dd54dd
commit 0b1b6617eb

View File

@ -608,14 +608,8 @@ public class AuthMe extends JavaPlugin {
public Location getSpawnLocation(Player player) {
World world = player.getWorld();
String[] spawnPriority = Settings.spawnPriority.split(",");
if (spawnPriority.length < 4) {
ConsoleLogger.showError("Check your config for spawnPriority, you need to put all of 4 spawn priorities");
ConsoleLogger.showError("Defaulting Spawn to world's one");
return world.getSpawnLocation();
}
Location spawnLoc = world.getSpawnLocation();
int i = 3;
for (i = 3; i >= 0; i--) {
for (int i = spawnPriority.length - 1; i >= 0; i--) {
String s = spawnPriority[i];
if (s.equalsIgnoreCase("default") && getDefaultSpawn(world) != null)
spawnLoc = getDefaultSpawn(world);