fixed sqlite somehow...

and plot merging
This commit is contained in:
Jesse Boyd 2014-10-12 12:44:59 -07:00
parent 9b6d3e2b14
commit 05c1ed139c
4 changed files with 21 additions and 21 deletions

View File

@ -343,7 +343,7 @@ public class PlotHelper {
Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), new ArrayList<UUID>(), new ArrayList<UUID>(), 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);
}
}

View File

@ -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) {

View File

@ -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);

View File

@ -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;