This commit is contained in:
boy0001 2015-02-01 09:45:13 +11:00
parent 646049594c
commit bbca07b9d7
2 changed files with 29 additions and 29 deletions

View File

@ -278,7 +278,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (PlotMain.hasPermission(event.getPlayer(), "plots.admin.destroy.road")) { if (PlotMain.hasPermission(event.getPlayer(), "plots.admin.destroy.road")) {
return; return;
} }
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.road"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.road");
event.setCancelled(true); event.setCancelled(true);
} }
@ -304,12 +304,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
} }
if (isCluster(loc)) { event.setCancelled(true); } if (isPlotArea(loc)) { event.setCancelled(true); }
else { else {
Iterator<Block> iter = event.blockList().iterator(); Iterator<Block> iter = event.blockList().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Block b = iter.next(); Block b = iter.next();
if (isCluster(loc)) { if (isPlotArea(loc)) {
iter.remove(); iter.remove();
} }
} }
@ -345,7 +345,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotMain.hasPermission(p, "plots.admin.build.other")) {
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true); event.setCancelled(true);
} }
@ -362,7 +362,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if ((!(e.getEntity() instanceof Player))) { if ((!(e.getEntity() instanceof Player))) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
@ -372,7 +372,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -383,7 +383,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -394,7 +394,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -405,7 +405,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -416,7 +416,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -427,7 +427,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -437,7 +437,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isInPlot(e.getBlock().getLocation())) { if (isInPlot(e.getBlock().getLocation())) {
for (final Block block : e.getBlocks()) { for (final Block block : e.getBlocks()) {
if (!isInPlot(block.getLocation())) { if (!isInPlot(block.getLocation())) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -449,7 +449,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Location loc = b.getLocation(); Location loc = b.getLocation();
if (isPlotWorld(loc) && (e.getBlock().getType() == Material.PISTON_STICKY_BASE)) { if (isPlotWorld(loc) && (e.getBlock().getType() == Material.PISTON_STICKY_BASE)) {
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(e.getBlock().getLocation())) { e.setCancelled(true); } if (isPlotArea(e.getBlock().getLocation())) { e.setCancelled(true); }
} }
} }
} }
@ -463,7 +463,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
remove = true; remove = true;
Location loc = blocks.get(i).getLocation(); Location loc = blocks.get(i).getLocation();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(loc)) { e.getBlocks().remove(i); } if (isPlotArea(loc)) { e.getBlocks().remove(i); }
} }
} }
} }
@ -509,7 +509,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (PlotMain.hasPermission(player, "plots.admin.interact.road")) { if (PlotMain.hasPermission(player, "plots.admin.interact.road")) {
return; return;
} }
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.road"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.road");
event.setCancelled(true); event.setCancelled(true);
} }
@ -535,7 +535,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
Location loc = event.getLocation(); Location loc = event.getLocation();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (isCluster(loc)) { event.setCancelled(true); } if (isPlotArea(loc)) { event.setCancelled(true); }
} }
} }
@ -579,7 +579,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotMain.hasPermission(p, "plots.admin.build.other")) {
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -587,7 +587,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
} else { } else {
if (isCluster(loc)) { e.setCancelled(true); } if (isPlotArea(loc)) { e.setCancelled(true); }
} }
} }
} }
@ -650,7 +650,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (PlotMain.hasPermission(p, "plots.admin.build.other")) { if (PlotMain.hasPermission(p, "plots.admin.build.other")) {
return; return;
} }
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -714,7 +714,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (PlotMain.hasPermission(p, "plots.admin.build.other")) { if (PlotMain.hasPermission(p, "plots.admin.build.other")) {
return; return;
} }
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -746,7 +746,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotMain.hasPermission(p, "plots.admin.build.other")) {
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -780,7 +780,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.destroy.other")) { if (!PlotMain.hasPermission(p, "plots.admin.destroy.other")) {
if (isCluster(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -823,7 +823,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.interact.other")) { if (!PlotMain.hasPermission(p, "plots.admin.interact.other")) {
if (isCluster(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -861,7 +861,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.vehicle.break.other")) { if (!PlotMain.hasPermission(p, "plots.admin.vehicle.break.other")) {
if (isCluster(l)) { if (isPlotArea(l)) {
e.setCancelled(true); e.setCancelled(true);
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
} }
@ -918,7 +918,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.pve.other")) { if (!PlotMain.hasPermission(p, "plots.admin.pve.other")) {
if (isCluster(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other");
e.setCancelled(true); e.setCancelled(true);
} }
@ -948,7 +948,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.projectile.other")) { if (!PlotMain.hasPermission(p, "plots.admin.projectile.other")) {
if (isCluster(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other");
e.setHatching(false); e.setHatching(false);
} }
@ -989,7 +989,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!PlotMain.hasPermission(player, "plots.admin.build.road")) { if (!PlotMain.hasPermission(player, "plots.admin.build.road")) {
if (isCluster(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road");
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -89,12 +89,12 @@ import com.sk89q.worldguard.protection.flags.BooleanFlag;
return PlotMain.isPlotWorld(world); return PlotMain.isPlotWorld(world);
} }
public static boolean isCluster(Location location) { public static boolean isPlotArea(Location location) {
PlotWorld plotworld = PlotMain.getWorldSettings(location.getWorld()); PlotWorld plotworld = PlotMain.getWorldSettings(location.getWorld());
if (plotworld.REQUIRE_CLUSTER) { if (plotworld.REQUIRE_CLUSTER) {
return ClusterManager.getCluster(location) != null; return ClusterManager.getCluster(location) != null;
} }
return false; return true;
} }
public static PlotWorld getPlotWorld(final World world) { public static PlotWorld getPlotWorld(final World world) {