From d71ab93760dbe3892482f1bec566a966b8076ed8 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 23 Sep 2014 12:47:45 +1000 Subject: [PATCH] bug fixes --- .../intellectualcrafters/plot/PlotMain.java | 6 +- .../plot/WorldGenerator.java | 137 +++++++++--------- .../plot/commands/Set.java | 4 +- 3 files changed, 74 insertions(+), 73 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index 3059e3fd6..5899739c4 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -253,7 +253,7 @@ public class PlotMain extends JavaPlugin { public static boolean removePlot(String world, PlotId id) { PlotDeleteEvent event = new PlotDeleteEvent(world,id); Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if(event.isCancelled()) { event.setCancelled(true); return false; } @@ -294,7 +294,7 @@ public class PlotMain extends JavaPlugin { if (PlayerFunctions.hasExpired(plot)) { PlotDeleteEvent event = new PlotDeleteEvent(world,plot.id); Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if(event.isCancelled()) { event.setCancelled(true); } else { @@ -313,7 +313,7 @@ public class PlotMain extends JavaPlugin { if (PlayerFunctions.hasExpired(plot)) { PlotDeleteEvent event = new PlotDeleteEvent(world,plot.id); Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if(event.isCancelled()) { event.setCancelled(true); } else { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java index 2ff4140b7..09ae923b3 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java @@ -320,78 +320,79 @@ public class WorldGenerator extends ChunkGenerator { } // WALLS (16/16 cuboids) - - if (plotMinZ+1<=16) { - double start,end; - if (plotMinX+2<=16) - start = 16-plotMinX-1; - else - start = 16; - if (roadStartX-1<=16) - end = 16-roadStartX+1; - else - end = 0; - if (!(plotMinX+2<=16||roadStartX-1<=16)) { - start = 0; + if (pathsize>0) { + if (plotMinZ+1<=16) { + double start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + if (!(plotMinX+2<=16||roadStartX-1<=16)) { + start = 0; + } + setCuboidRegion(0, end, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wallfilling); + setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, wall); + setCuboidRegion(start, 16, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wallfilling); + setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, wall); } - setCuboidRegion(0, end, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wallfilling); - setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, wall); - setCuboidRegion(start, 16, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wallfilling); - setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, wall); - } - if (plotMinX+1<=16) { - double start,end; - if (plotMinZ+2<=16) - start = 16-plotMinZ-1; - else - start = 16; - if (roadStartZ-1<=16) - end = 16-roadStartZ+1; - else - end = 0; - if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { - start = 0; + if (plotMinX+1<=16) { + double start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { + start = 0; + } + setCuboidRegion( 16-plotMinX-1, 16-plotMinX, 1, wallheight+1,0, end, wallfilling); + setCuboidRegion( 16-plotMinX-1, 16-plotMinX,wallheight+1, wallheight+2, 0, end, wall); + setCuboidRegion(16-plotMinX-1, 16-plotMinX, 1, wallheight+1, start, 16, wallfilling); + setCuboidRegion( 16-plotMinX-1, 16-plotMinX, wallheight+1, wallheight+2,start, 16, wall); } - setCuboidRegion( 16-plotMinX-1, 16-plotMinX, 1, wallheight+1,0, end, wallfilling); - setCuboidRegion( 16-plotMinX-1, 16-plotMinX,wallheight+1, wallheight+2, 0, end, wall); - setCuboidRegion(16-plotMinX-1, 16-plotMinX, 1, wallheight+1, start, 16, wallfilling); - setCuboidRegion( 16-plotMinX-1, 16-plotMinX, wallheight+1, wallheight+2,start, 16, wall); - } - if (roadStartZ<=16&&roadStartZ>0) { - double start,end; - if (plotMinX+1<=16) - start = 16-plotMinX; - else - start = 16; - if (roadStartX<=16) - end = 16-roadStartX; - else - end = 0; - if (!(plotMinX+1<=16||roadStartX<=16)) { - start = 0; + if (roadStartZ<=16&&roadStartZ>0) { + double start,end; + if (plotMinX+1<=16) + start = 16-plotMinX; + else + start = 16; + if (roadStartX<=16) + end = 16-roadStartX; + else + end = 0; + if (!(plotMinX+1<=16||roadStartX<=16)) { + start = 0; + } + setCuboidRegion(0, end, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wallfilling); + setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, wall); + setCuboidRegion(start, 16, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wallfilling); + setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, wall); } - setCuboidRegion(0, end, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wallfilling); - setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, wall); - setCuboidRegion(start, 16, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wallfilling); - setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, wall); - } - if (roadStartX<=16&&roadStartX>0) { - double start,end; - if (plotMinZ+1<=16) - start = 16-plotMinZ; - else - start = 16; - if (roadStartZ+1<=16) - end = 16-roadStartZ+1; - else - end = 0; - if (!(plotMinZ+1<=16||roadStartZ+1<=16)) { - start = 0; + if (roadStartX<=16&&roadStartX>0) { + double start,end; + if (plotMinZ+1<=16) + start = 16-plotMinZ; + else + start = 16; + if (roadStartZ+1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+1<=16||roadStartZ+1<=16)) { + start = 0; + } + setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1,0, end, wallfilling); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, roadheight+2,0, end, wall); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1, start, 16,wallfilling); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, wallheight+2, start, 16, wall); } - setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1,0, end, wallfilling); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, roadheight+2,0, end, wall); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1, start, 16,wallfilling); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, wallheight+2, start, 16, wall); } return result; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java index 3e1117009..05d27d76a 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java @@ -103,7 +103,7 @@ public class Set extends SubCommand{ Flag flag = plot.settings.getFlag(args[1].toLowerCase()); PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag,plot); Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if(event.isCancelled()) { PlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED); event.setCancelled(true); return false; @@ -119,7 +119,7 @@ public class Set extends SubCommand{ Flag flag = new Flag(args[1], value); PlotFlagAddEvent event = new PlotFlagAddEvent(flag,plot); Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) { + if(event.isCancelled()) { PlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED); event.setCancelled(true); return false;