Skip to content

Commit

Permalink
Don't match door if neither door block is protected
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Feb 27, 2020
1 parent f7a46be commit 4acf69e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/com/griefcraft/util/matchers/DoorMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public boolean matches(ProtectionFinder finder) {
// Match the bottom half of the door
else if (PROTECTABLES_DOORS.contains(aboveBaseBlock.getType())) {
finder.addBlock(aboveBaseBlock);
// At this point, all door blocks are added. If there is no protection found, we can and should stop.
if (finder.loadProtection(true) == null) {
return false;
}
finder.addBlock(block.getRelative(BlockFace.DOWN));
findPressurePlate(finder, block);
return true;
Expand All @@ -134,8 +138,11 @@ else if (PROTECTABLES_DOORS.contains(aboveBaseBlock.getType())) {
// Match the top half of the door
else if (PROTECTABLES_DOORS.contains(baseBlockState.getType())) {
Block bottomHalf = block.getRelative(BlockFace.DOWN);

finder.addBlock(bottomHalf);
// At this point, all door blocks are added. If there is no protection found, we can and should stop.
if (finder.loadProtection(true) == null) {
return false;
}
finder.addBlock(bottomHalf.getRelative(BlockFace.DOWN));
findPressurePlate(finder, bottomHalf);
return true;
Expand Down

0 comments on commit 4acf69e

Please sign in to comment.