diff --git a/pom.xml b/pom.xml index 776c0c19e..50ba19dbd 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 3.2.23 + 3.2.24 PlotSquared jar diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index 428bd4be2..51f2bb46e 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1841,6 +1841,7 @@ public class PS { options.put("metrics", true); options.put("debug", true); options.put("update-notifications", Settings.UPDATE_NOTIFICATIONS); + options.put("merge.remove-terrain", Settings.MERGE_REMOVES_ROADS); for (final Entry node : options.entrySet()) { if (!config.contains(node.getKey())) { @@ -1966,6 +1967,7 @@ public class PS { } Settings.METRICS = config.getBoolean("metrics"); Settings.UPDATE_NOTIFICATIONS = config.getBoolean("update-notifications"); + Settings.MERGE_REMOVES_ROADS = config.getBoolean("merge.remove-terrain"); } /** diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 2f7173792..df5eb956e 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -20,7 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import java.util.ArrayList; import java.util.HashSet; import java.util.UUID; @@ -29,12 +28,10 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.CmdConfirm; import com.intellectualcrafters.plot.util.EconHandler; -import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringMan; @@ -46,7 +43,7 @@ command = "merge", aliases = { "m" }, description = "Merge the plot you are standing on, with another plot", permission = "plots.merge", -usage = "/plot merge [direction]", +usage = "/plot merge [removeroads]", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE) public class Merge extends SubCommand { @@ -125,7 +122,11 @@ public class Merge extends SubCommand { // } } else { if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("auto")) { - if (MainUtil.autoMerge(plot, -1, maxSize - size, uuid, (args.length != 2) || !args[1].equalsIgnoreCase("false"))) { + boolean terrain = Settings.MERGE_REMOVES_ROADS; + if (args.length == 2) { + terrain = args[1].equalsIgnoreCase("true"); + } + if (MainUtil.autoMerge(plot, -1, maxSize - size, uuid, terrain)) { if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) { EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE); sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + ""); @@ -145,11 +146,17 @@ public class Merge extends SubCommand { } } if (direction == -1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + ">"); + MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); return false; } - if (MainUtil.autoMerge(plot, direction, maxSize - size, uuid, (args.length != 2) || !args[1].equalsIgnoreCase("false"))) { + final boolean terrain; + if (args.length == 2) { + terrain = args[1].equalsIgnoreCase("true"); + } else { + terrain = Settings.MERGE_REMOVES_ROADS; + } + if (MainUtil.autoMerge(plot, direction, maxSize - size, uuid, terrain)) { if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) { EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE); sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + ""); @@ -179,7 +186,7 @@ public class Merge extends SubCommand { @Override public void run() { MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED); - MainUtil.autoMerge(plot, dir, maxSize - size, owner, true); + MainUtil.autoMerge(plot, dir, maxSize - size, owner, terrain); final PlotPlayer pp = UUIDHandler.getPlayer(plr.getUUID()); if (pp == null) { sendMessage(accepter, C.MERGE_NOT_VALID); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java b/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java index 7dad93600..5217e4922 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java @@ -44,17 +44,16 @@ public class SetHome extends SetCommand { case "unset": case "remove": case "none": { - plot.setHome(null); + plot.getBasePlot(false).setHome(null); MainUtil.sendMessage(plr, C.POSITION_UNSET); return true; } case "": { - final String world = plr.getLocation().getWorld(); - final Location base = MainUtil.getPlotBottomLocAbs(world, plot.id).subtract(1, 0, 1); - base.setY(0); - final Location relative = plr.getLocation().subtract(base.getX(), base.getY(), base.getZ()); - final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ(), relative.getYaw(), relative.getPitch()); - plot.setHome(blockloc); + Plot base = plot.getBasePlot(false); + Location bot = base.getBottomAbs(); + Location loc = plr.getLocationFull(); + BlockLoc rel = new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), loc.getYaw(), loc.getPitch());; + base.setHome(rel); return MainUtil.sendMessage(plr, C.POSITION_SET); } default: { diff --git a/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 7300e6d45..d71c10a67 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -37,6 +37,7 @@ public class Settings { public static boolean ENABLE_CLUSTERS = false; public static boolean FAST_CLEAR = false; + public static boolean MERGE_REMOVES_ROADS = true; /** * Default UUID_FECTHING: false */ diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index ac6d556a1..a00599c93 100644 --- a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -2375,8 +2375,7 @@ public class SQLManager implements AbstractDB { break; default: try { - final String[] split = pos.split(","); - final BlockLoc loc = new BlockLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])); + BlockLoc loc = BlockLoc.fromString(pos); cluster.settings.setPosition(loc); } catch (final Exception e) {} } diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 1167efc77..8b907355c 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -817,16 +817,17 @@ public class Plot { * Set the home location * @param loc */ - public void setHome(final BlockLoc loc) { + public void setHome(BlockLoc loc) { final BlockLoc pos = getSettings().getPosition(); if (((pos == null || pos.equals(new BlockLoc(0, 0, 0))) && (loc == null)) || ((pos != null) && pos.equals(loc))) { return; } - getSettings().setPosition(loc); - if (getSettings().getPosition() == null) { - DBFunc.setPosition(this, ""); + Plot plot = getBasePlot(false); + plot.getSettings().setPosition(loc); + if (plot.getSettings().getPosition() == null) { + DBFunc.setPosition(plot, ""); } else { - DBFunc.setPosition(this, getSettings().getPosition().toString()); + DBFunc.setPosition(plot, getSettings().getPosition().toString()); } } diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 5dc1ff85a..48815679a 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -1616,14 +1616,14 @@ public class MainUtil { * @return Home Location */ public static Location getPlotHome(final String w, final PlotId plotid) { - final Plot plot = getPlot(w, plotid); + final Plot plot = getPlot(w, plotid).getBasePlot(false); final BlockLoc home = plot.getPosition(); PS.get().getPlotManager(w); if ((home == null) || ((home.x == 0) && (home.z == 0))) { return getDefaultHome(plot); } else { Location bot = plot.getBottomAbs(); - final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z); + final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch); if (BlockManager.manager.getBlock(loc).id != 0) { loc.setY(Math.max(getHeighestBlock(w, loc.getX(), loc.getZ()), bot.getY())); } diff --git a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index f1d8a627a..fc8648f62 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -485,7 +485,6 @@ public abstract class SchematicHandler { */ public Schematic getSchematic(final File file) { if (!file.exists()) { - PS.debug(file.toString() + " doesn't exist"); return null; } try { diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar index 1acf86e83..96c7acd00 100644 Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ