Prevent plot deletion during plot analysis

This commit is contained in:
boy0001 2015-07-18 15:45:04 +10:00
parent a7cd8d995e
commit fcc5056f8c
2 changed files with 21 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.TaskManager;
@ -102,19 +103,24 @@ public class PlotAnalysis {
@Override
public void run() {
Iterator<Plot> iter = plots.iterator();
PS.log(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
while (iter.hasNext()) {
Plot plot = iter.next();
if (plot.settings.ratings == null || plot.settings.ratings.size() == 0) {
iter.remove();
}
else {
MainUtil.runners.put(plot, 1);
}
}
PS.log(" - | Reduced to " + plots.size() + " plots");
if (plots.size() < 3) {
PS.log("Calibration cancelled due to insufficient comparison data, please try again later");
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
}
return;
}
@ -327,8 +333,11 @@ public class PlotAnalysis {
logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings)))));
if (optimal_complexity == Integer.MAX_VALUE) {
PS.log("");
PS.log("Insufficient data to determine correlation! " + optimal_index + " | " + n);
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
}
return;
}
}
@ -337,7 +346,7 @@ public class PlotAnalysis {
sort(sorted);
optimal_complexity = sorted[optimal_index];
logln("Complexity: ");
logln(sorted);
logln(complexity);
logln("Ratings: ");
logln(rank_ratings);
}
@ -364,6 +373,9 @@ public class PlotAnalysis {
PS.log("$1Done!");
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
}
whenDone.run();
}
});

View File

@ -151,6 +151,12 @@ public class ExpireManager {
}
}
};
if (MainUtil.runners.containsKey(plot)) {
PS.log("$2[&5Expire&dManager$2] &bSkipping plot in use: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;
}
if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0) {
PlotAnalysis analysis = plot.getComplexity();
if (analysis != null) {