package in.twizmwaz.cardinal.module.modules.filter.type;

import in.twizmwaz.cardinal.GameHandler;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.filter.parsers.GenericFilterParser;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;

import static in.twizmwaz.cardinal.module.modules.filter.FilterState.*;

public class VoidFilter extends FilterModule {
    
    public VoidFilter(final GenericFilterParser parser) {
        super(parser.getName(), parser.getParent());
    }

    @Override
    public FilterState evaluate(final Object... objects) {
        for (Object object : objects) {
            if (object instanceof Block) {
                Block check = new Location(GameHandler.getGameHandler().getMatchWorld(),
                        ((Block) object).getX(), 0, ((Block) object).getZ()).getBlock();
                return check.getType() == Material.AIR && !check.equals(object) ? (getParent() == null ? ALLOW : (getParent().evaluate(objects).equals(DENY) ? DENY : ALLOW)) : DENY;
            }
        }
        return (getParent() == null ? ABSTAIN : getParent().evaluate(objects));
    }
}

@@ -294,24 +294,50 @@
 lterParser;%0A
+import org.bukkit.Bukkit;%0A
 import org.b
@@ -903,32 +903,8 @@
 d(),
-%0A                       
  ((B
@@ -965,16 +965,156 @@
 lock();%0A
+                if (object.equals(check)) return getParent() == null ? ALLOW : (getParent().evaluate(objects).equals(DENY) ? DENY : ALLOW);%0A
         
@@ -1163,33 +1163,8 @@
 .AIR
- && !check.equals(object)
  ? (

Make sure that the block being evaluated in a void filter is not the same as the block it's compared to, fixes #282