Compare commits

..

12 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
985fae65b6 ÂRelease 6.10.3 2022-11-02 09:34:33 +01:00
db2d590e8e fix: account for mismatched road-schematic heights (#3854) 2022-10-23 21:22:21 +02:00
c8d356783a Update dependency com.intellectualsites.bom:bom-1.18.x to v1.17 (#3853)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-20 10:23:56 +02:00
4947450ff0 Back to snapshot for development 2022-10-18 23:14:03 +02:00
de4e91ff62 Release 6.10.2 2022-10-18 23:12:27 +02:00
fe5e3d5f6d Annotate ExpireManager with @Inject (#3852)
fix: annotate ExpireManager with @Inject
2022-10-18 10:17:34 +02:00
12 changed files with 71 additions and 13 deletions

View File

@ -104,6 +104,12 @@ public class BlockEventListener117 implements Listener {
if (entity instanceof Item item) { if (entity instanceof Item item) {
UUID itemThrower = item.getThrower(); UUID itemThrower = item.getThrower();
if (plot != null) { 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)) {
if (!plot.isAdded(itemThrower)) { if (!plot.isAdded(itemThrower)) {
plot.debug("A thrown item couldn't trigger sculk sensors because misc-interact = false"); 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; 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)) {

View File

@ -289,7 +289,7 @@ public interface PlotPlatform<P> extends LocaleHolder {
* Get the {@link ExpireManager} implementation for the platform * Get the {@link ExpireManager} implementation for the platform
* *
* @return Expire manager * @return Expire manager
* @since TODO * @since 6.10.2
*/ */
default @NonNull ExpireManager expireManager() { default @NonNull ExpireManager expireManager() {
return injector().getInstance(ExpireManager.class); return injector().getInstance(ExpireManager.class);

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; return true;
} }

View File

@ -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;

View File

@ -124,7 +124,7 @@ public class Merge extends SubCommand {
return false; return false;
} }
final int size = plot.getConnectedPlots().size(); 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 = PlotMergeEvent event =
this.eventDispatcher.callMerge(plot, direction, max, player); this.eventDispatcher.callMerge(plot, direction, max, player);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {

View File

@ -298,7 +298,10 @@ public class HybridPlotWorld extends ClassicPlotWorld {
int roadSchemHeight; int roadSchemHeight;
if (schematic1 != null) { if (schematic1 != null) {
roadSchemHeight = schematic1.getClipboard().getDimensions().getY(); roadSchemHeight = Math.max(
schematic1.getClipboard().getDimensions().getY(),
schematic2.getClipboard().getDimensions().getY()
);
maxSchematicHeight = Math.max(roadSchemHeight, maxSchematicHeight); maxSchematicHeight = Math.max(roadSchemHeight, maxSchematicHeight);
if (maxSchematicHeight == worldGenHeight) { if (maxSchematicHeight == worldGenHeight) {
SCHEM_Y = getMinGenHeight(); SCHEM_Y = getMinGenHeight();
@ -486,7 +489,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* @deprecated This method should not be available for public API usage and will be made private. * @deprecated This method should not be available for public API usage and will be made private.
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.10.2")
public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) { public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
if (z < 0) { if (z < 0) {
z += this.SIZE; z += this.SIZE;
@ -521,7 +524,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* @deprecated This method should not be available for public API usage and will be made private. * @deprecated This method should not be available for public API usage and will be made private.
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.10.2")
public void addOverlayBiome(short x, short z, BiomeType id) { public void addOverlayBiome(short x, short z, BiomeType id) {
if (z < 0) { if (z < 0) {
z += this.SIZE; z += this.SIZE;

View File

@ -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;
} }

View File

@ -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,27 @@ 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
* @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). * Setup the plot border for a world (usually done when the world is created).
*/ */
@ -1181,6 +1207,16 @@ public abstract class PlotArea {
return worldBorder; 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. * Get whether plot signs are allowed or not.
* *

View File

@ -112,7 +112,7 @@ public final class PlotId {
* @return Plot ID copy * @return Plot ID copy
* @deprecated PlotId is immutable, copy is not required. * @deprecated PlotId is immutable, copy is not required.
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.10.2")
public @NonNull PlotId copy() { public @NonNull PlotId copy() {
return this; return this;
} }

View File

@ -65,7 +65,7 @@ public class ExpireManager {
/** /**
* @deprecated Use {@link PlotPlatform#expireManager()} instead * @deprecated Use {@link PlotPlatform#expireManager()} instead
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.10.2")
public static ExpireManager IMP; public static ExpireManager IMP;
private final ConcurrentHashMap<UUID, Long> dates_cache; private final ConcurrentHashMap<UUID, Long> dates_cache;
private final ConcurrentHashMap<UUID, Long> account_age_cache; private final ConcurrentHashMap<UUID, Long> account_age_cache;

View File

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