This commit is contained in:
dordsor21 2019-02-06 16:42:27 +00:00
parent 6711788dd0
commit d6a801d854
8 changed files with 52 additions and 46 deletions

File diff suppressed because one or more lines are too long

View file

@ -87,7 +87,7 @@ import java.util.UUID;
PlotId pos1; PlotId pos1;
PlotId pos2; PlotId pos2;
// check pos1 / pos2 // check pos1 / pos2
try{ try {
pos1 = PlotId.fromString(args[2]); pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]); pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
@ -215,7 +215,7 @@ import java.util.UUID;
PlotId pos1; PlotId pos1;
PlotId pos2; PlotId pos2;
// check pos1 / pos2 // check pos1 / pos2
try{ try {
pos1 = PlotId.fromString(args[2]); pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]); pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {

View file

@ -39,8 +39,8 @@ import java.util.Map.Entry;
manager.close(); manager.close();
}); });
} catch (Exception e) { } catch (Exception e) {
MainUtil.sendMessage(player, MainUtil
"Failed to insert plot objects, see stacktrace for info"); .sendMessage(player, "Failed to insert plot objects, see stacktrace for info");
e.printStackTrace(); e.printStackTrace();
} }
}); });

View file

@ -557,20 +557,18 @@ import java.util.concurrent.atomic.AtomicInteger;
@Override public void run() { @Override public void run() {
createTiers(trusted, "trusted", new Runnable() { createTiers(trusted, "trusted", new Runnable() {
@Override public void run() { @Override public void run() {
createTiers(denied, "denied", createTiers(denied, "denied", new Runnable() {
new Runnable() { @Override public void run() {
@Override public void run() { try {
try { SQLManager.this.connection.commit();
SQLManager.this.connection } catch (SQLException e) {
.commit(); e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
if (whenDone != null) {
whenDone.run();
}
} }
}); if (whenDone != null) {
whenDone.run();
}
}
});
} }
}); });
} }
@ -2091,8 +2089,7 @@ import java.util.concurrent.atomic.AtomicInteger;
try (ResultSet r = stmt.executeQuery()) { try (ResultSet r = stmt.executeQuery()) {
ids = new HashSet<>(); ids = new HashSet<>();
while (r.next()) { while (r.next()) {
PlotId plot_id = PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
if (plots.contains(plot_id)) { if (plots.contains(plot_id)) {
ids.add(r.getInt("id")); ids.add(r.getInt("id"));
} }
@ -2562,7 +2559,8 @@ import java.util.concurrent.atomic.AtomicInteger;
} }
cluster = new PlotCluster(null, pos1, pos2, user, id); cluster = new PlotCluster(null, pos1, pos2, user, id);
clusters.put(id, cluster); clusters.put(id, cluster);
Set<PlotCluster> set = newClusters.computeIfAbsent(areaid, k -> new HashSet<>()); Set<PlotCluster> set =
newClusters.computeIfAbsent(areaid, k -> new HashSet<>());
set.add(cluster); set.add(cluster);
} }
//Getting helpers //Getting helpers
@ -3039,17 +3037,17 @@ import java.util.concurrent.atomic.AtomicInteger;
"UPDATE `" + SQLManager.this.prefix + "cluster_invited` SET `user_uuid` = '" "UPDATE `" + SQLManager.this.prefix + "cluster_invited` SET `user_uuid` = '"
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
stmt.executeUpdate( stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now "UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now.toString()
.toString() + "' WHERE `owner` = '" + old.toString() + '\''); + "' WHERE `owner` = '" + old.toString() + '\'');
stmt.executeUpdate( stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" "UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
stmt.executeUpdate( stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" "UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
stmt.executeUpdate( stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" "UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -2,7 +2,10 @@ package com.github.intellectualsites.plotsquared.plot.flag;
import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotSettings;
import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View file

@ -1523,9 +1523,9 @@ public class Plot {
} }
//TODO Better documentation needed. //TODO Better documentation needed.
/** /**
* Return the bottom location for the plot. * Return the bottom location for the plot.
*
*/ */
public Location getBottomAbs() { public Location getBottomAbs() {
Location loc = this.area.getPlotManager().getPlotBottomLocAbs(this.area, this.id); Location loc = this.area.getPlotManager().getPlotBottomLocAbs(this.area, this.id);

View file

@ -12,12 +12,14 @@ public class PlotInventory {
private final PlotItemStack[] items; private final PlotItemStack[] items;
private String title; private String title;
private boolean open = false; private boolean open = false;
public PlotInventory(PlotPlayer player) { public PlotInventory(PlotPlayer player) {
this.size = 4; this.size = 4;
this.title = null; this.title = null;
this.player = player; this.player = player;
this.items = InventoryUtil.manager.getItems(player); this.items = InventoryUtil.manager.getItems(player);
} }
public PlotInventory(PlotPlayer player, int size, String name) { public PlotInventory(PlotPlayer player, int size, String name) {
this.size = size; this.size = size;
this.title = name == null ? "" : name; this.title = name == null ? "" : name;

View file

@ -101,19 +101,19 @@ public class ExpireManager {
pp.setMeta("ignoreExpireTask", true); pp.setMeta("ignoreExpireTask", true);
pp.teleport(current.getCenter()); pp.teleport(current.getCenter());
pp.deleteMeta("ignoreExpireTask"); pp.deleteMeta("ignoreExpireTask");
PlotMessage msg = new PlotMessage().text( PlotMessage msg = new PlotMessage()
num + " " + (num > 1 ? "plots are" : "plot is") + " expired: ") .text(num + " " + (num > 1 ? "plots are" : "plot is") + " expired: ")
.color("$1").text(current.toString()).color("$2") .color("$1").text(current.toString()).color("$2")
.suggest("/plot list expired").tooltip("/plot list expired") .suggest("/plot list expired").tooltip("/plot list expired")
//.text("\n - ").color("$3").text("Delete all (/plot delete expired)").color("$2").command("/plot delete expired") //.text("\n - ").color("$3").text("Delete all (/plot delete expired)").color("$2").command("/plot delete expired")
.text("\n - ").color("$3").text("Delete this (/plot delete)") .text("\n - ").color("$3").text("Delete this (/plot delete)")
.color("$2").suggest("/plot delete").tooltip("/plot delete") .color("$2").suggest("/plot delete").tooltip("/plot delete")
.text("\n - ").color("$3").text("Remind later (/plot set keep 1d)") .text("\n - ").color("$3").text("Remind later (/plot set keep 1d)")
.color("$2").suggest("/plot set keep 1d") .color("$2").suggest("/plot set keep 1d").tooltip("/plot set keep 1d")
.tooltip("/plot set keep 1d").text("\n - ").color("$3") .text("\n - ").color("$3").text("Keep this (/plot set keep true)")
.text("Keep this (/plot set keep true)").color("$2") .color("$2").suggest("/plot set keep true")
.suggest("/plot set keep true").tooltip("/plot set keep true") .tooltip("/plot set keep true").text("\n - ").color("$3")
.text("\n - ").color("$3").text("Don't show me this").color("$2") .text("Don't show me this").color("$2")
.suggest("/plot toggle clear-confirmation") .suggest("/plot toggle clear-confirmation")
.tooltip("/plot toggle clear-confirmation"); .tooltip("/plot toggle clear-confirmation");
msg.send(pp); msg.send(pp);
@ -271,7 +271,8 @@ public class ExpireManager {
} }
for (ExpiryTask expiryTask : expired) { for (ExpiryTask expiryTask : expired) {
if (!expiryTask.needsAnalysis()) { if (!expiryTask.needsAnalysis()) {
expiredTask.run(newPlot, () -> TaskManager.IMP.taskLaterAsync(task, 1), expiryTask.requiresConfirmation()); expiredTask.run(newPlot, () -> TaskManager.IMP.taskLaterAsync(task, 1),
expiryTask.requiresConfirmation());
return; return;
} }
} }
@ -281,7 +282,8 @@ public class ExpireManager {
passesComplexity(changed, expired, new RunnableVal<Boolean>() { passesComplexity(changed, expired, new RunnableVal<Boolean>() {
@Override public void run(Boolean confirmation) { @Override public void run(Boolean confirmation) {
expiredTask.run(newPlot, expiredTask.run(newPlot,
() -> TaskManager.IMP.taskLaterAsync(task, 1), confirmation); () -> TaskManager.IMP.taskLaterAsync(task, 1),
confirmation);
} }
}, () -> { }, () -> {
FlagManager FlagManager