From 1bce4ec1b996ae8ec2425fc566746b1ba68c7310 Mon Sep 17 00:00:00 2001 From: tastybento Date: Thu, 28 Mar 2024 21:58:01 -0700 Subject: [PATCH] Limit blueprint pasting to world y coords. Addresses #2334 --- .../world/bentobox/bentobox/blueprints/BlueprintPaster.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java index 00a067a97..d62f8807d 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java @@ -119,6 +119,9 @@ public class BlueprintPaster { Vector off = bp.getBedrock() != null ? bp.getBedrock() : new Vector(0,0,0); // Calculate location for pasting this.location = island.getProtectionCenter().toVector().subtract(off).toLocation(world); + // Ensure the y coordinate is within the world limits + int y = Math.min(world.getMaxHeight() - 1, Math.max(world.getMinHeight(), location.getBlockY())); + location.setY(y); } private record Bits(Map blocks,