Skip to content

Commit 23636f3

Browse files
authored
feat: improve output with better-entity usage (#3114)
1 parent 0a0ea67 commit 23636f3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ExtentTraverser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public boolean setNext(T next) {
6464
ReflectionUtils.setFailsafeFieldValue(field, root, next);
6565
return true;
6666
} catch (Throwable e) {
67-
e.printStackTrace();
67+
LOGGER.error(e);
6868
return false;
6969
}
7070
}
@@ -80,7 +80,7 @@ public ExtentTraverser<T> last() {
8080
}
8181

8282
@Nullable
83-
public <U extends Extent> U findAndGet(Class<U> clazz) {
83+
public <U extends Extent> U findAndGet(Class<? super U> clazz) {
8484
ExtentTraverser<U> traverser = find(clazz);
8585
return (traverser != null) ? traverser.get() : null;
8686
}
@@ -97,7 +97,7 @@ public <U extends Extent> ExtentTraverser<U> find(Class<U> clazz) {
9797
}
9898
return null;
9999
} catch (Throwable e) {
100-
e.printStackTrace();
100+
LOGGER.error(e);
101101
return null;
102102
}
103103
}
@@ -114,7 +114,7 @@ public <U extends Extent> ExtentTraverser<U> find(Object object) {
114114
}
115115
return null;
116116
} catch (Throwable e) {
117-
e.printStackTrace();
117+
LOGGER.error(e);
118118
return null;
119119
}
120120
}
@@ -135,7 +135,7 @@ public ExtentTraverser<T> next() {
135135
}
136136
return null;
137137
} catch (Throwable e) {
138-
e.printStackTrace();
138+
LOGGER.error(e);
139139
return null;
140140
}
141141
}

worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
import com.google.common.collect.ImmutableList;
4343
import com.google.common.collect.Lists;
4444
import com.sk89q.worldedit.WorldEditException;
45-
import com.sk89q.worldedit.entity.BaseEntity;
4645
import com.sk89q.worldedit.entity.Entity;
4746
import com.sk89q.worldedit.entity.metadata.EntityProperties;
4847
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
4948
import com.sk89q.worldedit.extent.Extent;
49+
import com.sk89q.worldedit.extent.clipboard.Clipboard;
5050
import com.sk89q.worldedit.function.CombinedRegionFunction;
5151
import com.sk89q.worldedit.function.RegionFunction;
5252
import com.sk89q.worldedit.function.RegionMaskingFilter;
@@ -63,11 +63,9 @@
6363
import com.sk89q.worldedit.regions.CuboidRegion;
6464
import com.sk89q.worldedit.regions.FlatRegion;
6565
import com.sk89q.worldedit.regions.Region;
66-
import com.sk89q.worldedit.util.Location;
6766
import com.sk89q.worldedit.util.formatting.text.Component;
6867
import com.sk89q.worldedit.util.formatting.text.TextComponent;
6968
import org.apache.logging.log4j.Logger;
70-
import org.jetbrains.annotations.Nullable;
7169

7270
import java.util.Collection;
7371
import java.util.Collections;
@@ -483,15 +481,19 @@ public static Collection<Entity> getEntities(Extent source, Region region) {
483481
extent = clip.getExtent();
484482
}
485483
IQueueExtent<IQueueChunk> queue = null;
486-
if (Settings.settings().EXPERIMENTAL.IMPROVED_ENTITY_EDITS) {
484+
if (Settings.settings().EXPERIMENTAL.IMPROVED_ENTITY_EDITS && !(source instanceof Clipboard)) {
487485
ParallelQueueExtent parallel = new ExtentTraverser<>(extent).findAndGet(ParallelQueueExtent.class);
488486
if (parallel != null) {
489487
queue = parallel.getExtent();
490488
} else {
491489
queue = new ExtentTraverser<>(extent).findAndGet(SingleThreadQueueExtent.class);
492490
}
493491
if (queue == null) {
494-
LOGGER.warn("Could not find IQueueExtent instance for entity retrieval, OncePerChunkExtent will not work.");
492+
LOGGER.warn("Could not find IQueueExtent from `" + source.getClass().getName() +
493+
"` instance for entity retrieval, OncePerChunkExtent will not work.");
494+
if (Settings.settings().ENABLED_COMPONENTS.DEBUG) {
495+
ExtentTraverser.printNestedExtents(source);
496+
}
495497
}
496498
}
497499
if (queue == null) {

0 commit comments

Comments
 (0)