This commit is contained in:
boy0001 2014-09-25 23:30:26 +10:00
parent 1d1834699a
commit 5d0f377d3b
6 changed files with 19 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -30,7 +30,7 @@ public enum Command {
/**
*
*/
CLEAR("clear", "delete", new CommandPermission("plots.admin")),
CLEAR("clear", "delete", new CommandPermission("plots.clear")),
/**
*
*/

View File

@ -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);
}
}

View File

@ -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();