diff --git a/PlotSquared/src/com/intellectualcrafters/plot/SetBlockFast.java b/PlotSquared/src/com/intellectualcrafters/plot/SetBlockFast.java index f9279dae4..be4b4f166 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/SetBlockFast.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/SetBlockFast.java @@ -2,6 +2,8 @@ package com.intellectualcrafters.plot; import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass; +import org.bukkit.Bukkit; + import com.intellectualcrafters.plot.ReflectionUtils.RefClass; import com.intellectualcrafters.plot.ReflectionUtils.RefMethod; @@ -40,8 +42,9 @@ public class SetBlockFast { } public static void update(org.bukkit.entity.Player player) { - for (int cx = -8; cx < 8; cx++) { - for (int cz = -8; cz < 8; cz++) { + int distance = Bukkit.getViewDistance()+1; + for (int cx = -distance; cx < distance; cx++) { + for (int cz = -distance; cz < distance; cz++) { player.getWorld().refreshChunk(player.getLocation().getChunk().getX() + cx, player.getLocation().getChunk().getZ() + cz); } } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/events/PlotClearEvent.java b/PlotSquared/src/com/intellectualcrafters/plot/events/PlotClearEvent.java new file mode 100644 index 000000000..331a10195 --- /dev/null +++ b/PlotSquared/src/com/intellectualcrafters/plot/events/PlotClearEvent.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) IntellectualCrafters - 2014. + * You are not allowed to distribute and/or monetize any of our intellectual property. + * IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB. + * + * >> File = PlotClearEvent.java + * >> Generated by: Citymonstret at 2014-08-09 15:21 + */ + +package com.intellectualcrafters.plot.events; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.intellectualcrafters.plot.PlotId; + +/** + * Called when a plot is cleared + */ +public class PlotClearEvent extends Event implements Cancellable { + private static HandlerList handlers = new HandlerList(); + private boolean cancelled; + + private PlotId id; + private String world; + /** + * PlotDeleteEvent: Called when a plot is cleared + * @param world + * @param id + */ + public PlotClearEvent(String world, PlotId id) { + this.id = id; + this.world = world; + } + + /** + * Get the PlotId + * @return PlotId + */ + public PlotId getPlotId() { + return this.id; + } + + /** + * Get the world name + * @return String + */ + public String getWorld() { + return this.world; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + @Override + public boolean isCancelled() { + return this.cancelled; + } + + @Override + public void setCancelled(boolean b) { + this.cancelled = b; + } +} diff --git a/PlotSquared/src/com/intellectualcrafters/plot/events/PlotDeleteEvent.java b/PlotSquared/src/com/intellectualcrafters/plot/events/PlotDeleteEvent.java index ab1e021e4..9828543b7 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/events/PlotDeleteEvent.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/events/PlotDeleteEvent.java @@ -3,7 +3,7 @@ * You are not allowed to distribute and/or monetize any of our intellectual property. * IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB. * - * >> File = PlayerClaimPlotEvent.java + * >> File = PlotDeleteEvent.java * >> Generated by: Citymonstret at 2014-08-09 15:21 */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java index 543c89916..379d58189 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java @@ -57,7 +57,7 @@ public class WorldEditListener implements Listener { } Plot plot = PlotHelper.getCurrentPlot(b.getLocation()); if (plot != null) { - if ((plot != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) { + if ((plot != null) && plot.hasOwner() && plot.helpers!=null && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) { PWE.setMask(p, l); } }