diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java new file mode 100644 index 000000000..12d78baa0 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java @@ -0,0 +1,131 @@ +package com.intellectualcrafters.plot.generator; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.plugin.Plugin; + +import com.intellectualcrafters.plot.BukkitMain; +import com.intellectualcrafters.plot.PlotSquared; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.util.AChunkManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import com.intellectualcrafters.plot.util.bukkit.ChunkManager; +import com.intellectualcrafters.plot.util.bukkit.SetBlockManager; + +public class BukkitHybridUtils extends HybridUtils { + + @Override + public int checkModified(int threshhold, String worldname, int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock[] blocks) { + World world = BukkitUtil.getWorld(worldname); + int count = 0; + for (int y = y1; y <= y2; y++) { + for (int x = x1; x <= x2; x++) { + for (int z = z1; z <= z2; z++) { + final Block block = world.getBlockAt(x, y, z); + final int id = block.getTypeId(); + boolean same = false; + for (final PlotBlock p : blocks) { + if (id == p.id) { + same = true; + break; + } + } + if (!same) { + count++; + if (count > threshhold) { + return -1; + } + } + } + } + } + return count; + } + + @Override + public int get_ey(String worldname, int sx, int ex, int sz, int ez, int sy) { + World world = BukkitUtil.getWorld(worldname); + int maxY = world.getMaxHeight(); + int ey = sy; + for (int x = sx; x <= ex; x++) { + for (int z = sz; z <= ez; z++) { + for (int y = sy; y < maxY; y++) { + if (y > ey) { + final Block block = world.getBlockAt(x, y, z); + if (block.getTypeId() != 0) { + ey = y; + } + } + } + } + } + return ey; + } + + @Override + public void regenerateChunkChunk(String worldname, ChunkLoc loc) { + World world = BukkitUtil.getWorld(worldname); + final int sx = loc.x << 5; + final int sz = loc.z << 5; + for (int x = sx; x < (sx + 32); x++) { + for (int z = sz; z < (sz + 32); z++) { + final Chunk chunk = world.getChunkAt(x, z); + chunk.load(false); + } + } + final ArrayList chunks2 = new ArrayList<>(); + for (int x = sx; x < (sx + 32); x++) { + for (int z = sz; z < (sz + 32); z++) { + final Chunk chunk = world.getChunkAt(x, z); + chunks2.add(chunk); + regenerateRoad(worldname, new ChunkLoc(x,z)); + } + } + SetBlockManager.setBlockManager.update(chunks2); + } + + private static boolean UPDATE = false; + private int task; + + @Override + public boolean scheduleRoadUpdate(final String world) { + if (BukkitHybridUtils.UPDATE) { + return false; + } + final List chunks = AChunkManager.manager.getChunkChunks(world); + final Plugin plugin = (Plugin) BukkitMain.THIS; + this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { + @Override + public void run() { + if (chunks.size() == 0) { + BukkitHybridUtils.UPDATE = false; + PlotSquared.log(C.PREFIX.s() + "Finished road conversion"); + Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task); + return; + } else { + try { + final ChunkLoc loc = chunks.get(0); + PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)"); + PlotSquared.log("Remaining regions: " + chunks.size()); + regenerateChunkChunk(world, loc); + chunks.remove(0); + } catch (final Exception e) { + final ChunkLoc loc = chunks.get(0); + PlotSquared.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); + PlotSquared.log("&d - Potentially skipping 256 chunks"); + PlotSquared.log("&d - TODO: recommend chunkster if corrupt"); + } + } + } + }, 20, 20); + return true; + } + +} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java index dce6340fc..098a8cc3c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -44,207 +44,6 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @SuppressWarnings("deprecation") public class HybridPlotManager extends ClassicPlotManager { - private static boolean UPDATE = false; - private int task; - - public static boolean checkModified(final Plot plot, int requiredChanges) { - final Location bottom = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); - final Location top = MainUtil.getPlotTopLoc(plot.world, plot.id); - final int botx = bottom.getX(); - final int botz = bottom.getZ(); - final int topx = top.getX(); - final int topz = top.getZ(); - final HybridPlotWorld hpw = (HybridPlotWorld) PlotSquared.getPlotWorld(plot.world); - final PlotBlock[] air = new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) }; - int changes = checkModified(requiredChanges, plot.world, botx, topx, hpw.PLOT_HEIGHT, hpw.PLOT_HEIGHT, botz, topz, hpw.TOP_BLOCK); - if (changes == -1) { - return true; - } - requiredChanges -= changes; - changes = checkModified(requiredChanges, plot.world, botx, topx, hpw.PLOT_HEIGHT + 1, hpw.PLOT_HEIGHT + 1, botz, topz, air); - if (changes == -1) { - return true; - } - requiredChanges -= changes; - changes = checkModified(requiredChanges, plot.world, botx, topx, hpw.PLOT_HEIGHT + 2, BukkitUtil.getMaxHeight(plot.world) - 1, botz, topz, air); - if (changes == -1) { - return true; - } - requiredChanges -= changes; - changes = checkModified(requiredChanges, plot.world, botx, topx, 1, hpw.PLOT_HEIGHT - 1, botz, topz, hpw.MAIN_BLOCK); - return changes == -1; - } - - public static int checkModified(final int threshhold, final String world, final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks) { - int count = 0; - for (int y = y1; y <= y2; y++) { - for (int x = x1; x <= x2; x++) { - for (int z = z1; z <= z2; z++) { - final Block block = world.getBlockAt(x, y, z); - final int id = block.getTypeId(); - boolean same = false; - for (final PlotBlock p : blocks) { - if (id == p.id) { - same = true; - break; - } - } - if (!same) { - count++; - if (count > threshhold) { - return -1; - } - } - } - } - } - return count; - } - - public boolean setupRoadSchematic(final Plot plot) { - final String world = plot.world; - final Location bot = MainUtil.getPlotBottomLoc(world, plot.id); - final Location top = MainUtil.getPlotTopLoc(world, plot.id); - final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getPlotWorld(world); - final int sx = (bot.getX() - plotworld.ROAD_WIDTH) + 1; - final int sz = bot.getZ() + 1; - final int sy = plotworld.ROAD_HEIGHT; - final int ex = bot.getX(); - final int ez = top.getZ(); - final int ey = get_ey(world, sx, ex, sz, ez, sy); - final Location pos1 = new Location(world, sx, sy, sz); - final Location pos2 = new Location(world, ex, ey, ez); - final int bx = sx; - final int bz = sz - plotworld.ROAD_WIDTH; - final int by = sy; - final int tx = ex; - final int tz = sz - 1; - final int ty = get_ey(world, bx, tx, bz, tz, by); - final Location pos3 = new Location(world, bx, by, bz); - final Location pos4 = new Location(world, tx, ty, tz); - final CompoundTag sideroad = SchematicHandler.getCompoundTag(world, pos1, pos2); - final CompoundTag intersection = SchematicHandler.getCompoundTag(world, pos3, pos4); - final String dir = PlotSquared.IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.world + File.separator; - SchematicHandler.save(sideroad, dir + "sideroad.schematic"); - SchematicHandler.save(intersection, dir + "intersection.schematic"); - plotworld.ROAD_SCHEMATIC_ENABLED = true; - plotworld.setupSchematics(); - return true; - } - - public int get_ey(final String world, final int sx, final int ex, final int sz, final int ez, final int sy) { - int ey = sy; - for (int x = sx; x <= ex; x++) { - for (int z = sz; z <= ez; z++) { - for (int y = sy; y < maxY; y++) { - if (y > ey) { - final Block block = world.getBlockAt(x, y, z); - if (block.getTypeId() != 0) { - ey = y; - } - } - } - } - } - return ey; - } - - public void regenerateChunkChunk(final String world, final ChunkLoc loc) { - final int sx = loc.x << 5; - final int sz = loc.z << 5; - for (int x = sx; x < (sx + 32); x++) { - for (int z = sz; z < (sz + 32); z++) { - final Chunk chunk = world.getChunkAt(x, z); - chunk.load(false); - } - } - final ArrayList chunks2 = new ArrayList<>(); - for (int x = sx; x < (sx + 32); x++) { - for (int z = sz; z < (sz + 32); z++) { - final Chunk chunk = world.getChunkAt(x, z); - chunks2.add(chunk); - regenerateRoad(chunk); - } - } - SetBlockManager.setBlockManager.update(chunks2); - } - - public boolean scheduleRoadUpdate(final String world) { - if (HybridPlotManager.UPDATE) { - return false; - } - final ArrayList chunks = ChunkManager.getChunkChunks(world); - final Plugin plugin = (Plugin) PlotSquared.getMain(); - this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { - @Override - public void run() { - if (chunks.size() == 0) { - HybridPlotManager.UPDATE = false; - PlotSquared.log(C.PREFIX.s() + "Finished road conversion"); - Bukkit.getScheduler().cancelTask(HybridPlotManager.this.task); - return; - } else { - try { - final ChunkLoc loc = chunks.get(0); - PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)"); - PlotSquared.log("Remaining regions: " + chunks.size()); - regenerateChunkChunk(world, loc); - chunks.remove(0); - } catch (final Exception e) { - final ChunkLoc loc = chunks.get(0); - PlotSquared.log("&c[ERROR]&7 Could not update '" + world.getName() + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); - PlotSquared.log("&d - Potentially skipping 256 chunks"); - PlotSquared.log("&d - TODO: recommend chunkster if corrupt"); - } - } - } - }, 20, 20); - return true; - } - - @Override - public boolean finishPlotUnlink(final PlotWorld plotworld, final ArrayList plotIds) { - final HybridPlotWorld hpw = (HybridPlotWorld) plotworld; - if (hpw.ROAD_SCHEMATIC_ENABLED) { - for (final PlotId id : plotIds) { - final Location bottom = getPlotBottomLocAbs(plotworld, id); - final int sx = bottom.getX() - hpw.PATH_WIDTH_LOWER; - final int sz = bottom.getZ() - hpw.PATH_WIDTH_LOWER; - final int sy = hpw.ROAD_HEIGHT; - for (final ChunkLoc loc : hpw.G_SCH.keySet()) { - final HashMap blocks = hpw.G_SCH.get(loc); - final HashMap datas = hpw.G_SCH_DATA.get(loc); - if (datas == null) { - for (final Short y : blocks.keySet()) { - MainUtil.setBlock(world, sx + loc.x, sy + y, sz + loc.z, blocks.get(y), (byte) 0); - } - } else { - for (final Short y : blocks.keySet()) { - Byte data = datas.get(y); - if (data == null) { - data = 0; - } - MainUtil.setBlock(world, sx + loc.x, sy + y, sz + loc.z, blocks.get(y), data); - } - } - } - } - } - final PlotBlock block = ((ClassicPlotWorld) plotworld).WALL_BLOCK; - if (block.id != 0) { - for (final PlotId id : plotIds) { - setWall(world, plotworld, id, new PlotBlock[] { ((ClassicPlotWorld) plotworld).WALL_BLOCK }); - final Plot plot = MainUtil.getPlot(world, id); - if (plot.hasOwner()) { - final String name = UUIDHandler.getName(plot.owner); - if (name != null) { - MainUtil.setSign(world, name, plot); - } - } - } - } - return true; - } /** * Clearing the plot needs to only consider removing the blocks - This implementation has used the SetCuboid @@ -256,13 +55,12 @@ public class HybridPlotManager extends ClassicPlotManager { public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) { final String world = plotworld.worldname; MainUtil.runners.put(plot, 1); - final Plugin plugin = PlotSquared.getMain(); TaskManager.runTaskLater(new Runnable() { @Override public void run() { MainUtil.runners.remove(plot); } - }, 90L); + }, 90); final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld); final Location pos1 = MainUtil.getPlotBottomLocAbs(world, plot.id).add(1, 0, 1); final Location pos2 = MainUtil.getPlotTopLocAbs(world, plot.id); @@ -276,17 +74,12 @@ public class HybridPlotManager extends ClassicPlotManager { wall = dpw.CLAIMED_WALL_BLOCK; } final PlotBlock wall_filling = dpw.WALL_FILLING; - final Block block = world.getBlockAt(new Location(world, pos1.getX() - 1, 1, pos1.getZ())); - if ((block.getTypeId() != wall_filling.id) || (block.getData() != wall_filling.data)) { - setWallFilling(world, dpw, plot.id, new PlotBlock[] { wall_filling }); - } + setWallFilling(dpw, plot.id, new PlotBlock[] { wall_filling }); + final int maxy = BukkitUtil.getMaxHeight(world); TaskManager.runTaskLater(new Runnable() { @Override public void run() { - final Block block = world.getBlockAt(new Location(world, pos1.getX() - 1, dpw.WALL_HEIGHT + 1, pos1.getZ())); - if ((block.getTypeId() != wall.id) || (block.getData() != wall.data)) { - setWall(world, dpw, plot.id, new PlotBlock[] { wall }); - } + setWall(dpw, plot.id, new PlotBlock[] { wall }); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -295,7 +88,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT + 1, pos1.getZ()), new Location(world, pos2.getX() + 1, world.getMaxHeight() + 1, pos2.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT + 1, pos1.getZ()), new Location(world, pos2.getX() + 1, maxy + 1, pos2.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -305,11 +98,11 @@ public class HybridPlotManager extends ClassicPlotManager { public void run() { MainUtil.setCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT, pos1.getZ()), new Location(world, pos2.getX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getZ() + 1), plotfloor); } - }, 5L); + }, 5); } - }, 5L); + }, 5); } - }, 5L); + }, 5); return; } final int startX = (pos1.getX() / 16) * 16; @@ -352,7 +145,7 @@ public class HybridPlotManager extends ClassicPlotManager { } else if ((mx.getZ() < (j + 15)) || (mx.getX() < (i + 15))) { mx = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ)); } - world.regenerateChunk(i / 16, j / 16); + BukkitUtil.regenerateChunk(world, i / 16, j / 16); } } final Location max = mx; @@ -362,7 +155,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT + 1, pos1.getZ()), new Location(world, pos2.getX() + 1, world.getMaxHeight() + 1, pos2.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT + 1, pos1.getZ()), new Location(world, pos2.getX() + 1, maxy + 1, pos2.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -372,11 +165,11 @@ public class HybridPlotManager extends ClassicPlotManager { public void run() { MainUtil.setCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT, pos1.getZ()), new Location(world, pos2.getX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getZ() + 1), plotfloor); } - }, 5L); + }, 5); } - }, 5L); + }, 5); } - }, 5L); + }, 5); return; } else { if (min.getX() < plotMinX) { @@ -398,7 +191,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, min.getX() + 1, world.getMaxHeight() + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, min.getX() + 1, maxy + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -422,7 +215,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, min.getX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, max.getX() + 1, world.getMaxHeight() + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, min.getX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, max.getX() + 1, maxy + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -438,7 +231,7 @@ public class HybridPlotManager extends ClassicPlotManager { } }, 1); } - }, 25L); + }, 25); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -446,7 +239,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, plotMaxX + 1, maxy + 1, min.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -462,7 +255,7 @@ public class HybridPlotManager extends ClassicPlotManager { } }, 1); } - }, 29L); + }, 29); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -470,7 +263,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, min.getZ()), new Location(world, min.getX() + 1, world.getMaxHeight() + 1, max.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, min.getZ()), new Location(world, min.getX() + 1, maxy + 1, max.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -486,7 +279,7 @@ public class HybridPlotManager extends ClassicPlotManager { } }, 1); } - }, 33L); + }, 33); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -494,7 +287,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, min.getX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, min.getX() + 1, maxy + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -510,7 +303,7 @@ public class HybridPlotManager extends ClassicPlotManager { } }, 1); } - }, 37L); + }, 37); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -518,7 +311,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, min.getX(), dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, max.getX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, min.getX(), dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, max.getX() + 1, maxy + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -542,7 +335,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, min.getZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, max.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, min.getZ()), new Location(world, plotMaxX + 1, maxy + 1, max.getZ() + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -566,7 +359,7 @@ public class HybridPlotManager extends ClassicPlotManager { TaskManager.runTaskLater(new Runnable() { @Override public void run() { - MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); + MainUtil.setSimpleCuboid(world, new Location(world, max.getX(), dpw.PLOT_HEIGHT + 1, max.getZ()), new Location(world, plotMaxX + 1, maxy + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0)); TaskManager.runTaskLater(new Runnable() { @Override public void run() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java index c47cc2977..b26fb18dd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java @@ -18,6 +18,8 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public abstract class HybridUtils { + public static HybridUtils manager = new BukkitHybridUtils(); + public boolean checkModified(final Plot plot, int requiredChanges) { final Location bottom = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); final Location top = MainUtil.getPlotTopLoc(plot.world, plot.id); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java index a8dfe151e..d2fb33be9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java @@ -116,6 +116,10 @@ public class BukkitUtil extends BlockManager { getWorld(world).refreshChunk(x, z); } + public static void regenerateChunk(final String world, final int x, final int z) { + getWorld(world).regenerateChunk(x, z); + } + public static PlotBlock getBlock(final Location loc) { final World world = getWorld(loc.getWorld()); final Block block = world.getBlockAt(loc.getX(), loc.getY(), loc.getZ());