mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Prevent plot deletion during plot analysis
This commit is contained in:
parent
a7cd8d995e
commit
fcc5056f8c
@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
@ -102,19 +103,24 @@ public class PlotAnalysis {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Iterator<Plot> iter = plots.iterator();
|
Iterator<Plot> iter = plots.iterator();
|
||||||
|
|
||||||
PS.log(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
|
PS.log(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Plot plot = iter.next();
|
Plot plot = iter.next();
|
||||||
if (plot.settings.ratings == null || plot.settings.ratings.size() == 0) {
|
if (plot.settings.ratings == null || plot.settings.ratings.size() == 0) {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
MainUtil.runners.put(plot, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PS.log(" - | Reduced to " + plots.size() + " plots");
|
PS.log(" - | Reduced to " + plots.size() + " plots");
|
||||||
|
|
||||||
if (plots.size() < 3) {
|
if (plots.size() < 3) {
|
||||||
PS.log("Calibration cancelled due to insufficient comparison data, please try again later");
|
PS.log("Calibration cancelled due to insufficient comparison data, please try again later");
|
||||||
running = false;
|
running = false;
|
||||||
|
for (Plot plot : plots) {
|
||||||
|
MainUtil.runners.remove(plot);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,8 +333,11 @@ public class PlotAnalysis {
|
|||||||
logln("Correlation: ");
|
logln("Correlation: ");
|
||||||
logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings)))));
|
logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings)))));
|
||||||
if (optimal_complexity == Integer.MAX_VALUE) {
|
if (optimal_complexity == Integer.MAX_VALUE) {
|
||||||
PS.log("");
|
PS.log("Insufficient data to determine correlation! " + optimal_index + " | " + n);
|
||||||
running = false;
|
running = false;
|
||||||
|
for (Plot plot : plots) {
|
||||||
|
MainUtil.runners.remove(plot);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,7 +346,7 @@ public class PlotAnalysis {
|
|||||||
sort(sorted);
|
sort(sorted);
|
||||||
optimal_complexity = sorted[optimal_index];
|
optimal_complexity = sorted[optimal_index];
|
||||||
logln("Complexity: ");
|
logln("Complexity: ");
|
||||||
logln(sorted);
|
logln(complexity);
|
||||||
logln("Ratings: ");
|
logln("Ratings: ");
|
||||||
logln(rank_ratings);
|
logln(rank_ratings);
|
||||||
}
|
}
|
||||||
@ -364,6 +373,9 @@ public class PlotAnalysis {
|
|||||||
|
|
||||||
PS.log("$1Done!");
|
PS.log("$1Done!");
|
||||||
running = false;
|
running = false;
|
||||||
|
for (Plot plot : plots) {
|
||||||
|
MainUtil.runners.remove(plot);
|
||||||
|
}
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -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) {
|
if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0) {
|
||||||
PlotAnalysis analysis = plot.getComplexity();
|
PlotAnalysis analysis = plot.getComplexity();
|
||||||
if (analysis != null) {
|
if (analysis != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user