diff --git a/randomteleport-plugin/src/main/java/de/themoep/randomteleport/searcher/RandomSearcher.java b/randomteleport-plugin/src/main/java/de/themoep/randomteleport/searcher/RandomSearcher.java index 76a1b28..6cc9866 100644 --- a/randomteleport-plugin/src/main/java/de/themoep/randomteleport/searcher/RandomSearcher.java +++ b/randomteleport-plugin/src/main/java/de/themoep/randomteleport/searcher/RandomSearcher.java @@ -314,6 +314,11 @@ public class RandomSearcher { } do { + checks++; + if (checks >= maxTries) { + future.completeExceptionally(new NotFoundException("location")); + return; + } if (loadedOnly) { Chunk chunk = loadedChunks[random.nextInt(loadedChunks.length)]; randChunkX = chunk.getX(); @@ -322,11 +327,6 @@ public class RandomSearcher { randChunkX = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1); randChunkZ = (random.nextBoolean() ? 1 : -1) * random.nextInt(maxChunk + 1); } - checks++; - if (checks >= maxTries) { - future.completeExceptionally(new NotFoundException("location")); - return; - } } while (!checked.put(randChunkX, randChunkZ) || !inRadius(randChunkX, randChunkZ, minChunk, maxChunk)); randomLoc.setX(((center.getBlockX() >> 4) + randChunkX) * 16);