mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fix plot rating & mega plots + fix plot expiry analysis
This commit is contained in:
parent
8040e13919
commit
b7fe6ea749
@ -493,6 +493,32 @@ public class PS {
|
|||||||
}
|
}
|
||||||
return result;
|
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();
|
UUID uuid = player.getUUID();
|
||||||
for (Plot p : plots) {
|
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.teleportPlayer(player, player.getLocation(), p);
|
||||||
MainUtil.sendMessage(player, C.RATE_THIS);
|
MainUtil.sendMessage(player, C.RATE_THIS);
|
||||||
return true;
|
return true;
|
||||||
@ -168,10 +168,6 @@ public class Rate extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final String arg = args[0];
|
final String arg = args[0];
|
||||||
|
|
||||||
if (arg.equalsIgnoreCase("next")) {
|
|
||||||
|
|
||||||
}
|
|
||||||
final int rating;
|
final int rating;
|
||||||
if (MathMan.isInteger(arg) && arg.length() < 3 && arg.length() > 0) {
|
if (MathMan.isInteger(arg) && arg.length() < 3 && arg.length() > 0) {
|
||||||
rating = Integer.parseInt(arg);
|
rating = Integer.parseInt(arg);
|
||||||
|
@ -285,6 +285,17 @@ public class Plot {
|
|||||||
return settings;
|
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() {
|
public boolean isMerged() {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -57,6 +58,10 @@ public class PlotAnalysis {
|
|||||||
return null;
|
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() {
|
public int getComplexity() {
|
||||||
if (complexity != 0) {
|
if (complexity != 0) {
|
||||||
return complexity;
|
return complexity;
|
||||||
|
@ -125,7 +125,7 @@ public class ExpireManager {
|
|||||||
if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
|
if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
|
||||||
PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
|
PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
|
||||||
expiredPlots.get(world).remove(plot);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user