incremented version number

This commit is contained in:
boy0001 2015-02-04 16:41:23 +11:00
parent d42ae87ea3
commit c306ae32cc
4 changed files with 17 additions and 39 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.6.3</version> <version>2.6.4</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -48,6 +48,7 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
@ -113,37 +114,6 @@ public class Trim extends SubCommand {
return false; return false;
} }
public ArrayList<Plot> getOldPlots(String world) {
final Collection<Plot> plots = PlotMain.getPlots(world).values();
final ArrayList<Plot> toRemove = new ArrayList<>();
Set<UUID> remove = new HashSet<>();
Set<UUID> keep = new HashSet<>();
for (Plot plot : plots) {
UUID uuid = plot.owner;
if (uuid == null || remove.contains(uuid)) {
toRemove.add(plot);
continue;
}
if (keep.contains(uuid)) {
continue;
}
OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
if (!op.hasPlayedBefore()) {
toRemove.add(plot);
PlotMain.removePlot(plot.world, plot.id, true);
continue;
}
long last = op.getLastPlayed();
long compared = System.currentTimeMillis() - last;
if (TimeUnit.MILLISECONDS.toDays(compared) >= Settings.AUTO_CLEAR_DAYS) {
toRemove.add(plot);
remove.add(uuid);
}
keep.add(uuid);
}
return toRemove;
}
public boolean runTrimTask(final World world) { public boolean runTrimTask(final World world) {
if (Trim.TASK) { if (Trim.TASK) {
return false; return false;
@ -194,13 +164,13 @@ public class Trim extends SubCommand {
} }
} }
} }
final ArrayList<Plot> plots = getOldPlots(world.getName()); final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet();
int count2 = 0; int count2 = 0;
Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
if (manager != null && plots.size() > 0) { if (manager != null && plots.size() > 0) {
Plot plot = plots.get(0); Plot plot = plots.iterator().next();
boolean modified = false; boolean modified = false;
if (plot.hasOwner()) { if (plot.hasOwner()) {
modified = HybridPlotManager.checkModified(plot, 0); modified = HybridPlotManager.checkModified(plot, 0);

View File

@ -123,7 +123,7 @@ public class Settings {
* Days until a plot gets cleared * Days until a plot gets cleared
*/ */
public static int AUTO_CLEAR_DAYS = 360; public static int AUTO_CLEAR_DAYS = 360;
public static boolean AUTO_CLEAR_CHECK_DISK = true; public static boolean AUTO_CLEAR_CHECK_DISK = false;
public static int MIN_BLOCKS_CHANGED = -1; public static int MIN_BLOCKS_CHANGED = -1;

View File

@ -124,7 +124,7 @@ public class ExpireManager {
if (op.hasPlayedBefore()) { if (op.hasPlayedBefore()) {
long last = op.getLastPlayed(); long last = op.getLastPlayed();
long compared = System.currentTimeMillis() - last; long compared = System.currentTimeMillis() - last;
if (compared >= 86400000 * Settings.AUTO_CLEAR_DAYS) { if (compared >= 86400000l * Settings.AUTO_CLEAR_DAYS) {
return true; return true;
} }
} }
@ -140,7 +140,14 @@ public class ExpireManager {
for (Plot plot : plots) { for (Plot plot : plots) {
UUID uuid = plot.owner; UUID uuid = plot.owner;
if (uuid == null || remove.containsKey(uuid)) { if (uuid == null || remove.containsKey(uuid)) {
toRemove.put(plot, remove.get(uuid)); Long stamp;
if (uuid == null) {
stamp = 0l;
}
else {
stamp = remove.get(uuid);
}
toRemove.put(plot, stamp);
continue; continue;
} }
if (keep.contains(uuid)) { if (keep.contains(uuid)) {
@ -157,7 +164,7 @@ public class ExpireManager {
} }
long last = op.getLastPlayed(); long last = op.getLastPlayed();
long compared = System.currentTimeMillis() - last; long compared = System.currentTimeMillis() - last;
if (compared >= 86400000 * Settings.AUTO_CLEAR_DAYS) { if (compared >= 86400000l * Settings.AUTO_CLEAR_DAYS) {
if (Settings.AUTO_CLEAR_CHECK_DISK) { if (Settings.AUTO_CLEAR_CHECK_DISK) {
String worldname = Bukkit.getWorlds().get(0).getName(); String worldname = Bukkit.getWorlds().get(0).getName();
String foldername; String foldername;
@ -187,7 +194,7 @@ public class ExpireManager {
try { try {
last = playerFile.lastModified(); last = playerFile.lastModified();
compared = System.currentTimeMillis() - last; compared = System.currentTimeMillis() - last;
if (compared < 86400000 * Settings.AUTO_CLEAR_DAYS) { if (compared < 86400000l * Settings.AUTO_CLEAR_DAYS) {
keep.add(uuid); keep.add(uuid);
continue; continue;
} }
@ -200,6 +207,7 @@ public class ExpireManager {
} }
toRemove.put(plot, last); toRemove.put(plot, last);
remove.put(uuid, last); remove.put(uuid, last);
continue;
} }
keep.add(uuid); keep.add(uuid);
} }