diff --git a/pom.xml b/pom.xml
index 699788e16..34148ae50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
UTF-8
PlotSquared
- 3.2.0
+ 3.2.2
PlotSquared
jar
diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java
index 1e4546f0a..2d460f7e5 100644
--- a/src/main/java/com/intellectualcrafters/plot/PS.java
+++ b/src/main/java/com/intellectualcrafters/plot/PS.java
@@ -291,8 +291,8 @@ public class PS {
}
if (!BlockManager.manager.isWorld(world) || (BlockManager.manager.isWorld(world) && !isPlotWorld(world))) {
PS.debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: ");
- PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml as well");
- PS.debug("&8 - &7Your world management plugin may be faulty. Consider using an up to date plugin.");
+ PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
+ PS.debug("&8 - &7Your world management plugin may be faulty (or non existant)");
IMP.setGenerator(world);
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
index f0c5df95b..2cfbc636a 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
@@ -427,18 +427,19 @@ public class DebugExec extends SubCommand {
@Override
public void run() {
final long start = System.currentTimeMillis();
+ Object result = null;
try {
- engine.eval(toExec, scope);
+ result = engine.eval(toExec, scope);
} catch (final ScriptException e) {
e.printStackTrace();
}
- PS.log("> " + (System.currentTimeMillis() - start) + "ms");
+ PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
}
});
} else {
final long start = System.currentTimeMillis();
- engine.eval(script, scope);
- PS.log("> " + (System.currentTimeMillis() - start) + "ms");
+ Object result = engine.eval(script, scope);
+ PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
}
return true;
} catch (final ScriptException e) {
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
index df813c5ab..4b88ecf76 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
@@ -101,7 +101,7 @@ public abstract class ChunkManager {
public abstract boolean loadChunk(final String world, final ChunkLoc loc, final boolean force);
- public abstract boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
+ public abstract void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
public abstract Set getChunkChunks(final String world);
diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
index 22c43eb12..343f0f3d0 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
@@ -1172,10 +1172,8 @@ public class MainUtil {
if (plot.owner == null) {
return false;
}
- if (!plot.owner.equals(uuid)) {
- return false;
- }
HashSet visited = new HashSet<>();
+ HashSet merged = new HashSet<>();
ArrayDeque frontier = new ArrayDeque<>(getConnectedPlots(plot));
Plot current;
boolean toReturn = false;
@@ -1189,6 +1187,8 @@ public class MainUtil {
if (other.isOwner(uuid)) {
frontier.addAll(other.getConnectedPlots());
mergePlot(current.world, current, other, removeRoads);
+ merged.add(current.id);
+ merged.add(other.id);
toReturn = true;
max--;
}
@@ -1198,6 +1198,8 @@ public class MainUtil {
if (other.isOwner(uuid)) {
frontier.addAll(other.getConnectedPlots());
mergePlot(current.world, current, other, removeRoads);
+ merged.add(current.id);
+ merged.add(other.id);
toReturn = true;
max--;
}
@@ -1207,6 +1209,8 @@ public class MainUtil {
if (other.isOwner(uuid)) {
frontier.addAll(other.getConnectedPlots());
mergePlot(current.world, current, other, removeRoads);
+ merged.add(current.id);
+ merged.add(other.id);
toReturn = true;
max--;
}
@@ -1216,40 +1220,21 @@ public class MainUtil {
if (other.isOwner(uuid)) {
frontier.addAll(other.getConnectedPlots());
mergePlot(current.world, current, other, removeRoads);
+ merged.add(current.id);
+ merged.add(other.id);
toReturn = true;
max--;
}
}
- PlotManager manager = PS.get().getPlotManager(plot.world);
- ArrayList ids = new ArrayList<>(visited.size());
- for (Plot visit : visited) {
- ids.add(visit.id);
- }
- manager.finishPlotMerge(PS.get().getPlotWorld(plot.world), ids);
+ }
+ PlotManager manager = PS.get().getPlotManager(plot.world);
+ ArrayList ids = new ArrayList<>(merged);
+ if (removeRoads) {
+ manager.finishPlotMerge(plot.getWorld(), ids);
}
return toReturn;
}
-// private static boolean ownsPlots(final String world, final ArrayList plots, final UUID uuid, final int dir) {
-// final PlotId id_min = plots.get(0);
-// final PlotId id_max = plots.get(plots.size() - 1);
-// for (final PlotId myid : plots) {
-// final Plot myplot = PS.get().getPlot(world, myid);
-// if ((myplot == null) || (myplot.owner == null) || !(myplot.owner.equals(uuid))) {
-// return false;
-// }
-// final PlotId top = getTopPlot(myplot).id;
-// if (((top.x > id_max.x) && (dir != 1)) || ((top.y > id_max.y) && (dir != 2))) {
-// return false;
-// }
-// final PlotId bot = getBottomPlot(myplot).id;
-// if (((bot.x < id_min.x) && (dir != 3)) || ((bot.y < id_min.y) && (dir != 0))) {
-// return false;
-// }
-// }
-// return true;
-// }
-
public static void updateWorldBorder(final Plot plot) {
if (!worldBorder.containsKey(plot.world)) {
return;
diff --git a/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotPopulator.java b/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotPopulator.java
index 0ed26f697..863932e2f 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotPopulator.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotPopulator.java
@@ -22,15 +22,15 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
public int X;
public int Z;
public String worldname;
- private World world;
+ private Chunk chunk;
@Override
public void populate(final World world, final Random rand, final Chunk chunk) {
try {
- this.world = world;
+ this.chunk = chunk;
worldname = world.getName();
- X = chunk.getX() << 4;
- Z = chunk.getZ() << 4;
+ X = this.chunk.getX() << 4;
+ Z = this.chunk.getZ() << 4;
if (ChunkManager.FORCE_PASTE) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
@@ -92,7 +92,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
*/
public void setBlock(final int x, final int y, final int z, final byte data) {
if (data != 0) {
- world.getBlockAt(X + x, y, Z + z).setData(data);
+ chunk.getBlock(x, y, z).setData(data);
}
}
@@ -104,7 +104,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
* @param data
*/
public void setBlockAbs(final int x, final int y, final int z, final byte data) {
- world.getBlockAt(X + x, y, Z + z).setData(data);
+ chunk.getBlock(x, y, z).setData(data);
}
/**
diff --git a/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java b/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
index a0d54e69c..2a382e86d 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
@@ -107,7 +107,6 @@ public class HybridPop extends BukkitPlotPopulator {
@Override
public void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz) {
PS.get().getPlotManager(world.getName());
-
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
if (sx < 0) {
diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java
index 852855f42..2422da661 100644
--- a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java
+++ b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java
@@ -940,8 +940,18 @@ public class BukkitChunkManager extends ChunkManager {
}
@Override
- public boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
- return BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
+ public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
+ if (!PS.get().isMainThread(Thread.currentThread())) {
+ TaskManager.runTask(new Runnable() {
+ @Override
+ public void run() {
+ BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
+ }
+ });
+ }
+ else {
+ BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
+ }
}
public static void swapChunk(final World world1, final World world2, final Chunk pos1, final Chunk pos2, final RegionWrapper r1, final RegionWrapper r2) {
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index fc7cad886..cee370fe9 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -123,6 +123,7 @@ permissions:
plots.set.home: true
plots.merge: true
plots.merge.other: true
+ plots.merge.4: true
plots.unlink: true
plots.denied: true
plots.add: true
diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar
index ebe165c90..02bab760c 100644
Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ