*Fix the toggle

This commit is contained in:
Jesse Boyd 2016-10-01 22:09:45 +10:00
parent 39e99c0593
commit 5d3e096501
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 11 additions and 6 deletions

View File

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

View File

@ -52,6 +52,11 @@ public class ExpireManager {
public void handleJoin(PlotPlayer pp) { public void handleJoin(PlotPlayer pp) {
storeDate(pp.getUUID(), System.currentTimeMillis()); storeDate(pp.getUUID(), System.currentTimeMillis());
if (!plotsToDelete.isEmpty()) {
for (Plot plot : pp.getPlots()) {
plotsToDelete.remove(plot);
}
}
confirmExpiry(pp); confirmExpiry(pp);
} }
@ -399,13 +404,13 @@ public class ExpireManager {
return 0; return 0;
} }
} }
long max = 0; long min = Long.MAX_VALUE;
for (UUID owner : plot.getOwners()) { for (UUID owner : plot.getOwners()) {
long age = getAge(owner); long age = getAge(owner);
if (age > max) { if (age < min) {
max = age; min = age;
} }
} }
return max; return min;
} }
} }