More plot analysis + made it more obvious that plot listing is interactive

This commit is contained in:
boy0001
2015-07-18 15:02:44 +10:00
parent e026ec31eb
commit a7cd8d995e
7 changed files with 198 additions and 143 deletions

View File

@ -58,17 +58,56 @@ public class DebugExec extends SubCommand {
@Override
public boolean execute(final PlotPlayer player, final String... args) {
final List<String> allowed_params = Arrays.asList("analyze", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
final List<String> allowed_params = Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
if (args.length > 0) {
final String arg = args[0].toLowerCase();
switch (arg) {
case "analyze": {
if (player == null) {
MainUtil.sendMessage(player, C.IS_CONSOLE);
return false;
}
Plot plot = MainUtil.getPlot(player.getLocation());
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
return false;
}
PlotAnalysis analysis = plot.getComplexity();
if (analysis != null) {
int complexity = analysis.getComplexity();
MainUtil.sendMessage(player, "Complexity: " + complexity);
return true;
}
MainUtil.sendMessage(player, "$1Starting task...");
HybridUtils.manager.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
@Override
public void run() {
MainUtil.sendMessage(player, "$1Done: $2use $3/plot debugexec analyze$2 for more information");
}
});
return true;
}
case "calibrate-analysis": {
if (args.length != 2) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec analyze <threshold>");
MainUtil.sendMessage(player, "$1<threshold> $2= $1The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating it)");
return false;
}
double threshold;
try {
threshold = Integer.parseInt(args[1]) / 100d;
}
catch (NumberFormatException e) {
MainUtil.sendMessage(player, "$2Invalid threshold: " + args[1]);
MainUtil.sendMessage(player, "$1<threshold> $2= $1The percentage of plots you want to clear as a number between 0 - 100");
return false;
}
PlotAnalysis.calcOptimalModifiers(new Runnable() {
@Override
public void run() {
PS.log("&cTHIS FUNCTION IS A WORK IN PROGRESS");
PS.log("$1Thank you for calibrating PlotSquared plot expiry");
}
});
}, threshold);
return true;
}
case "stop-expire": {

View File

@ -472,6 +472,8 @@ public class list extends SubCommand {
.then("->")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2))
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s())
.send(((BukkitPlayer) player).player);
return;
}
@ -485,6 +487,8 @@ public class list extends SubCommand {
.then("->")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2))
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s())
.send(((BukkitPlayer) player).player);
return;
}
@ -498,6 +502,8 @@ public class list extends SubCommand {
.color(ChatColor.DARK_GRAY)
.then("->")
.color(ChatColor.DARK_GRAY)
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s())
.send(((BukkitPlayer) player).player);
return;
}