plot merging + '* UUID

This commit is contained in:
boy0001 2015-01-06 14:33:37 +11:00
parent f8c543b56c
commit 6b988f616a
6 changed files with 40 additions and 24 deletions

View File

@ -800,7 +800,9 @@ import java.util.concurrent.TimeUnit;
public void run() { public void run() {
if (this.ticked > 36_000L) { if (this.ticked > 36_000L) {
this.ticked = 0l; this.ticked = 0l;
sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities has been running for 60 minutes. Errors: " + this.error); if (this.error > 0) {
sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error);
}
this.error = 0l; this.error = 0l;
} }
World world; World world;

View File

@ -51,7 +51,11 @@ import java.util.UUID;
return true; return true;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { if ((plot == null) || !plot.hasOwner()) {
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
@ -68,7 +72,7 @@ import java.util.UUID;
return false; return false;
} }
if (!plot.denied.contains(uuid)) { if (!plot.denied.contains(uuid)) {
if (plot.owner == uuid) { if (plot.owner.equals(uuid)) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
@ -86,7 +90,7 @@ import java.util.UUID;
DBFunc.removeHelper(plr.getWorld().getName(), plot, player); DBFunc.removeHelper(plr.getWorld().getName(), plot, player);
} }
plot.addDenied(uuid); plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
@ -111,13 +115,13 @@ import java.util.UUID;
return true; return true;
} }
plot.removeDenied(uuid); plot.removeDenied(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeDenied(uuid); plot.removeDenied(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);

View File

@ -51,7 +51,11 @@ import java.util.UUID;
return true; return true;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { if ((plot == null) || !plot.hasOwner()) {
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
@ -67,7 +71,7 @@ import java.util.UUID;
return false; return false;
} }
if (!plot.helpers.contains(uuid)) { if (!plot.helpers.contains(uuid)) {
if (plot.owner == uuid) { if (plot.owner.equals(uuid)) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
@ -85,7 +89,7 @@ import java.util.UUID;
DBFunc.removeDenied(plr.getWorld().getName(), plot, player); DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
} }
plot.addHelper(uuid); plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
@ -102,13 +106,13 @@ import java.util.UUID;
return true; return true;
} }
plot.removeHelper(uuid); plot.removeHelper(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeHelper(uuid); plot.removeHelper(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);

View File

@ -139,7 +139,7 @@ public class Merge extends SubCommand {
PlotId top2 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, botId)).id; PlotId top2 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, botId)).id;
bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y)); bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y));
top = new PlotId(Math.min(top1.x, top2.x), Math.min(top1.y, top2.y)); top = new PlotId(Math.max(top1.x, top2.x), Math.max(top1.y, top2.y));
plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top); plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top);

View File

@ -51,7 +51,11 @@ import java.util.UUID;
return true; return true;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot.owner == null) || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin")) { if ((plot == null) || !plot.hasOwner()) {
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
@ -68,7 +72,7 @@ import java.util.UUID;
return false; return false;
} }
if (!plot.trusted.contains(uuid)) { if (!plot.trusted.contains(uuid)) {
if (plot.owner == uuid) { if (plot.owner.equals(uuid)) {
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
@ -86,7 +90,7 @@ import java.util.UUID;
DBFunc.removeDenied(plr.getWorld().getName(), plot, player); DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
} }
plot.addTrusted(uuid); plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
@ -103,13 +107,13 @@ import java.util.UUID;
return true; return true;
} }
plot.removeTrusted(uuid); plot.removeTrusted(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeTrusted(uuid); plot.removeTrusted(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);

View File

@ -166,16 +166,18 @@ import java.util.UUID;
plot2.settings.setMerged(0, true); plot2.settings.setMerged(0, true);
} }
} }
if (changed) {
result = true;
DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged());
if (plot2 != null) {
DBFunc.setMerged(world.getName(), plot2, plot2.settings.getMerged());
}
}
} }
} }
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y);
final Plot plot = PlotMain.getPlots(world).get(id);
DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged());
}
}
manager.finishPlotMerge(world, plotworld, plotIds); manager.finishPlotMerge(world, plotworld, plotIds);
return result; return result;