diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java index c77aa0b53..f17c5b9b4 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java @@ -343,7 +343,7 @@ public class PlotHelper { Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), new ArrayList(), new ArrayList(), w.getName()); PlotMain.updatePlot(p); DBFunc.createPlot(p); - DBFunc.createPlotSettings(DBFunc.getId(w.getName(), p.id), p); + DBFunc.createPlotSettings(DBFunc.getId(w.getName(), plot.id), plot); PlotWorld plotworld = PlotMain.getWorldSettings(w); if (plotworld.AUTO_MERGE) { autoMerge(w, p, player); @@ -750,14 +750,14 @@ public class PlotHelper { int x = bot.getBlockX() + (top.getBlockX() - bot.getBlockX()); int z = bot.getBlockZ() - 2; int y = w.getHighestBlockYAt(x, z); - return new Location(w, x, y + 2, z); + return new Location(w, x, y, z); } else { int x = top.getBlockX() - bot.getBlockX(); int z = top.getBlockZ() - bot.getBlockZ(); int y = w.getHighestBlockYAt(x, z); - return new Location(w, bot.getBlockX() + x/2, y + 2, bot.getBlockZ() + z/2); + return new Location(w, bot.getBlockX() + x/2, y, bot.getBlockZ() + z/2); } } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java index 16db71c13..5322e24c3 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java @@ -17,6 +17,7 @@ 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; import com.intellectualcrafters.plot.PlotManager; @@ -84,26 +85,26 @@ public class Unlink extends SubCommand { boolean lx = x < pos2.x; boolean ly = y < pos2.y; - new PlotId(x, y); + Plot p = PlotHelper.getPlot(world, new PlotId(x, y)); if (lx) { - manager.createRoadEast(plotworld, plot); - + manager.createRoadEast(plotworld, p); if (ly) { - manager.createRoadSouthEast(plotworld, plot); + manager.createRoadSouthEast(plotworld, p); } } if (ly) { - manager.createRoadSouth(plotworld, plot); + manager.createRoadSouth(plotworld, p); } } } - try { - SetBlockFast.update(plr); + if (PlotHelper.canSetFast) { + SetBlockFast.update(plr); + } } catch (Exception e) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java index f8841aff6..99eb4decb 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java @@ -251,7 +251,7 @@ public class DBFunc { } else { - stmt.addBatch("CREATE TABLE IF NOT EXISTS `plot` (" + "`id` INTEGER(11) PRIMARY KEY," + stmt.addBatch("CREATE TABLE IF NOT EXISTS `plot` (" + "`id` INTEGER PRIMARY KEY AUTOINCREMENT," + "`plot_id_x` INT(11) NOT NULL," + "`plot_id_z` INT(11) NOT NULL," + "`owner` VARCHAR(45) NOT NULL," + "`world` VARCHAR(45) NOT NULL," + "`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP)"); @@ -340,8 +340,7 @@ public class DBFunc { public static int getId(String world, PlotId id2) { PreparedStatement stmt = null; try { - stmt = - connection.prepareStatement("SELECT `id` FROM `plot` WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND world = ? ORDER BY `timestamp` ASC"); + stmt = connection.prepareStatement("SELECT `id` FROM `plot` WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND world = ? ORDER BY `timestamp` ASC"); stmt.setInt(1, id2.x); stmt.setInt(2, id2.y); stmt.setString(3, world); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java index f319bffe2..9ba86f1df 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java @@ -448,8 +448,8 @@ public class DefaultPlotManager extends PlotManager { Location pos1 = getPlotBottomLocAbs(plotworld, plot.id); Location pos2 = getPlotTopLocAbs(plotworld, plot.id); - int sx = pos2.getBlockX(); - int ex = (sx + dpw.ROAD_WIDTH); + int sx = pos2.getBlockX() + 1; + int ex = (sx + dpw.ROAD_WIDTH) - 1; int sz = pos1.getBlockZ() - 1; int ez = pos2.getBlockZ() + 2; @@ -474,8 +474,8 @@ public class DefaultPlotManager extends PlotManager { Location pos1 = getPlotBottomLocAbs(plotworld, plot.id); Location pos2 = getPlotTopLocAbs(plotworld, plot.id); - int sz = pos2.getBlockZ(); - int ez = (sz + dpw.ROAD_WIDTH); + int sz = pos2.getBlockZ() + 1; + int ez = (sz + dpw.ROAD_WIDTH) - 1; int sx = pos1.getBlockX() - 1; int ex = pos2.getBlockX() + 2; @@ -518,8 +518,8 @@ public class DefaultPlotManager extends PlotManager { Location pos1 = getPlotBottomLocAbs(plotworld, plot.id); Location pos2 = getPlotTopLocAbs(plotworld, plot.id); - int sx = pos2.getBlockX(); - int ex = (sx + dpw.ROAD_WIDTH); + int sx = pos2.getBlockX() + 1; + int ex = (sx + dpw.ROAD_WIDTH) - 1; int sz = pos1.getBlockZ(); int ez = pos2.getBlockZ() + 1; @@ -538,8 +538,8 @@ public class DefaultPlotManager extends PlotManager { Location pos1 = getPlotBottomLocAbs(plotworld, plot.id); Location pos2 = getPlotTopLocAbs(plotworld, plot.id); - int sz = pos2.getBlockZ(); - int ez = (sz + dpw.ROAD_WIDTH); + int sz = pos2.getBlockZ() + 1; + int ez = (sz + dpw.ROAD_WIDTH) - 1; int sx = pos1.getBlockX(); int ex = pos2.getBlockX() + 1;