Compare commits

...

6 Commits

Author SHA1 Message Date
aed8aae591 Add since annotations 2022-11-14 18:13:58 +00:00
fa53b9c3fe feat: allow the world border to be larger than the road surrounding the outermost plots
- Closes #2962
2022-11-14 15:00:14 +00:00
25ce7a83f1 feat: check merge limits when completing auto-merge (#3868)
- Closes #3748
2022-11-13 11:57:41 +01:00
55c8a590e7 Fix item thrower/owner can be null (#3866)
fix: item thrower/owner can be nuill
 - Fixes #3862
2022-11-12 17:10:21 +01:00
28bd993680 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.18 (#3864)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-06 11:13:29 +01:00
8330f37d8a Back to snapshot for development 2022-11-02 09:35:57 +01:00
8 changed files with 62 additions and 7 deletions

View File

@ -104,6 +104,12 @@ public class BlockEventListener117 implements Listener {
if (entity instanceof Item item) {
UUID itemThrower = item.getThrower();
if (plot != null) {
if (itemThrower == null && (itemThrower = item.getOwner()) == null) {
plot.debug(
"A thrown item couldn't trigger sculk sensors because misc-interact = false and the item's owner could not be resolved.");
event.setCancelled(true);
return;
}
if (!plot.isAdded(itemThrower)) {
if (!plot.isAdded(itemThrower)) {
plot.debug("A thrown item couldn't trigger sculk sensors because misc-interact = false");

View File

@ -596,7 +596,7 @@ public class PlayerEventListener implements Listener {
this.tmpTeleport = true;
return;
}
int border = area.getBorder();
int border = area.getBorder(true);
int x1;
if (x2 > border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -687,7 +687,7 @@ public class PlayerEventListener implements Listener {
this.tmpTeleport = true;
return;
}
int border = area.getBorder();
int border = area.getBorder(true);
int z1;
if (z2 > border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {

View File

@ -142,6 +142,14 @@ public class Auto extends SubCommand {
}
}
}
int maxMerge = Permissions.hasPermissionRange(player, Permission.PERMISSION_MERGE, Settings.Limit.MAX_PLOTS);
if (sizeX * sizeZ > maxMerge) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Permission.PERMISSION_MERGE + "." + (sizeX * sizeZ))
);
return false;
}
return true;
}

View File

@ -177,7 +177,7 @@ public class Claim extends SubCommand {
}
}
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) {
player.sendMessage(TranslatableCaption.of("border.denied"));
return false;

View File

@ -124,7 +124,7 @@ public class Merge extends SubCommand {
return false;
}
final int size = plot.getConnectedPlots().size();
int max = Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
int max = Permissions.hasPermissionRange(player, Permission.PERMISSION_MERGE, Settings.Limit.MAX_PLOTS);
PlotMergeEvent event =
this.eventDispatcher.callMerge(plot, direction, max, player);
if (event.getEventResult() == Result.DENY) {

View File

@ -2690,6 +2690,11 @@ public class Plot {
return false;
}
/**
* Get the maximum distance of the plot from x=0, z=0.
*
* @return max block distance from 0,0
*/
public int getDistanceFromOrigin() {
Location bot = getManager().getPlotBottomLocAbs(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.
*/
public void updateWorldBorder() {
int border = this.area.getBorder();
int border = this.area.getBorder(false);
if (border == Integer.MAX_VALUE) {
return;
}

View File

@ -143,6 +143,7 @@ public abstract class PlotArea {
private Map<String, PlotExpression> prices = new HashMap<>();
private List<String> schematics = new ArrayList<>();
private boolean worldBorder = false;
private int extraBorder;
private boolean useEconomy = false;
private int hash;
private CuboidRegion region;
@ -352,6 +353,7 @@ public abstract class PlotArea {
this.plotChat = config.getBoolean("chat.enabled");
this.forcingPlotChat = config.getBoolean("chat.forced");
this.worldBorder = config.getBoolean("world.border");
this.extraBorder = config.getInt("world.extra_border");
this.maxBuildHeight = config.getInt("world.max_height");
this.minBuildHeight = config.getInt("world.min_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.breeding", this.isSpawnBreeding());
options.put("world.border", this.hasWorldBorder());
options.put("world.extra_border", this.getExtaBorder());
options.put("home.default", "side");
String position = config.getString(
"home.nonmembers",
@ -908,7 +911,9 @@ public abstract class PlotArea {
* Get the plot border distance for a world<br>
*
* @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() {
final Integer meta = (Integer) getMeta("worldBorder");
if (meta != null) {
@ -922,6 +927,27 @@ public abstract class PlotArea {
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
* @since TODO
*/
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).
*/
@ -1181,6 +1207,16 @@ public abstract class PlotArea {
return worldBorder;
}
/**
* Get the "extra border" size of the plot area.
*
* @return Plot area extra border size
* @since TODO
*/
public int getExtaBorder() {
return extraBorder;
}
/**
* Get whether plot signs are allowed or not.
*

View File

@ -19,7 +19,7 @@ plugins {
}
group = "com.plotsquared"
version = "6.10.3"
version = "6.10.4-SNAPSHOT"
subprojects {
group = rootProject.group
@ -65,7 +65,7 @@ subprojects {
}
dependencies {
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.17"))
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.18"))
}
dependencies {