If location1 is in a clear region and location2 is not, or if location1 is in a different clear region than + * region2, or if region 1 is in an additional clear region, this will return true.
+ * + * @param location1The first location to check
+ * @param location2The second location to check
+ * @returnTrue if the two locations are in different clear regions
+ */ + private boolean isInDifferentClearRegions(@NotNull Location location1, @NotNull Location location2) { + World fromWorld = location1.getWorld(); + if (fromWorld == null) { + ClearOnWorldGuard.logger().log(Level.WARNING, "Unable to check region change, as location " + + location1 + " has no world."); + return false; + } + + ApplicableRegionSet setFrom = query.getApplicableRegions(BukkitAdapter.adapt(location1)); + ApplicableRegionSet setTo = query.getApplicableRegions(BukkitAdapter.adapt(location2)); + + SetThe entity to check
+ * @returnTrue if the block is in a clear region
+ */ + private boolean isInClearRegion(@NotNull Entity entity) { + return isInClearRegion(entity.getLocation()); + } + + /** + * Checks whether the given block is in a clear region + * + * @param blockThe block to check
+ * @returnTrue if the block is in a clear region
+ */ + private boolean isInClearRegion(@NotNull Block block) { + return isInClearRegion(block.getLocation()); + } + + /** + * Checks whether the given location is in a clear region + * + * @param locationThe location to check
+ * @returnTrue if the location is in a clear region
+ */ + private boolean isInClearRegion(@NotNull Location location) { + World playerWorld = location.getWorld(); + if (playerWorld == null) { + ClearOnWorldGuard.logger().log(Level.WARNING, "Unable to check region change, as location " + + location + " has no world."); + return false; + } + + ApplicableRegionSet setFrom = query.getApplicableRegions(BukkitAdapter.adapt(location)); + Set