Skip to content

Commit 5603693

Browse files
authored
fix: don't lock for chunk packets/section write on main thread (#3059)
1 parent 1b31eac commit 5603693

File tree

1 file changed

+4
-0
lines changed
  • worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter

1 file changed

+4
-0
lines changed

worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.fastasyncworldedit.bukkit.FaweBukkitWorld;
44
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
5+
import com.fastasyncworldedit.core.Fawe;
56
import com.fastasyncworldedit.core.math.IntPair;
67
import com.fastasyncworldedit.core.queue.IChunkGet;
78
import com.fastasyncworldedit.core.util.MathMan;
@@ -124,6 +125,9 @@ protected static <LevelChunkSection> boolean setSectionAtomic(
124125
if (layer < 0 || layer >= sections.length) {
125126
return false;
126127
}
128+
if (Fawe.isMainThread()) {
129+
return ReflectionUtils.compareAndSet(sections, expected, value, layer);
130+
}
127131
StampLockHolder holder = new StampLockHolder();
128132
ConcurrentHashMap<IntPair, ChunkSendLock> chunks = FaweBukkitWorld.getWorldSendingChunksMap(worldName);
129133
chunks.compute(pair, (k, lock) -> {

0 commit comments

Comments
 (0)