mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
parent
9fc464e896
commit
7b1c4a5042
@ -47,9 +47,23 @@ public class Claim extends SubCommand {
|
|||||||
if (!plot.canClaim(player)) {
|
if (!plot.canClaim(player)) {
|
||||||
return sendMessage(player, C.PLOT_IS_CLAIMED);
|
return sendMessage(player, C.PLOT_IS_CLAIMED);
|
||||||
}
|
}
|
||||||
PlotArea world = plot.getArea();
|
PlotArea area = plot.getArea();
|
||||||
if ((EconHandler.manager != null) && world.USE_ECONOMY) {
|
if (!schematic.isEmpty()) {
|
||||||
Expression<Double> costExr = world.PRICES.get("claim");
|
if (area.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
|
if (!area.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
|
return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||||
|
return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int border = area.getBorder();
|
||||||
|
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border) {
|
||||||
|
return !sendMessage(player, C.BORDER);
|
||||||
|
}
|
||||||
|
if ((EconHandler.manager != null) && area.USE_ECONOMY) {
|
||||||
|
Expression<Double> costExr = area.PRICES.get("claim");
|
||||||
double cost = costExr.evaluate((double) currentPlots);
|
double cost = costExr.evaluate((double) currentPlots);
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
if (EconHandler.manager.getMoney(player) < cost) {
|
if (EconHandler.manager.getMoney(player) < cost) {
|
||||||
@ -67,16 +81,6 @@ public class Claim extends SubCommand {
|
|||||||
}
|
}
|
||||||
sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||||
}
|
}
|
||||||
if (!schematic.isEmpty()) {
|
|
||||||
if (world.SCHEMATIC_CLAIM_SPECIFY) {
|
|
||||||
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
|
||||||
return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
|
||||||
}
|
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
|
||||||
return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return plot.claim(player, false, schematic) || sendMessage(player, C.PLOT_NOT_CLAIMED);
|
return plot.claim(player, false, schematic) || sendMessage(player, C.PLOT_NOT_CLAIMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2630,6 +2630,12 @@ public class Plot {
|
|||||||
return this.getManager().setComponent(this.area, this.getId(), component, blocks);
|
return this.getManager().setComponent(this.area, this.getId(), component, blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDistanceFromOrigin() {
|
||||||
|
Location bot = getManager().getPlotBottomLocAbs(this.area, id);
|
||||||
|
Location top = getManager().getPlotTopLocAbs(this.area, id);
|
||||||
|
return Math.max(Math.max(Math.abs(bot.getX()), Math.abs(bot.getZ())), Math.max(Math.abs(top.getX()), Math.abs(top.getZ())));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand the world border to include the provided plot (if applicable).
|
* Expand the world border to include the provided plot (if applicable).
|
||||||
*/
|
*/
|
||||||
@ -2641,12 +2647,7 @@ public class Plot {
|
|||||||
if (border == Integer.MAX_VALUE) {
|
if (border == Integer.MAX_VALUE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotManager manager = this.getManager();
|
int max = getDistanceFromOrigin();
|
||||||
Location bot = manager.getPlotBottomLocAbs(this.area, id);
|
|
||||||
Location top = manager.getPlotTopLocAbs(this.area, id);
|
|
||||||
int botmax = Math.max(Math.abs(bot.getX()), Math.abs(bot.getZ()));
|
|
||||||
int topmax = Math.max(Math.abs(top.getX()), Math.abs(top.getZ()));
|
|
||||||
int max = Math.max(botmax, topmax);
|
|
||||||
if (max > border) {
|
if (max > border) {
|
||||||
this.area.setMeta("worldBorder", max);
|
this.area.setMeta("worldBorder", max);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user