Sorting / Tweaks / Fixes

Fixes #499
Add sortPlotsByTimestamp method to PS
tweak to debugexec
This commit is contained in:
boy0001
2015-08-04 00:54:35 +10:00
parent b0859b250a
commit 0a0c72bc7d
8 changed files with 284 additions and 41 deletions

View File

@ -48,17 +48,30 @@ import com.intellectualcrafters.plot.util.TaskManager;
public class Plot {
/**
* plot ID
* Direct access is Deprecated: use getId()
*/
@Deprecated
public final PlotId id;
/**
* plot world
* Direct access is Deprecated: use getWorld()
*/
@Deprecated
public final String world;
/**
* plot owner
* Direct access is Deprecated: use getOwners()
*/
@Deprecated
public UUID owner;
/**
* Plot creation timestamp (rough)
* Direct access is Deprecated: use getTimestamp()
*/
@Deprecated
public long timestamp;
/**
* List of trusted (with plot permissions)
* Direct access is Deprecated: use getTrusted()
@ -132,10 +145,11 @@ public class Plot {
* @param denied
* @param merged
*/
public Plot(final PlotId id, final UUID owner, final HashSet<UUID> trusted, final HashSet<UUID> members, final HashSet<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged) {
public Plot(final PlotId id, final UUID owner, final HashSet<UUID> trusted, final HashSet<UUID> members, final HashSet<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged, final long timestamp) {
this.id = id;
this.settings = new PlotSettings(this);
this.world = world;
this.owner = owner;
this.settings = new PlotSettings(this);
this.members = members;
this.trusted = trusted;
this.denied = denied;
@ -147,7 +161,7 @@ public class Plot {
this.settings.flags.put(flag.getKey(), flag);
}
}
this.world = world;
this.timestamp = timestamp;
this.temp = false;
}
@ -201,7 +215,7 @@ public class Plot {
public boolean isDenied(final UUID uuid) {
return (this.getDenied() != null) && ((this.denied.contains(DBFunc.everyone) && !this.isAdded(uuid)) || (!this.isAdded(uuid) && this.denied.contains(uuid)));
}
/**
* Get the plot ID
*/
@ -209,6 +223,14 @@ public class Plot {
return this.id;
}
/**
* Get the world
* @return
*/
public String getWorld() {
return this.world;
}
/**
* Get or create plot settings
* @return PlotSettings
@ -227,6 +249,13 @@ public class Plot {
return settings.getMerged(0) || settings.getMerged(2) || settings.getMerged(1) || settings.getMerged(3);
}
public long getTimestamp() {
if (timestamp == 0) {
timestamp = System.currentTimeMillis();
}
return timestamp;
}
/**
* Get if the plot is merged in a direction
* @param direction