Trim deletes expired plots

This commit is contained in:
Jesse Boyd 2016-10-01 20:17:50 +10:00
parent 5ed2190cb3
commit 0244c0241c
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 21 additions and 4 deletions

View File

@ -151,7 +151,7 @@ public class DebugExec extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer player, String[] args) {
List<String> allowed_params =
Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "list-scripts");
Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "seen", "list-scripts");
if (args.length > 0) {
String arg = args[0].toLowerCase();
String script;

View File

@ -32,7 +32,7 @@ public class Reload extends SubCommand {
public void run(PlotArea area) {
ConfigurationSection worldSection = PS.get().worlds.getConfigurationSection("worlds." + area.worldname);
if (worldSection == null) {
worldSection = PS.get().worlds.createSection("worlds." + area.worldname);
return;
}
if (area.TYPE != 2 || !worldSection.contains("areas")) {
area.saveConfiguration(worldSection);

View File

@ -54,7 +54,7 @@ public class Toggle extends Command {
permission = "plots.toggle.chat",
description = "Toggle plot chat")
public void chat(Command command, PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "chat")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
} else {
@ -62,6 +62,19 @@ public class Toggle extends Command {
}
}
@CommandDeclaration(
command = "clear-confirmation",
permission = "plots.admin.command.autoclear",
description = "Toggle autoclear confirmation")
public void clearConfirmation(Command command, PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "clear-confirmation")) {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
}
}
@CommandDeclaration(
command = "titles",
permission = "plots.toggle.titles",
@ -70,7 +83,7 @@ public class Toggle extends Command {
RunnableVal2<Command, CommandResult> whenDone) {
PlotArea area = player.getApplicablePlotArea();
boolean chat = area == null ? false : area.PLOT_CHAT;
if (toggle(player, "disabletitles") != chat) {
if (toggle(player, "ignoreExpireTask") != chat) {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
} else {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, command.toString());

View File

@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
@ -101,6 +102,9 @@ public class Trim extends SubCommand {
MainUtil.sendMessage(null, "Collecting region data...");
ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PS.get().getPlots(world));
if (ExpireManager.IMP != null) {
plots.removeAll(ExpireManager.IMP.getPendingExpired());
}
result.value1 = new HashSet<>(ChunkManager.manager.getChunkChunks(world));
result.value2 = new HashSet<>();
MainUtil.sendMessage(null, " - MCA #: " + result.value1.size());