diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java index aa8df7c35..968fa3448 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java @@ -138,7 +138,7 @@ public class PlayerFunctions { // System.out.print("SOUTH"); return null; } - PlotId id = new PlotId(dx,dz); + PlotId id = new PlotId(dx+1,dz+1); Plot plot = PlotMain.getPlots(loc.getWorld()).get(id); if (plot==null) { return id; diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java index a73bb11c3..076227631 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java @@ -477,7 +477,7 @@ public class PlotHelper { final World world = requester.getWorld(); final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1); final Location pos2 = getPlotTopLoc(world, plot.id); - + final short[] plotfloors = new short[plotworld.TOP_BLOCK.length]; final short[] plotfloors_data = new short[plotworld.TOP_BLOCK.length]; @@ -783,7 +783,7 @@ public class PlotHelper { public static Location getPlotTopLoc(World world, PlotId id) { Plot plot = PlotMain.getPlots(world).get(id); - if (id!=null) { + if (plot!=null) { id = PlayerFunctions.getTopPlot(world, plot).id; } PlotWorld plotworld = PlotMain.getWorldSettings(world); @@ -798,7 +798,7 @@ public class PlotHelper { public static Location getPlotBottomLoc(World world, PlotId id) { Plot plot = PlotMain.getPlots(world).get(id); - if (id!=null) { + if (plot!=null) { id = PlayerFunctions.getBottomPlot(world, plot).id; } PlotWorld plotworld = PlotMain.getWorldSettings(world); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java index 5c9b232d0..bac6f371f 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java @@ -11,6 +11,7 @@ package com.intellectualcrafters.plot.commands; import org.bukkit.entity.Player; +import com.intellectualcrafters.plot.C; import com.intellectualcrafters.plot.PlayerFunctions; import com.intellectualcrafters.plot.Plot; import com.intellectualcrafters.plot.PlotMain; @@ -32,6 +33,10 @@ public class Clear extends SubCommand { return true; } Plot plot = PlayerFunctions.getCurrentPlot(plr); + if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) { + PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + return true; + } boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true); if (result) { plot.clear(plr); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java index 1b791d83b..2595fdf8f 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java @@ -30,7 +30,7 @@ public enum Command { /** * */ - CLEAR("clear", "delete", new CommandPermission("plots.admin")), + CLEAR("clear", "delete", new CommandPermission("plots.clear")), /** * */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java index f23e4a79b..ed79cc7f9 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -246,7 +246,7 @@ public class PlayerEvents implements Listener { event.setCancelled(true); } } - if (PlayerFunctions.getPlot(event.getBlock().getLocation()).equals("road")) { + if (PlayerFunctions.getPlot(event.getBlock().getLocation())==null) { event.setCancelled(true); } } @@ -266,7 +266,7 @@ public class PlayerEvents implements Listener { event.setCancelled(true); } } - if (PlayerFunctions.getPlot(event.getBlockPlaced().getLocation()).equals("road")) { + if (PlayerFunctions.getPlot(event.getBlockPlaced().getLocation())==null) { event.setCancelled(true); } } @@ -483,7 +483,7 @@ public class PlayerEvents implements Listener { event.setCancelled(true); } } - if (PlayerFunctions.getPlot(event.getClickedBlock().getLocation()).equals("road")) { + if (PlayerFunctions.getPlot(event.getClickedBlock().getLocation())==null) { event.setCancelled(true); } } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java index 34c4b6589..3c059e95d 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java @@ -21,6 +21,7 @@ import com.intellectualcrafters.plot.Plot; import com.intellectualcrafters.plot.PlotHelper; import com.intellectualcrafters.plot.PlotId; import com.intellectualcrafters.plot.PlotMain; +import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent; /** * @@ -117,6 +118,7 @@ public class WorldEditListener implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerCommand(PlayerCommandPreprocessEvent e) { if (e.getPlayer().hasPermission("plots.worldedit.bypass")) { + PWE.removeMask(e.getPlayer()); return; } Player p = e.getPlayer(); @@ -136,6 +138,10 @@ public class WorldEditListener implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onInteract(PlayerInteractEvent e) { Player p = e.getPlayer(); + if (p.hasPermission("plots.worldedit.bypass")) { + PWE.removeMask(p); + return; + } if (!p.hasPermission("plots.admin") && isPlotWorld(p.getLocation())) { if (((e.getAction() == Action.LEFT_CLICK_BLOCK) || (e.getAction() == Action.RIGHT_CLICK_BLOCK)) && (p.getItemInHand() != null) && (p.getItemInHand().getType() != Material.AIR)) { Block b = e.getClickedBlock();