Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Ursprung
006ccd6887
Commit
2f6de996e3
@ -4,6 +4,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class ExtentTraverser<T extends Extent> {
|
public class ExtentTraverser<T extends Extent> {
|
||||||
@ -24,6 +25,7 @@ public class ExtentTraverser<T extends Extent> {
|
|||||||
return root != null;
|
return root != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public T get() {
|
public T get() {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -50,6 +52,7 @@ public class ExtentTraverser<T extends Extent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@Nullable
|
||||||
public <U> U findAndGet(Class<U> clazz) {
|
public <U> U findAndGet(Class<U> clazz) {
|
||||||
ExtentTraverser<Extent> traverser = find(clazz);
|
ExtentTraverser<Extent> traverser = find(clazz);
|
||||||
return (traverser != null) ? (U) traverser.get() : null;
|
return (traverser != null) ? (U) traverser.get() : null;
|
||||||
|
@ -529,10 +529,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
//FAWE start - ExtentTraverser & MaskingExtents
|
//FAWE start - ExtentTraverser & MaskingExtents
|
||||||
MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class);
|
MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class);
|
||||||
if (maskingExtent == null) {
|
if (maskingExtent == null) {
|
||||||
ExtentTraverser<ExtentBatchProcessorHolder> processorExtent =
|
ExtentBatchProcessorHolder processorExtent =
|
||||||
new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class);
|
new ExtentTraverser<>(getExtent()).findAndGet(ExtentBatchProcessorHolder.class);
|
||||||
maskingExtent =
|
if (processorExtent != null) {
|
||||||
new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class);
|
maskingExtent =
|
||||||
|
new ProcessorTraverser<>(processorExtent.getProcessor()).find(MaskingExtent.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return maskingExtent != null ? maskingExtent.getMask() : null;
|
return maskingExtent != null ? maskingExtent.getMask() : null;
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren