Permalink
Browse files

Fixed ranged collector requiring all filters to pass.

  • Loading branch information...
me4502 committed Dec 17, 2016
1 parent e2ba190 commit ffd930f5986ddf45fa85bc2cfb6fd6db7906055e
@@ -106,21 +106,28 @@ public boolean collect() {
if (entity.isValid() && entity instanceof Item) {
if (LocationUtil.isWithinRadius(centre, entity.getLocation(), radius)) {
- stackCheck: {
ItemStack stack = ((Item) entity).getItemStack();
if(!ItemUtil.isStackValid(stack))
return false;
- for(ItemStack filter : filters) {
+ boolean passed = !include;
+ for(ItemStack filter : filters) {
if(!ItemUtil.isStackValid(filter))
continue;
- if(include && !ItemUtil.areItemsIdentical(filter, stack))
- break stackCheck;
- else if(!include && ItemUtil.areItemsIdentical(filter, stack))
- break stackCheck;
+ if(include && ItemUtil.areItemsIdentical(filter, stack)) {
+ passed = true;
+ break;
+ } else if(!include && ItemUtil.areItemsIdentical(filter, stack)) {
+ passed = false;
+ break;
+ }
+ }
+
+ if (!passed) {
+ continue;
}
BlockFace back = SignUtil.getBack(BukkitUtil.toSign(getSign()).getBlock());
@@ -149,7 +156,6 @@ else if(!include && ItemUtil.areItemsIdentical(filter, stack))
}
}
}
- }
}
}

0 comments on commit ffd930f

Please sign in to comment.