mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
parent
006ccd6887
commit
2f6de996e3
@ -4,6 +4,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ExtentTraverser<T extends Extent> {
|
||||
@ -24,6 +25,7 @@ public class ExtentTraverser<T extends Extent> {
|
||||
return root != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T get() {
|
||||
return root;
|
||||
}
|
||||
@ -50,6 +52,7 @@ public class ExtentTraverser<T extends Extent> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
public <U> U findAndGet(Class<U> clazz) {
|
||||
ExtentTraverser<Extent> traverser = find(clazz);
|
||||
return (traverser != null) ? (U) traverser.get() : null;
|
||||
|
@ -529,10 +529,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
//FAWE start - ExtentTraverser & MaskingExtents
|
||||
MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class);
|
||||
if (maskingExtent == null) {
|
||||
ExtentTraverser<ExtentBatchProcessorHolder> processorExtent =
|
||||
new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class);
|
||||
maskingExtent =
|
||||
new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class);
|
||||
ExtentBatchProcessorHolder processorExtent =
|
||||
new ExtentTraverser<>(getExtent()).findAndGet(ExtentBatchProcessorHolder.class);
|
||||
if (processorExtent != null) {
|
||||
maskingExtent =
|
||||
new ProcessorTraverser<>(processorExtent.getProcessor()).find(MaskingExtent.class);
|
||||
}
|
||||
}
|
||||
return maskingExtent != null ? maskingExtent.getMask() : null;
|
||||
//FAWE end
|
||||
|
Loading…
Reference in New Issue
Block a user