From d8fbd90c52f4863484fc7496d051b7249019aaed Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Apr 2015 23:42:55 +1000 Subject: [PATCH] Biome update --- .../listeners/worldedit/WESubscriber.java | 6 ++++ .../plot/util/MainUtil.java | 34 +++++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java index d8fc66a1a..402e6fd37 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java @@ -3,9 +3,12 @@ package com.intellectualcrafters.plot.listeners.worldedit; import java.util.HashSet; import com.intellectualcrafters.plot.PlotSquared; +import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RegionWrapper; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.extension.platform.Actor; @@ -29,6 +32,9 @@ public class WESubscriber { PlotPlayer player = UUIDHandler.getPlayer(actor.getName()); HashSet mask = WEManager.getMask(player); if (mask.size() == 0) { + if (Permissions.hasPermission(player, "plots.worldedit.bypass")) { + MainUtil.sendMessage(player, C.WORLDEDIT_BYPASS); + } event.setExtent(new NullExtent()); return; } 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 ed8b3d62c..319b80df4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -200,20 +200,25 @@ public class MainUtil { BlockUpdateUtil.setBlockManager.update(world, Arrays.asList(loc)); } -// public static void update(final Location loc) { -// final String world = loc.getWorld(); -// int ox = loc.getX() >> 4; -// int oz = loc.getZ() >> 4; -// final ArrayList chunks = new ArrayList<>(); -// final int distance = BukkitUtil.getViewDistance(); -// for (int cx = -distance; cx <= distance; cx++) { -// for (int cz = -distance; cz <= distance; cz++) { -// final ChunkLoc chunk = new ChunkLoc(ox + cx, oz + cz); -// chunks.add(chunk); -// } -// } -// BlockUpdateUtil.setBlockManager.update(world, chunks); -// } + public static void update(final Plot plot) { + Location bot = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); + Location top = getPlotBottomLoc(plot.world, plot.id); + + int bx = bot.getX() >> 4; + int bz = bot.getZ() >> 4; + + int tx = 1 + (top.getX() >> 4); + int tz = 1 + (top.getZ() >> 4); + + ArrayList chunks = new ArrayList<>(); + + for (int x = bx; x <= tx; x++) { + for (int z = bz; z <= tz; z++) { + chunks.add(new ChunkLoc(x, z)); + } + } + BlockUpdateUtil.setBlockManager.update(plot.world, chunks); + } public static void createWorld(final String world, final String generator) { } @@ -637,6 +642,7 @@ public class MainUtil { final int bottomZ = getPlotBottomLoc(world, plot.id).getZ() + 1; final int topZ = getPlotTopLoc(world, plot.id).getZ(); BukkitUtil.setBiome(world, bottomX, bottomZ, topX, topZ, biome); + update(plot); } public static int getHeighestBlock(final String world, final int x, final int z) {