mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Prevent plot deletion during plot analysis
This commit is contained in:
		@@ -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();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user