Fix block state mask with string properties (#2091)

This commit is contained in:
Maddy Miller 2022-05-01 12:00:28 +10:00 committed by GitHub
parent 14ecf9320c
commit 3eefaa29dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@
import com.sk89q.worldedit.world.block.BlockType;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nullable;
public class BlockStateMask extends AbstractExtentMask {
@ -58,8 +59,12 @@ public boolean test(BlockVector3 vector) {
if (strict && checkProps.isEmpty()) {
return false;
}
return checkProps.entrySet().stream()
.allMatch(entry -> block.getState(entry.getKey()) == entry.getValue());
for (Map.Entry<Property<Object>, Object> entry : checkProps.entrySet()) {
if (!Objects.equals(block.getState(entry.getKey()), entry.getValue())) {
return false;
}
}
return true;
}
@Nullable