diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
index 1af690dde..497bd54c0 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
@@ -9,6 +9,7 @@
package com.intellectualcrafters.plot;
+import com.google.common.collect.SetMultimap;
import com.intellectualcrafters.plot.database.DBFunc;
import com.sk89q.worldedit.blocks.ClothColor.ID;
@@ -27,8 +28,8 @@ import java.util.*;
*
*/
public class PlotHelper {
- static boolean canSetFast = false;
- static long state;
+ public static boolean canSetFast = false;
+ static long state = 1;
/**
*
@@ -36,6 +37,15 @@ public class PlotHelper {
* @param blocks_per_second
* @return
*/
+ public PlotHelper() {
+ try {
+ new SetBlockFast();
+ canSetFast = true;
+ } catch (Exception e) {
+ canSetFast = false;
+ }
+ }
+
private static double calculateNeededTime(double blocks, double blocks_per_second) {
return (blocks / blocks_per_second);
}
@@ -60,83 +70,26 @@ public class PlotHelper {
return id;
}
-
/**
- * TODO auto plot merging
- * Merges a set of plots with another set.
+ * Completely merges a set of plots
+ * (There are no checks to make sure you supply the correct arguments)
* - Misuse of this method can result in unusable plots
- * - currentMegaPlots must be a single plot, or a set of already merged plots
- * - toMerge must be a list of unmerged plots
- * - the resultant mega plot must be rectangular
- * - the plot arrays must be sorted in ascending order
+ * - the set of plots must belong to one owner and be rectangular
+ * - the plot array must be sorted in ascending order
* - Road will be removed where required
+ * - changes will be saved to DB
* @param world
- * @param player
- * @param currentMegaPlots
- * @param toMerge
- * @param dir1
- * @param dir2
- * @return
+ * @param plotIds
+ * @return boolean (success)
*/
- public static boolean mergePlot(World world, Player player, ArrayList currentMegaPlots, ArrayList toMerge, int dir1, int dir2) {
-
- Location pos1 = PlotHelper.getPlotBottomLoc(world, currentMegaPlots.get(0)).add(1,0,1);
- Location pos2 = PlotHelper.getPlotTopLoc(world, currentMegaPlots.get(currentMegaPlots.size()-1));
-
- for (int i = 0;i < toMerge.size(); i++) {
- PlotId plotid = toMerge.get(i);
- Plot plot = PlotMain.getPlots(world).get(plotid);
- if (i plotIds) {
PlotWorld plotworld = PlotMain.getWorldSettings(world);
-
- int sx,sz,ex,ez;
-
- if (dir1 == 0 || dir1 == 3) {
- sx = Math.min(pos1.getBlockX(),pos2.getBlockX());
- ex = Math.max(pos3.getBlockX(),pos4.getBlockX());
- sz = Math.min(pos1.getBlockZ(),pos2.getBlockZ());
- ez = Math.max(pos3.getBlockZ(),pos4.getBlockZ());
+ int pathsize = plotworld.ROAD_WIDTH;
+ int plotheight = plotworld.PLOT_HEIGHT;
+
+ if (plotIds.size()<2) {
+ return false;
}
- else {
- sx = Math.max(pos1.getBlockX(),pos2.getBlockX());
- ex = Math.min(pos3.getBlockX(),pos4.getBlockX());
- sz = Math.max(pos1.getBlockZ(),pos2.getBlockZ());
- ez = Math.min(pos3.getBlockZ(),pos4.getBlockZ());
- }
-
-
-
- int startx = Math.min(sx,ex);
- int startz = Math.min(sz,ez);
- int endx = Math.max(sx,ex)+1;
- int endz = Math.max(sz,ez)+1;
final short[] plotfloors = new short[plotworld.TOP_BLOCK.length];
final short[] plotfloors_data = new short[plotworld.TOP_BLOCK.length];
@@ -145,38 +98,80 @@ public class PlotHelper {
final short[] filling_data = new short[plotworld.MAIN_BLOCK.length];
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++) {
- short[] result = PlotHelper.getBlock(plotworld.TOP_BLOCK[i]);
+ short[] result = getBlock(plotworld.TOP_BLOCK[i]);
plotfloors[i] = result[0];
plotfloors_data[i] = result[1];
}
for (int i = 0; i < plotworld.MAIN_BLOCK.length; i++) {
- short[] result = PlotHelper.getBlock(plotworld.MAIN_BLOCK[i]);
+ short[] result = getBlock(plotworld.MAIN_BLOCK[i]);
filling[i] = result[0];
filling_data[i] = result[1];
}
- PlotHelper.setSimpleCuboid(world, new Location(world, startx, 0, startz), new Location(world, endx, 1, endz), (short) 7);
- PlotHelper.setSimpleCuboid(world, new Location(world, startx, plotworld.PLOT_HEIGHT + 1, startz), new Location(world, endx, world.getMaxHeight(), endz), (short) 0);
- PlotHelper.setCuboid(world, new Location(world, startx, 1, startz), new Location(world, endx, plotworld.PLOT_HEIGHT, endz), filling, filling_data);
- PlotHelper.setCuboid(world, new Location(world, startx, plotworld.PLOT_HEIGHT, startz), new Location(world, endx, plotworld.PLOT_HEIGHT + 1, endz), plotfloors, plotfloors_data);
+ PlotId pos1 = plotIds.get(0);
+ PlotId pos2 = plotIds.get(plotIds.size()-1);
- pos1 = PlotHelper.getPlotBottomLoc(world, currentMegaPlots.get(0));
- pos2 = PlotHelper.getPlotTopLoc(world, currentMegaPlots.get(0)).add(1,0,1);
+ for (int x = pos1.x; x <= pos2.x; x++) {
+ for (int y = pos1.y; y <= pos2.y; y++) {
+
+ boolean lx = x < pos2.x;
+ boolean ly = y < pos2.y;
+
+ PlotId id = new PlotId(x,y);
+ Plot plot = PlotMain.getPlots(world).get(id);
+
+ if (lx) {
+ if (ly) {
+ if (!plot.settings.getMerged(1) || !plot.settings.getMerged(2)) {
+ Location loc = getPlotTopLocAbs(world, id);
+
+ int sx = loc.getBlockX()+1;
+ int ex = sx + pathsize - 1;
+ int sz = loc.getBlockZ()+1;
+ int ez = sz + pathsize - 1;
+
+ PlotHelper.setSimpleCuboid(world, new Location(world,sx,plotheight+1,sz), new Location(world,ex+1,257+1,ez+1), (short) 0);
+
+ PlotHelper.setCuboid(world, new Location(world,sx+1,1,sz+1), new Location(world,ex,plotheight,ez), filling,filling_data);
+ PlotHelper.setCuboid(world, new Location(world,sx+1,plotheight,sz+1), new Location(world,ex,plotheight+1,ez), plotfloors,plotfloors_data);
+ }
+ }
+ if (!plot.settings.getMerged(1)) {
+ Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x+1,y));
+ mergePlot(world, plot, plot2);
+ plot.settings.setMerged(1, true);
+ plot2.settings.setMerged(3, true);
+ }
+ }
+ if (ly) {
+ if (!plot.settings.getMerged(2)) {
+ Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x,y+1));
+ mergePlot(world, plot, plot2);
+ plot.settings.setMerged(2, true);
+ plot2.settings.setMerged(0, true);
+ }
+ }
+
+ }
+ }
+
+ Location megaPlotBot = getPlotBottomLoc(world, pos1);
+ Location megaPlotTop = getPlotTopLoc(world, pos2).add(1,0,1);
short[] result_w = PlotHelper.getBlock(plotworld.WALL_BLOCK);
short w_id = result_w[0];
byte w_v = (byte) result_w[1];
- for (int x = pos1.getBlockX(); x<=pos2.getBlockX(); x++) {
- for (int z = pos1.getBlockZ(); z<=pos2.getBlockZ(); z++) {
- if (z == pos1.getBlockZ() || z==pos2.getBlockZ() || x==pos1.getBlockX() || x==pos2.getBlockX()) {
+ for (int x = megaPlotBot.getBlockX(); x<=megaPlotTop.getBlockX(); x++) {
+ for (int z = megaPlotBot.getBlockZ(); z<=megaPlotTop.getBlockZ(); z++) {
+ if (z == megaPlotBot.getBlockZ() || z==megaPlotTop.getBlockZ() || x==megaPlotBot.getBlockX() || x==megaPlotTop.getBlockX()) {
world.getBlockAt(x, plotworld.WALL_HEIGHT+1, z).setTypeIdAndData(w_id, w_v, false);
}
}
}
+
return true;
}
-
/**
* Merges 2 plots
@@ -184,7 +179,7 @@ public class PlotHelper {
*
- Assumes the first plot parameter is lower
*
- Assumes neither are a Mega-plot
*
- Assumes plots are directly next to each other
- *
- Does not save to DB
+ *
- Saves to DB
* @param world
* @param lesserPlot
* @param greaterPlot
@@ -245,14 +240,13 @@ public class PlotHelper {
startz--;
endz++;
}
-
if (!noMerge) {
-
+ DBFunc.setMerged(world.getName(), lesserPlot, lesserPlot.settings.getMerged());
+ DBFunc.setMerged(world.getName(), greaterPlot, greaterPlot.settings.getMerged());
setSimpleCuboid(world, new Location(world, startx, 0, startz), new Location(world, endx, 1, endz), (short) 7);
setSimpleCuboid(world, new Location(world, startx, plotworld.PLOT_HEIGHT + 1, startz), new Location(world, endx, world.getMaxHeight(), endz), (short) 0);
setCuboid(world, new Location(world, startx, 1, startz), new Location(world, endx, plotworld.PLOT_HEIGHT, endz), filling, filling_data);
setCuboid(world, new Location(world, startx, plotworld.PLOT_HEIGHT, startz), new Location(world, endx, plotworld.PLOT_HEIGHT + 1, endz), plotfloors, plotfloors_data);
-
}
}
@@ -361,6 +355,72 @@ public class PlotHelper {
setWall(block, "" + id + ":" + data);
}
}
+
+ public static void autoMerge(World world, Plot plot, Player player) {
+ if (plot==null) {
+ return;
+ }
+ if(plot.owner==null) {
+ return;
+ }
+ if (!plot.owner.equals(player.getUniqueId())) {
+ return;
+ }
+
+ ArrayList plots;
+ boolean merge = true;
+ while (merge) {
+ PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
+ PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
+ merge = false;
+ plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y-1), new PlotId(top.x,top.y));
+ if (ownsPlots(world,plots,player, 0)) {
+ merge = true;
+ mergePlots(world, plots);
+ continue;
+ }
+ plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y), new PlotId(top.x+1,top.y));
+ if (ownsPlots(world,plots,player, 1)) {
+ merge = true;
+ mergePlots(world, plots);
+ continue;
+ }
+ plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y), new PlotId(top.x,top.y+1));
+ if (ownsPlots(world,plots,player, 2)) {
+ merge = true;
+ mergePlots(world, plots);
+ continue;
+ }
+ plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x-1,bot.y), new PlotId(top.x,top.y));
+ if (ownsPlots(world,plots,player, 3)) {
+ merge = true;
+ mergePlots(world, plots);
+ continue;
+ }
+ }
+ if (canSetFast) {
+ SetBlockFast.update(player);
+ }
+ }
+ private static boolean ownsPlots(World world, ArrayList plots, Player player, int dir) {
+ PlotId id_min = plots.get(0);
+ PlotId id_max = plots.get(plots.size()-1);
+ for (PlotId myid:plots) {
+ Plot myplot = PlotMain.getPlots(world).get(myid);
+ if (myplot==null || !myplot.hasOwner() || !(myplot.getOwner().equals(player.getUniqueId()))) {
+ return false;
+ }
+ PlotId top = PlayerFunctions.getTopPlot(world, myplot).id;
+ if ((top.x > id_max.x && dir != 1) || (top.y > id_max.y && dir != 2)) {
+ return false;
+ }
+ PlotId bot = PlayerFunctions.getBottomPlot(world, myplot).id;
+ if ((bot.x < id_min.x && dir != 3) || (bot.y < id_min.y && dir != 0)) {
+ return false;
+ }
+ }
+ return true;
+ }
public static boolean createPlot(Player player, Plot plot) {
@SuppressWarnings("deprecation")
@@ -369,6 +429,11 @@ public class PlotHelper {
PlotMain.updatePlot(p);
DBFunc.createPlot(p);
DBFunc.createPlotSettings(DBFunc.getId(w.getName(), p.id), p);
+ PlotWorld plotworld = PlotMain.getWorldSettings(w);
+ if (plotworld.AUTO_MERGE) {
+ autoMerge(w, p, player);
+ }
+
return true;
}
@@ -715,12 +780,6 @@ public class PlotHelper {
h = (prime * h) + pos1.getBlockZ();
state = h;
- try {
- new SetBlockFast();
- canSetFast = true;
- } catch (Exception e) {
- canSetFast = false;
- }
if ((pos2.getBlockX() - pos1.getBlockX()) < 16) {
setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX(), 1, pos2.getBlockZ()), (short) 7);
setSimpleCuboid(world, new Location(world, pos1.getBlockX(), plotworld.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX(), world.getMaxHeight(), pos2.getBlockZ()), (short) 0);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
index f07199731..174ad9eb9 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
@@ -26,6 +26,8 @@ import java.util.List;
**/
public class PlotWorld {
+ public boolean AUTO_MERGE;
+ public static boolean AUTO_MERGE_DEFAULT = false;
/**
* Road Height
*/
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
index 06e065996..97b283a90 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
@@ -73,6 +73,7 @@ public class WorldGenerator extends ChunkGenerator {
this.plotworld = new PlotWorld();
Map options = new HashMap();
+ options.put("worlds." + world + ".plot.auto_merge", AUTO_MERGE_DEFAULT);
options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
options.put("worlds." + world + ".plot.biome", PLOT_BIOME_DEFAULT);
@@ -104,6 +105,7 @@ public class WorldGenerator extends ChunkGenerator {
} catch (IOException e) {
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
}
+ this.plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
this.plotworld.PLOT_BIOME = config.getString("worlds." + world + ".plot.biome");
@@ -175,6 +177,7 @@ public class WorldGenerator extends ChunkGenerator {
@Override
public List getDefaultPopulators(World world) {
+ world.setSpawnFlags(false, false);
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
index 2158dc166..153b63005 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
@@ -9,12 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
-import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.PlotHelper;
+import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.PlotMain;
+
@SuppressWarnings("deprecation")
public class Auto extends SubCommand {
@@ -33,32 +38,59 @@ public class Auto extends SubCommand {
if (PlotMain.isPlotWorld(plr.getWorld())) {
world = plr.getWorld();
} else {
- if (args.length == 1) {
- world = Bukkit.getWorld(args[0]);
- if (world != null) {
- if (!PlotMain.isPlotWorld(world)) {
- PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
- return true;
- }
-
- } else {
- PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
- return true;
- }
- } else {
- PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
- return true;
- }
+ PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
+ return false;
}
}
+ if (args.length == 1) {
+ if (PlotMain.hasPermission(plr, "plots.auto.mega")) {
+ try {
+ String[] split = args[0].split(",");
+ size_x = Integer.parseInt(split[0]);
+ size_z = Integer.parseInt(split[1]);
+ if (size_x < 1 || size_z < 1) {
+ PlayerFunctions.sendMessage(plr, "&cError: size<=0");
+ }
+ if (size_x > 4 || size_z > 4) {
+ PlayerFunctions.sendMessage(plr, "&cError: size>4");
+ }
+ }
+ catch (Exception e) {
+ PlayerFunctions.sendMessage(plr, "&cError: Invalid size (X,Y)");
+ return false;
+ }
+ }
+ else {
+ PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
+ return false;
+ }
+ }
if (PlayerFunctions.getPlayerPlotCount(world, plr) >= PlayerFunctions.getAllowedPlots(plr)) {
PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
- return true;
+ return false;
}
boolean br = false;
int x = 0, z = 0, q = 100;
PlotId id;
+ if (size_x == 1 && size_z == 1) {
+ while (!br) {
+ id = new PlotId(x, z);
+ if (PlotHelper.getPlot(world, id).owner == null) {
+ Plot plot = PlotHelper.getPlot(world, id);
+ boolean result = Claim.claimPlot(plr, plot, true);
+ br = !result;
+ }
+ if ((z < q) && ((z - x) < q)) {
+ z++;
+ } else if (x < q) {
+ x++;
+ z = q - 100;
+ } else {
+ q += 100;
+ x = q;
+ z = q;
+ }
while (!br) {
id = new PlotId(x, z);
if (PlotHelper.getPlot(world, id).owner == null) {
@@ -92,18 +124,50 @@ public class Auto extends SubCommand {
boolean result = Claim.claimPlot(plr, plot, true);
br = !result;
}
- if ((z < q) && ((z - x) < q)) {
- z++;
- } else if (x < q) {
- x++;
- z = q - 100;
- } else {
- q += 100;
- x = q;
- z = q;
+ }
+ else {
+ while (!br) {
+ PlotId start = new PlotId(x, z);
+ PlotId end = new PlotId(x+size_x-1, z+size_z-1);
+ if (isUnowned(world, start, end)) {
+
+ // TODO claim event
+
+ for (int i = start.x; i <= end.x; i++) {
+ for (int j = start.y; j <= end.y; j++) {
+ Plot plot = PlotHelper.getPlot(world, new PlotId(i,j));
+ boolean teleport = (i == end.x && j == end.y) ? true : false;
+ Claim.claimPlot(plr, plot, teleport);
+ }
+ }
+ PlotHelper.mergePlots(world, PlayerFunctions.getPlotSelectionIds(world, start, end));
+ br = true;
+ }
+ if ((z < q) && ((z - x) < q)) {
+ z+=size_z;
+ } else if (x < q) {
+ x+=size_x;
+ z = q - 100;
+ } else {
+ q += 100;
+ x = q;
+ z = q;
+ }
+ }
+ }
+ return true;
+ }
+ public boolean isUnowned(World world, PlotId pos1, PlotId pos2) {
+ for (int x = pos1.x; x <= pos2.x; x++) {
+ for (int y = pos1.y; y <= pos2.y; y++) {
+ PlotId id = new PlotId(x,y);
+ if (PlotMain.getPlots(world).get(id)!=null) {
+ if (PlotMain.getPlots(world).get(id).owner != null) {
+ return false;
+ }
+ }
}
}
return true;
}
-
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
index fea0aa35f..028d5a724 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
@@ -82,6 +82,7 @@ public class Merge extends SubCommand {
}
if (args.length<1) {
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values,C.BLOCK_LIST_SEPARATER.s()));
+ PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
return false;
}
int direction = -1;
@@ -91,7 +92,6 @@ public class Merge extends SubCommand {
break;
}
}
- int direction2 = direction > 1 ? direction-2 : direction+2;
if (direction==-1) {
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values,C.BLOCK_LIST_SEPARATER.s()));
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
@@ -103,16 +103,16 @@ public class Merge extends SubCommand {
ArrayList plots;
switch (direction) {
case 0: // north = -y
- plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y-1), new PlotId(top.x,bot.y-1));
+ plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y-1), new PlotId(top.x,top.y));
break;
case 1: // east = +x
- plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(top.x+1,bot.y), new PlotId(top.x+1,top.y));
+ plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y), new PlotId(top.x+1,top.y));
break;
case 2: // south = +y
- plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,top.y+1), new PlotId(top.x,top.y+1));
+ plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y), new PlotId(top.x,top.y+1));
break;
case 3: // west = -x
- plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x-1,bot.y), new PlotId(bot.x-1,top.y));
+ plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x-1,bot.y), new PlotId(top.x,top.y));
break;
default:
return false;
@@ -123,10 +123,6 @@ public class Merge extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
return false;
}
- if (!PlayerFunctions.getBottomPlot(world, myplot).equals(PlayerFunctions.getTopPlot(world, myplot))) {
- PlayerFunctions.sendMessage(plr, C.NO_MERGE_TO_MEGA);
- return false;
- }
}
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
@@ -152,7 +148,10 @@ public class Merge extends SubCommand {
return false;
}
PlayerFunctions.sendMessage(plr, "&cPlots have been merged");
- return PlotHelper.mergePlot(world, plr, PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y), new PlotId(top.x,top.y)), plots, direction, direction2);
+ PlotHelper.mergePlots(world, plots);
+ if (PlotHelper.canSetFast) {
+ SetBlockFast.update(plr);
+ }
+ return true;
}
-
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java
index fdb5560da..3dd2ebfce 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java
@@ -40,10 +40,7 @@ public class Unlink extends SubCommand {
private byte wf_v;
private short f1_id;
private byte f1_v;
- private short f2_id;
- private byte f2_v;
private int pathsize;
- private boolean stripes_enabled;
private int wallheight;
private int roadheight;
public Unlink() {
@@ -81,6 +78,12 @@ public class Unlink extends SubCommand {
for (PlotId id:ids) {
Plot myplot = PlotMain.getPlots(world).get(id);
+
+ if (plot.helpers!=null)
+ myplot.helpers = plot.helpers;
+ if (plot.denied!=null)
+ myplot.denied = plot.denied;
+ myplot.deny_entry = plot.deny_entry;
myplot.settings.setMerged(new boolean[] {false, false, false, false} );
DBFunc.setMerged(world.getName(), myplot, myplot.settings.getMerged());
}
@@ -89,9 +92,7 @@ public class Unlink extends SubCommand {
this.pathsize = plotworld.ROAD_WIDTH;
this.roadheight = plotworld.ROAD_HEIGHT;
this.wallheight = plotworld.WALL_HEIGHT;
- this.stripes_enabled = plotworld.ROAD_STRIPES_ENABLED;
-
- // WALL
+ // WALL
short[] result_w = PlotHelper.getBlock(plotworld.WALL_BLOCK);
this.w_id = result_w[0];
this.w_v = (byte) result_w[1];
@@ -109,12 +110,8 @@ public class Unlink extends SubCommand {
// Floor 2
short[] result_f2 = PlotHelper.getBlock(plotworld.ROAD_STRIPES);
- this.f2_id = result_f2[0];
- this.f2_v = (byte) result_f2[1];
-
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
-
boolean lx = x < pos2.x;
boolean ly = y < pos2.y;
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/events/PlotUnmergeEvent.java b/PlotSquared/src/com/intellectualcrafters/plot/events/PlotUnmergeEvent.java
deleted file mode 100644
index 82c89f9d3..000000000
--- a/PlotSquared/src/com/intellectualcrafters/plot/events/PlotUnmergeEvent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 = PlayerClaimPlotEvent.java
- * >> Generated by: Citymonstret at 2014-08-09 15:21
- */
-
-package com.intellectualcrafters.plot.events;
-
-import java.util.Set;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.player.PlayerEvent;
-
-import com.intellectualcrafters.plot.Plot;
-
-/**
- * Created by Citymonstret on 2014-08-09.
- */
-public class PlotUnmergeEvent extends Event implements Cancellable {
- private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
- private Set plots;
-
- /**
- * PlotUnmergeEvent: Called when a plot is unmerged
- * @param player
- * @param plot
- */
- public PlotUnmergeEvent(Set plots) {
- this.plots = plots;
- }
-
- /**
- * Get the plots involved
- * @return Plot
- */
- public Set getPlost() {
- return this.plots;
- }
-
- 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/listeners/WorldEditListener.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java
index b588de63a..feddfeeb7 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java
@@ -25,10 +25,8 @@ public class WorldEditListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent e) {
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
- System.out.print("PERM");
return;
}
- System.out.print("NO PERM");
Location f = e.getFrom();
Location t = e.getTo();
boolean cm = false;
@@ -108,7 +106,6 @@ public class WorldEditListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerCommand(PlayerCommandPreprocessEvent e) {
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
- PWE.removeMask(e.getPlayer());
return;
}
Player p = e.getPlayer();
@@ -129,7 +126,6 @@ public class WorldEditListener implements Listener {
public void onInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) {
- PWE.removeMask(p);
return;
}
if (!p.hasPermission("plots.admin") && isPlotWorld(p.getLocation())) {