This commit is contained in:
boy0001 2014-10-21 15:31:27 +11:00
parent 42a3ec0561
commit 66d596b993
3 changed files with 33 additions and 15 deletions

View File

@ -106,6 +106,8 @@ public class PlotHelper {
manager.startPlotMerge(world, plotworld, plotIds); manager.startPlotMerge(world, plotworld, plotIds);
boolean result = false;
for (int x = pos1.x; x <= pos2.x; x++) { for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) { for (int y = pos1.y; y <= pos2.y; y++) {
@ -142,13 +144,14 @@ public class PlotHelper {
} }
} }
if (changed) { if (changed) {
result = true;
DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged()); DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged());
} }
} }
} }
manager.finishPlotMerge(world, plotworld, plotIds); manager.finishPlotMerge(world, plotworld, plotIds);
return true; return result;
} }
/** /**
@ -315,34 +318,48 @@ public class PlotHelper {
ArrayList<PlotId> plots; ArrayList<PlotId> plots;
boolean merge = true; boolean merge = true;
int count = 0;
while (merge) { while (merge) {
if (count>16) {
break;
}
count++;
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
PlotId top = PlayerFunctions.getTopPlot(world, plot).id; PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
merge = false; merge = false;
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
if (ownsPlots(world, plots, player, 0)) { if (ownsPlots(world, plots, player, 0)) {
merge = true; boolean result = mergePlots(world, plots);
mergePlots(world, plots); if (result) {
continue; merge = true;
continue;
}
} }
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y)); plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
if (ownsPlots(world, plots, player, 1)) { if (ownsPlots(world, plots, player, 1)) {
merge = true; boolean result = mergePlots(world, plots);
mergePlots(world, plots); if (result) {
continue; merge = true;
continue;
}
} }
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1)); plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
if (ownsPlots(world, plots, player, 2)) { if (ownsPlots(world, plots, player, 2)) {
merge = true; boolean result = mergePlots(world, plots);
mergePlots(world, plots); if (result) {
continue; merge = true;
continue;
}
} }
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y)); plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
if (ownsPlots(world, plots, player, 3)) { if (ownsPlots(world, plots, player, 3)) {
merge = true; boolean result = mergePlots(world, plots);
mergePlots(world, plots); if (result) {
continue; merge = true;
continue;
}
} }
merge = false;
} }
if (canSetFast) { if (canSetFast) {
SetBlockFast.update(player); SetBlockFast.update(player);

View File

@ -35,7 +35,7 @@ public class PlotId {
return false; return false;
} }
PlotId other = (PlotId) obj; PlotId other = (PlotId) obj;
return ((this.x == other.x) && (this.y == other.y)); return (((int) this.x == (int) other.x) && ((int) this.y == (int) other.y));
} }
@Override @Override

View File

@ -119,7 +119,7 @@ public class Auto extends SubCommand {
if ((z < q) && ((z - x) < q)) { if ((z < q) && ((z - x) < q)) {
z++; z++;
} }
else else {
if (x < q) { if (x < q) {
x++; x++;
z = q - 100; z = q - 100;
@ -129,6 +129,7 @@ public class Auto extends SubCommand {
x = q; x = q;
z = q; z = q;
} }
}
} }
} }
else { else {