mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Fix plot rating & mega plots + fix plot expiry analysis
This commit is contained in:
		@@ -493,6 +493,32 @@ public class PS {
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get all the base plots in a single set (for merged plots it just returns the bottom plot)
 | 
			
		||||
     * @return Set of base Plot
 | 
			
		||||
     */
 | 
			
		||||
    public Set<Plot> getBasePlots() {
 | 
			
		||||
        int size = 0;
 | 
			
		||||
        for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) {
 | 
			
		||||
            if (isPlotWorld(entry.getKey())) {
 | 
			
		||||
                size += entry.getValue().size();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Set<Plot> result = new HashSet<>(size);
 | 
			
		||||
        for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) {
 | 
			
		||||
            if (isPlotWorld(entry.getKey())) {
 | 
			
		||||
                for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
 | 
			
		||||
                    Plot plot = entry2.getValue();
 | 
			
		||||
                    if (plot.getMerged(0) || plot.getMerged(3)) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    result.add(plot);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,7 @@ public class Rate extends SubCommand {
 | 
			
		||||
                });
 | 
			
		||||
                UUID uuid = player.getUUID();
 | 
			
		||||
                for (Plot p : plots) {
 | 
			
		||||
                    if ((p.getSettings().ratings == null || !p.getSettings().ratings.containsKey(uuid)) && !p.isAdded(uuid)) {
 | 
			
		||||
                    if (p.isBasePlot() && (p.getSettings().ratings == null || !p.getSettings().ratings.containsKey(uuid)) && !p.isAdded(uuid)) {
 | 
			
		||||
                        MainUtil.teleportPlayer(player, player.getLocation(), p);
 | 
			
		||||
                        MainUtil.sendMessage(player, C.RATE_THIS);
 | 
			
		||||
                        return true;
 | 
			
		||||
@@ -168,10 +168,6 @@ public class Rate extends SubCommand {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        final String arg = args[0];
 | 
			
		||||
        
 | 
			
		||||
        if (arg.equalsIgnoreCase("next")) {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        final int rating;
 | 
			
		||||
        if (MathMan.isInteger(arg) && arg.length() < 3 && arg.length() > 0) {
 | 
			
		||||
            rating = Integer.parseInt(arg);
 | 
			
		||||
 
 | 
			
		||||
@@ -285,6 +285,17 @@ public class Plot {
 | 
			
		||||
        return settings;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns true if the plot is not merged, or it is the base plot of multiple merged plots
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isBasePlot() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        return !settings.getMerged(0) && !settings.getMerged(3);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean isMerged() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import java.io.IOException;
 | 
			
		||||
import java.lang.reflect.Array;
 | 
			
		||||
import java.util.ArrayDeque;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
@@ -57,6 +58,10 @@ public class PlotAnalysis {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public List<Integer> asList() {
 | 
			
		||||
        return Arrays.asList(changes, faces, data, air, variety, changes_sd, faces_sd, data_sd, air_sd, variety_sd);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public int getComplexity() {
 | 
			
		||||
        if (complexity != 0) {
 | 
			
		||||
            return complexity;
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,7 @@ public class ExpireManager {
 | 
			
		||||
                                    if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
 | 
			
		||||
                                        PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
 | 
			
		||||
                                        expiredPlots.get(world).remove(plot);
 | 
			
		||||
                                        FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), value));
 | 
			
		||||
                                        FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), changed.asList()));
 | 
			
		||||
                                        return;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user