diff --git a/src/main/java/world/bentobox/greenhouses/data/Greenhouse.java b/src/main/java/world/bentobox/greenhouses/data/Greenhouse.java index c1a442a..6278e9d 100644 --- a/src/main/java/world/bentobox/greenhouses/data/Greenhouse.java +++ b/src/main/java/world/bentobox/greenhouses/data/Greenhouse.java @@ -26,6 +26,7 @@ public class Greenhouse implements DataObject { @Expose private Location location; @Expose + // Min coords are inside, max coords are outside private BoundingBox boundingBox; @Expose private Biome originalBiome; @@ -43,7 +44,7 @@ public class Greenhouse implements DataObject { public Greenhouse(World world, Walls walls, int ceilingHeight) { this.location = new Location(world, walls.getMinX(), walls.getFloor(), walls.getMinZ()); - Location location2 = new Location(world, walls.getMaxX(), ceilingHeight, walls.getMaxZ()); + Location location2 = new Location(world, walls.getMaxX() + 1, ceilingHeight + 1, walls.getMaxZ() + 1); this.boundingBox = BoundingBox.of(location, location2); } diff --git a/src/main/java/world/bentobox/greenhouses/listeners/GreenhouseEvents.java b/src/main/java/world/bentobox/greenhouses/listeners/GreenhouseEvents.java index 7fc90c6..d3d4ee1 100644 --- a/src/main/java/world/bentobox/greenhouses/listeners/GreenhouseEvents.java +++ b/src/main/java/world/bentobox/greenhouses/listeners/GreenhouseEvents.java @@ -124,11 +124,11 @@ public class GreenhouseEvents implements Listener { User user = User.getInstance(e.getPlayer()); plugin.getManager().getMap().getGreenhouse(e.getBlock().getLocation()).ifPresent(g -> { // Check to see if wall or roof block broken - if ((e.getBlock().getLocation().getBlockY() == g.getCeilingHeight()) + if ((e.getBlock().getLocation().getBlockY() == g.getCeilingHeight() - 1) || e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMinX() - || e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMaxX() - || e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMinY() - || e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMaxY() + || e.getBlock().getLocation().getBlockX() == (int)g.getBoundingBox().getMaxX() - 1 + || e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMinZ() + || e.getBlock().getLocation().getBlockZ() == (int)g.getBoundingBox().getMaxZ() - 1 ) { user.sendMessage("greenhouses.broken"); plugin.getManager().getMap().removeGreenhouse(g);