From c7fe57841b39f03de3133807bcbf9f89decec158 Mon Sep 17 00:00:00 2001 From: Roman Alexander Date: Mon, 9 Mar 2015 12:44:50 -0400 Subject: [PATCH] Need to use world folder container than getting the relative path. Nullpo protection. --- .../plot/util/bukkit/BukkitChunkManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index 93dbafc29..6d3fe9a2f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -62,10 +62,13 @@ public class BukkitChunkManager extends ChunkManager { @Override public ArrayList getChunkChunks(final String world) { - final String directory = new File(".").getAbsolutePath() + File.separator + world + File.separator + "region"; + final String directory = Bukkit.getWorldContainer() + File.separator + world + File.separator + "region"; final File folder = new File(directory); final File[] regionFiles = folder.listFiles(); final ArrayList chunks = new ArrayList<>(); + if (regionFiles == null) { + throw new RuntimeException("Could not find worlds folder."); + } for (final File file : regionFiles) { final String name = file.getName(); if (name.endsWith("mca")) {