Fixes #905
Fixes auto claim limit
This commit is contained in:
Jesse Boyd 2016-02-29 04:08:29 +11:00
parent 911bef974a
commit 5c4178b1dd
4 changed files with 16 additions and 8 deletions

View File

@ -288,6 +288,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
// Set the result data // Set the result data
result.result = new short[16][]; result.result = new short[16][];
result.result_data = new byte[16][]; result.result_data = new byte[16][];
result.grid = grid;
// Catch any exceptions (as exceptions usually thrown // Catch any exceptions (as exceptions usually thrown
try { try {
// Fill the result data // Fill the result data

View File

@ -116,6 +116,7 @@ public class Auto extends SubCommand {
if ((diff + (size_x * size_z)) > 0) { if ((diff + (size_x * size_z)) > 0) {
if (diff < 0) { if (diff < 0) {
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + "");
return false;
} else if (plr.hasPersistentMeta("grantedPlots")) { } else if (plr.hasPersistentMeta("grantedPlots")) {
int grantedPlots = ByteArrayUtilities.bytesToInteger(plr.getPersistentMeta("grantedPlots")); int grantedPlots = ByteArrayUtilities.bytesToInteger(plr.getPersistentMeta("grantedPlots"));
if (grantedPlots - diff < size_x * size_z) { if (grantedPlots - diff < size_x * size_z) {
@ -133,6 +134,7 @@ public class Auto extends SubCommand {
} }
} else { } else {
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
return false;
} }
} }
if ((EconHandler.manager != null) && plotarea.USE_ECONOMY) { if ((EconHandler.manager != null) && plotarea.USE_ECONOMY) {

View File

@ -769,25 +769,30 @@ public class Plot {
final Runnable run = new Runnable() { final Runnable run = new Runnable() {
@Override @Override
public void run() { public void run() {
if (finished.incrementAndGet() >= plots.size()) {
for (final RegionWrapper region : regions) { for (final RegionWrapper region : regions) {
final Location[] corners = region.getCorners(Plot.this.area.worldname); final Location[] corners = region.getCorners(Plot.this.area.worldname);
ChunkManager.manager.clearAllEntities(corners[0], corners[1]); ChunkManager.manager.clearAllEntities(corners[0], corners[1]);
} }
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
} }
}
}; };
if (isDelete) { if (isDelete) {
for (final Plot current : plots) { for (final Plot current : plots) {
manager.unclaimPlot(Plot.this.area, current, run); manager.unclaimPlot(Plot.this.area, current, new Runnable() {
@Override
public void run() {
if (finished.incrementAndGet() >= plots.size()) {
run.run();
}
}
});
} }
} else { } else {
for (final Plot current : plots) { for (final Plot current : plots) {
manager.claimPlot(Plot.this.area, current); manager.claimPlot(Plot.this.area, current);
} }
}
SetQueue.IMP.addTask(run); SetQueue.IMP.addTask(run);
}
return; return;
} }
final Plot current = queue.poll(); final Plot current = queue.poll();

Binary file not shown.