diff --git a/src/main/java/ch/njol/skript/conditions/CondIsWithin.java b/src/main/java/ch/njol/skript/conditions/CondIsWithin.java index e6b88ed710a..7ec25401ae8 100644 --- a/src/main/java/ch/njol/skript/conditions/CondIsWithin.java +++ b/src/main/java/ch/njol/skript/conditions/CondIsWithin.java @@ -103,7 +103,7 @@ public boolean check(Event event) { Location one = loc1.getSingle(event); Location two = loc2.getSingle(event); if (one == null || two == null || one.getWorld() != two.getWorld()) - return false; + return isNegated(); AABB box = new AABB(one, two); return locsToCheck.check(event, box::contains, isNegated()); } @@ -111,7 +111,7 @@ public boolean check(Event event) { // else, within an entity/block/chunk/world Object area = this.area.getSingle(event); if (area == null) - return false; + return isNegated(); // Entities if (area instanceof Entity) { diff --git a/src/test/skript/tests/syntaxes/conditions/CondIsWithin.sk b/src/test/skript/tests/syntaxes/conditions/CondIsWithin.sk index b432c72f0ff..757bfa49633 100644 --- a/src/test/skript/tests/syntaxes/conditions/CondIsWithin.sk +++ b/src/test/skript/tests/syntaxes/conditions/CondIsWithin.sk @@ -4,6 +4,7 @@ test "within condition" when running minecraft "1.17": set {_loc2} to location(20, 20, 20, "world") assert location(10, 10, 10, "world") is within {_loc1} and {_loc2} with "failed within two locs" assert location(10, -10, 10, "world") is not within {_loc1} and {_loc2} with "failed within two locs" + assert location(0, 0, 0, "world") is not within {_none} and {_none} with "failed within two locs" # chunks set {_chunk1} to chunk at {_loc1} @@ -37,6 +38,7 @@ test "within condition" when running below minecraft "1.17": set {_loc2} to location(20, 20, 20, "world") assert location(10, 10, 10, "world") is within {_loc1} and {_loc2} with "failed within two locs" assert location(10, -10, 10, "world") is not within {_loc1} and {_loc2} with "failed within two locs" + assert location(0, 0, 0, "world") is not within {_none} and {_none} with "failed within two locs" # chunks set {_chunk1} to chunk at {_loc1}