From 7ee1cf22277226b364a6e30b40a1265685556d62 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Thu, 17 Oct 2019 14:43:17 -0400 Subject: [PATCH] Correct check index printouts --- .../com/github/jikoo/regionerator/DeletionRunnable.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/jikoo/regionerator/DeletionRunnable.java b/src/main/java/com/github/jikoo/regionerator/DeletionRunnable.java index cd05c36..db371df 100644 --- a/src/main/java/com/github/jikoo/regionerator/DeletionRunnable.java +++ b/src/main/java/com/github/jikoo/regionerator/DeletionRunnable.java @@ -45,6 +45,7 @@ public class DeletionRunnable extends BukkitRunnable { @Override public void run() { if (index >= regions.length - 1) { + --index; plugin.getLogger().info("Regeneration cycle complete for " + getRunStats()); nextRun = System.currentTimeMillis() + plugin.getMillisecondsBetweenDeletionCycles(); this.cancel(); @@ -59,7 +60,7 @@ public void run() { ++index; plugin.debug(DebugLevel.HIGH, () -> String.format("Checking %s:%s (%s/%s)", - world.getName(), regions[index].getRegionFile().getName(), index, regions.length)); + world.getName(), regions[index].getRegionFile().getName(), index + 1, regions.length)); } if (!regions[index].isPopulated()) { @@ -96,13 +97,13 @@ public void run() { } } - if (index > 0 && index % 20 == 0) { + if (index > 0 && (index + 1) % 20 == 0) { plugin.debug(DebugLevel.LOW, this::getRunStats); } } String getRunStats() { - return String.format(STATS_FORMAT, world.getName(), index, regions.length, regionsDeleted, chunksDeleted); + return String.format(STATS_FORMAT, world.getName(), index + 1, regions.length, regionsDeleted, chunksDeleted); } long getNextRun() {