mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
feat: allow the world border to be larger than the road surrounding the outermost plots
- Closes #2962
This commit is contained in:
parent
25ce7a83f1
commit
fa53b9c3fe
@ -596,7 +596,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int border = area.getBorder();
|
int border = area.getBorder(true);
|
||||||
int x1;
|
int x1;
|
||||||
if (x2 > border && this.tmpTeleport) {
|
if (x2 > border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
@ -687,7 +687,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int border = area.getBorder();
|
int border = area.getBorder(true);
|
||||||
int z1;
|
int z1;
|
||||||
if (z2 > border && this.tmpTeleport) {
|
if (z2 > border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
|
@ -177,7 +177,7 @@ public class Claim extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
int border = area.getBorder();
|
int border = area.getBorder(false);
|
||||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
||||||
player.sendMessage(TranslatableCaption.of("border.denied"));
|
player.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
return false;
|
return false;
|
||||||
|
@ -2690,6 +2690,11 @@ public class Plot {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum distance of the plot from x=0, z=0.
|
||||||
|
*
|
||||||
|
* @return max block distance from 0,0
|
||||||
|
*/
|
||||||
public int getDistanceFromOrigin() {
|
public int getDistanceFromOrigin() {
|
||||||
Location bot = getManager().getPlotBottomLocAbs(id);
|
Location bot = getManager().getPlotBottomLocAbs(id);
|
||||||
Location top = getManager().getPlotTopLocAbs(id);
|
Location top = getManager().getPlotTopLocAbs(id);
|
||||||
@ -2703,7 +2708,7 @@ public class Plot {
|
|||||||
* Expands the world border to include this plot if it is beyond the current border.
|
* Expands the world border to include this plot if it is beyond the current border.
|
||||||
*/
|
*/
|
||||||
public void updateWorldBorder() {
|
public void updateWorldBorder() {
|
||||||
int border = this.area.getBorder();
|
int border = this.area.getBorder(false);
|
||||||
if (border == Integer.MAX_VALUE) {
|
if (border == Integer.MAX_VALUE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,7 @@ public abstract class PlotArea {
|
|||||||
private Map<String, PlotExpression> prices = new HashMap<>();
|
private Map<String, PlotExpression> prices = new HashMap<>();
|
||||||
private List<String> schematics = new ArrayList<>();
|
private List<String> schematics = new ArrayList<>();
|
||||||
private boolean worldBorder = false;
|
private boolean worldBorder = false;
|
||||||
|
private int extraBorder;
|
||||||
private boolean useEconomy = false;
|
private boolean useEconomy = false;
|
||||||
private int hash;
|
private int hash;
|
||||||
private CuboidRegion region;
|
private CuboidRegion region;
|
||||||
@ -352,6 +353,7 @@ public abstract class PlotArea {
|
|||||||
this.plotChat = config.getBoolean("chat.enabled");
|
this.plotChat = config.getBoolean("chat.enabled");
|
||||||
this.forcingPlotChat = config.getBoolean("chat.forced");
|
this.forcingPlotChat = config.getBoolean("chat.forced");
|
||||||
this.worldBorder = config.getBoolean("world.border");
|
this.worldBorder = config.getBoolean("world.border");
|
||||||
|
this.extraBorder = config.getInt("world.extra_border");
|
||||||
this.maxBuildHeight = config.getInt("world.max_height");
|
this.maxBuildHeight = config.getInt("world.max_height");
|
||||||
this.minBuildHeight = config.getInt("world.min_height");
|
this.minBuildHeight = config.getInt("world.min_height");
|
||||||
this.minGenHeight = config.getInt("world.min_gen_height");
|
this.minGenHeight = config.getInt("world.min_gen_height");
|
||||||
@ -469,6 +471,7 @@ public abstract class PlotArea {
|
|||||||
options.put("event.spawn.custom", this.isSpawnCustom());
|
options.put("event.spawn.custom", this.isSpawnCustom());
|
||||||
options.put("event.spawn.breeding", this.isSpawnBreeding());
|
options.put("event.spawn.breeding", this.isSpawnBreeding());
|
||||||
options.put("world.border", this.hasWorldBorder());
|
options.put("world.border", this.hasWorldBorder());
|
||||||
|
options.put("world.extra_border", this.getExtaBorder());
|
||||||
options.put("home.default", "side");
|
options.put("home.default", "side");
|
||||||
String position = config.getString(
|
String position = config.getString(
|
||||||
"home.nonmembers",
|
"home.nonmembers",
|
||||||
@ -908,7 +911,9 @@ public abstract class PlotArea {
|
|||||||
* Get the plot border distance for a world<br>
|
* Get the plot border distance for a world<br>
|
||||||
*
|
*
|
||||||
* @return The border distance or Integer.MAX_VALUE if no border is set
|
* @return The border distance or Integer.MAX_VALUE if no border is set
|
||||||
|
* @deprecated Use {@link PlotArea#getBorder(boolean)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public int getBorder() {
|
public int getBorder() {
|
||||||
final Integer meta = (Integer) getMeta("worldBorder");
|
final Integer meta = (Integer) getMeta("worldBorder");
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
@ -922,6 +927,26 @@ public abstract class PlotArea {
|
|||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot border distance for a world, specifying whether the returned value should include the world.extra-border
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* @param includeExtra If the extra border given by world.extra-border should be included
|
||||||
|
* @return Border distance of Integer.MAX_VALUE if no border is set
|
||||||
|
*/
|
||||||
|
public int getBorder(boolean includeExtra) {
|
||||||
|
final Integer meta = (Integer) getMeta("worldBorder");
|
||||||
|
if (meta != null) {
|
||||||
|
int border = meta + 1;
|
||||||
|
if (border == 0) {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
} else {
|
||||||
|
return includeExtra ? border + extraBorder : border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the plot border for a world (usually done when the world is created).
|
* Setup the plot border for a world (usually done when the world is created).
|
||||||
*/
|
*/
|
||||||
@ -1181,6 +1206,15 @@ public abstract class PlotArea {
|
|||||||
return worldBorder;
|
return worldBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the "extra border" size of the plot area.
|
||||||
|
*
|
||||||
|
* @return Plot area extra border size
|
||||||
|
*/
|
||||||
|
public int getExtaBorder() {
|
||||||
|
return extraBorder;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether plot signs are allowed or not.
|
* Get whether plot signs are allowed or not.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user