mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Fix #417
This commit aims to fix existing issues regarding the "0/-1 blocks affected" bug. Introducing the new LinkedFilter class allows us to use multiple filters for single-filter operations, e.g. applying a pattern to blocks while also counting the amount of blocks applied to. SetFilter.java was also removed due to not being used.
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.implementation.filter.MaskFilter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
|
@ -1,38 +0,0 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class MaskFilter<T extends Filter> extends DelegateFilter<T> {
|
||||
private final Supplier<Mask> supplier;
|
||||
private final Mask mask;
|
||||
|
||||
public MaskFilter(T other, Mask mask) {
|
||||
this(other, () -> mask);
|
||||
}
|
||||
|
||||
public MaskFilter(T other, Supplier<Mask> supplier) {
|
||||
this(other, supplier, supplier.get());
|
||||
}
|
||||
|
||||
public MaskFilter(T other, Supplier<Mask> supplier, Mask root) {
|
||||
super(other);
|
||||
this.supplier = supplier;
|
||||
this.mask = root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBlock(FilterBlock block) {
|
||||
if (mask.test(block, block)) {
|
||||
getParent().applyBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaskFilter newInstance(Filter other) {
|
||||
return new MaskFilter<>(other, supplier);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user