Note: This is probably around somewhere..but this is useful either way So I needed a method to check if a player is within a region for my plugin, so I created this: Code:java public static Boolean isInside(Location loc, Location corner1, Location corner2) { double xMin = 0; double xMax = 0; double yMin = 0; double yMax = 0; double zMin = 0; double zMax = 0; double x = loc.getX(); double y = loc.getY(); double z = loc.getZ(); xMin = Math.min(corner1.getX(), corner2.getX()); xMax = Math.max(corner1.getX(), corner2.getX()); yMin = Math.min(corner1.getY(), corner2.getY()); yMax = Math.max(corner1.getY(), corner2.getY()); zMin = Math.min(corner1.getZ(), corner2.getZ()); zMax = Math.max(corner1.getZ(), corner2.getZ()); return (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax); } It can be used like so: Code:java @EventHandler public void onBlockBreak(BlockBreakEvent event) { Location location = event.getBlock().getLocation(); if (CuboidAPI.isInside(location, new Location(world, x, y, z), new Location(world, x, y, z)) { event.setCancelled(true); } } In that event you the CuboidAPI checks if the block placed is inside the two locations, which could be called min and max, but can be reversed. If the block is within the locations, the event will be cancelled.
If you convert the location to vectors, you can just use isInAABB() Faster calculations, less lines of code