diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index faead4fd6..e35e257ad 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.8.9 + 2.8.10 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index af0964ecb..afd1418e4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -275,7 +275,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager; try { new SendChunk(); - MainUtil.canSendChunk = true; + if (checkVersion(1, 7, 10) && !checkVersion(1, 7, 11)) { + MainUtil.canSendChunk = false; + } + else { + MainUtil.canSendChunk = true; + } } catch (final Throwable e) { MainUtil.canSendChunk = false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index ba67693d7..f49f80a5f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -666,6 +666,6 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper; */ public int getAllowedPlots(final Player player) { PlotPlayer pp = BukkitUtil.getPlayer(player); - return MainUtil.getAllowedPlots(pp, MainUtil.getPlayerPlotCount(player.getWorld().getName(), pp)); + return MainUtil.getAllowedPlots(pp); } } \ No newline at end of file diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 872675644..5aee193ad 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -62,7 +62,7 @@ public class Clear extends SubCommand { Runnable runnable = new Runnable() { @Override public void run() { - MainUtil.clear(world, plot, true, null); + MainUtil.clear(world, plot, plot.owner == null, null); PlotSquared.log("Plot " + plot.getId().toString() + " cleared."); } }; @@ -122,7 +122,7 @@ public class Clear extends SubCommand { @Override public void run() { final long start = System.currentTimeMillis(); - final boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() { + final boolean result = MainUtil.clearAsPlayer(plot, plot.owner == null, new Runnable() { @Override public void run() { MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start)); 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 0ee71ccab..4bdd53197 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -147,6 +147,9 @@ public class HybridPlotManager extends ClassicPlotManager { final int I = i; final int J = j; BukkitUtil.regenerateChunk(world, I / 16, J / 16); + if (!MainUtil.canSendChunk) { + BukkitUtil.refreshChunk(world, I / 16, J / 16); + } } } setWall(dpw, plot.id, new PlotBlock[] { wall }); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index c760f1a05..b4607df24 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -665,44 +665,6 @@ public class MainUtil { return getPlotHome(w, plot.id); } - /** - * Refresh the plot chunks - * - * @param world World in which the plot is located - * @param plot Plot Object - */ - public static void refreshPlotChunks(final String world, final Plot plot) { - final int bottomX = getPlotBottomLoc(world, plot.id).getX(); - final int topX = getPlotTopLoc(world, plot.id).getX(); - final int bottomZ = getPlotBottomLoc(world, plot.id).getZ(); - final int topZ = getPlotTopLoc(world, plot.id).getZ(); - final int minChunkX = (int) Math.floor((double) bottomX / 16); - final int maxChunkX = (int) Math.floor((double) topX / 16); - final int minChunkZ = (int) Math.floor((double) bottomZ / 16); - final int maxChunkZ = (int) Math.floor((double) topZ / 16); - final ArrayList chunks = new ArrayList<>(); - for (int x = minChunkX; x <= maxChunkX; x++) { - for (int z = minChunkZ; z <= maxChunkZ; z++) { - if (canSendChunk) { - final ChunkLoc chunk = new ChunkLoc(x, z); - chunks.add(chunk); - } else { - BukkitUtil.refreshChunk(world, x, z); - } - } - } - try { - SendChunk.sendChunk(world, chunks); - } catch (final Throwable e) { - canSendChunk = false; - for (int x = minChunkX; x <= maxChunkX; x++) { - for (int z = minChunkZ; z <= maxChunkZ; z++) { - BukkitUtil.refreshChunk(world, x, z); - } - } - } - } - /** * Gets the top plot location of a plot (all plots are treated as small plots) - To get the top loc of a mega plot * use getPlotTopLoc(...) 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 1732a9010..3b8f20348 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 @@ -145,8 +145,10 @@ public class BukkitUtil extends BlockManager { } } - public static void refreshChunk(final String world, final int x, final int z) { - getWorld(world).refreshChunk(x, z); + public static void refreshChunk(final String name, final int x, final int z) { + World world = getWorld(name); + world.unloadChunk(x, z); + world.loadChunk(x, z); } public static void regenerateChunk(final String world, final int x, final int z) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java index d62ac9b62..ddca18980 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java @@ -90,7 +90,8 @@ public class SetBlockFast extends BukkitSetBlockManager { if (!MainUtil.canSendChunk) { final World world = chunks.get(0).getWorld(); for (final Chunk chunk : chunks) { - world.refreshChunk(chunk.getX(), chunk.getZ()); + world.unloadChunk(chunk); + world.loadChunk(chunk); } return; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java index 7dfca58dc..2d86c5cb0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java @@ -294,7 +294,8 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { if (!MainUtil.canSendChunk) { final World world = chunks.get(0).getWorld(); for (final Chunk chunk : chunks) { - world.refreshChunk(chunk.getX(), chunk.getZ()); + world.unloadChunk(chunk); + world.loadChunk(chunk); } return; }