mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-09 09:59:48 +01:00
plot merging + '* UUID
This commit is contained in:
parent
f8c543b56c
commit
6b988f616a
@ -800,7 +800,9 @@ import java.util.concurrent.TimeUnit;
|
||||
public void run() {
|
||||
if (this.ticked > 36_000L) {
|
||||
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;
|
||||
}
|
||||
World world;
|
||||
|
@ -51,7 +51,11 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
@ -68,7 +72,7 @@ import java.util.UUID;
|
||||
return false;
|
||||
}
|
||||
if (!plot.denied.contains(uuid)) {
|
||||
if (plot.owner == uuid) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +90,7 @@ import java.util.UUID;
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, player);
|
||||
}
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -111,13 +115,13 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||
|
@ -51,7 +51,11 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
@ -67,7 +71,7 @@ import java.util.UUID;
|
||||
return false;
|
||||
}
|
||||
if (!plot.helpers.contains(uuid)) {
|
||||
if (plot.owner == uuid) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
@ -85,7 +89,7 @@ import java.util.UUID;
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
|
||||
}
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -102,13 +106,13 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||
|
@ -139,7 +139,7 @@ public class Merge extends SubCommand {
|
||||
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));
|
||||
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);
|
||||
|
||||
|
@ -51,7 +51,11 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
@ -68,7 +72,7 @@ import java.util.UUID;
|
||||
return false;
|
||||
}
|
||||
if (!plot.trusted.contains(uuid)) {
|
||||
if (plot.owner == uuid) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +90,7 @@ import java.util.UUID;
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
|
||||
}
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -103,13 +107,13 @@ import java.util.UUID;
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||
|
@ -166,16 +166,18 @@ import java.util.UUID;
|
||||
plot2.settings.setMerged(0, true);
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
if (plot2 != null) {
|
||||
DBFunc.setMerged(world.getName(), plot2, plot2.settings.getMerged());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
manager.finishPlotMerge(world, plotworld, plotIds);
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user