Possible fix for #1476

Changes database load to prefer the latest entry over older ones.

Some previous changes may fix connections dropping, which resulted in
(incorrect) fixes being attempted by the plugin.
This commit is contained in:
Jesse Boyd 2017-01-11 07:21:36 +11:00
parent 6af96f43d4
commit cb6d839214
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 12 additions and 13 deletions

View File

@ -1683,7 +1683,7 @@ public class SQLManager implements AbstractDB {
try { try {
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable).getTime(); time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable).getTime();
} catch (ParseException e) { } catch (ParseException e) {
PS.debug("Could not parse date for plot: " + id + " (" + parsable + ")"); PS.debug("Could not parse date for plot: #" + id + "(" + areaid + ";" + plot_id + ") (" + parsable + ")");
time = System.currentTimeMillis() + id; time = System.currentTimeMillis() + id;
} }
} }
@ -1693,11 +1693,10 @@ public class SQLManager implements AbstractDB {
if (map != null) { if (map != null) {
Plot last = map.put(p.getId(), p); Plot last = map.put(p.getId(), p);
if (last != null) { if (last != null) {
map.put(last.getId(), last);
if (Settings.Enabled_Components.DATABASE_PURGER) { if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id); toDelete.add(last.temp);
} else { } else {
PS.debug("&cPLOT " + id + " in `" + this.prefix PS.debug("&cPLOT #" + id + "(" + last + ") in `" + this.prefix
+ "plot` is a duplicate. Delete this plot or set `auto-purge: true` in the settings.yml."); + "plot` is a duplicate. Delete this plot or set `auto-purge: true` in the settings.yml.");
} }
continue; continue;
@ -1728,7 +1727,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) { } else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id); toDelete.add(id);
} else { } else {
PS.debug("&cENTRY " + id + " in `plot_rating` does not exist. Create this plot or set `auto-purge: true` in the " PS.debug("&cENTRY #" + id + "(" + plot + ") in `plot_rating` does not exist. Create this plot or set `auto-purge: true` in the "
+ "settings.yml."); + "settings.yml.");
} }
} }
@ -1755,7 +1754,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) { } else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id); toDelete.add(id);
} else { } else {
PS.debug("&cENTRY " + id + " in `plot_helpers` does not exist. Create this plot or set `auto-purge: true` in the settings" PS.debug("&cENTRY #" + id + "(" + plot + ") in `plot_helpers` does not exist. Create this plot or set `auto-purge: true` in the settings"
+ ".yml."); + ".yml.");
} }
} }
@ -1781,7 +1780,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) { } else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id); toDelete.add(id);
} else { } else {
PS.debug("&cENTRY " + id + " in `plot_trusted` does not exist. Create this plot or set `auto-purge: true` in the settings" PS.debug("&cENTRY #" + id + "(" + plot + ") in `plot_trusted` does not exist. Create this plot or set `auto-purge: true` in the settings"
+ ".yml."); + ".yml.");
} }
} }
@ -1881,7 +1880,7 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PS.debug("&cPlot " + id + " | " + plot + " had an invalid flag. A fix has been attempted."); PS.debug("&cPlot #" + id + "(" + plot + ") | " + plot + " had an invalid flag. A fix has been attempted.");
PS.debug("&c" + myflags); PS.debug("&c" + myflags);
this.setFlags(plot, flags); this.setFlags(plot, flags);
} }
@ -1890,7 +1889,7 @@ public class SQLManager implements AbstractDB {
toDelete.add(id); toDelete.add(id);
} else { } else {
PS.debug( PS.debug(
"&cENTRY " + id + " in `plot_settings` does not exist. Create this plot or set `auto-purge: true` in the settings" "&cENTRY #" + id + "(" + plot + ") in `plot_settings` does not exist. Create this plot or set `auto-purge: true` in the settings"
+ ".yml."); + ".yml.");
} }
} }
@ -2608,7 +2607,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.helpers.add(user); cluster.helpers.add(user);
} else { } else {
PS.debug("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry."); PS.debug("&cCluster #" + id + "(" + cluster + ") in cluster_helpers does not exist. Please create the cluster or remove this entry.");
} }
} }
// Getting invited // Getting invited
@ -2625,7 +2624,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.invited.add(user); cluster.invited.add(user);
} else { } else {
PS.debug("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry."); PS.debug("&cCluster #" + id + "(" + cluster + ") in cluster_invited does not exist. Please create the cluster or remove this entry.");
} }
} }
resultSet = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`"); resultSet = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@ -2691,7 +2690,7 @@ public class SQLManager implements AbstractDB {
} }
cluster.settings.flags = flags; cluster.settings.flags = flags;
} else { } else {
PS.debug("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry."); PS.debug("&cCluster #" + id + "(" + cluster + ") in cluster_settings does not exist. Please create the cluster or remove this entry.");
} }
} }
resultSet.close(); resultSet.close();

View File

@ -356,7 +356,7 @@ public class ExpireManager {
PlotAnalysis changed = plot.getComplexity(null); PlotAnalysis changed = plot.getComplexity(null);
int changes = changed == null ? 0 : changed.changes_sd; int changes = changed == null ? 0 : changed.changes_sd;
int modified = changed == null ? 0 : changed.changes; int modified = changed == null ? 0 : changed.changes;
PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + changes + " - " + modified); PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.owner + " Delta:" + changes + "/" + modified);
PS.debug("$4 - Area: " + plot.getArea()); PS.debug("$4 - Area: " + plot.getArea());
if (plot.hasOwner()) { if (plot.hasOwner()) {
PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner)); PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));