From 538ef75552f751f2f8a2922557fd15686e547123 Mon Sep 17 00:00:00 2001 From: TheMode Date: Fri, 3 Sep 2021 13:57:19 +0200 Subject: [PATCH] Sending chunks should be thread safe Signed-off-by: TheMode --- src/main/java/net/minestom/server/instance/DynamicChunk.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/instance/DynamicChunk.java b/src/main/java/net/minestom/server/instance/DynamicChunk.java index c38eea11d..08b2fcb8b 100644 --- a/src/main/java/net/minestom/server/instance/DynamicChunk.java +++ b/src/main/java/net/minestom/server/instance/DynamicChunk.java @@ -124,7 +124,7 @@ public class DynamicChunk extends Chunk { } @Override - public void sendChunk(@NotNull Player player) { + public synchronized void sendChunk(@NotNull Player player) { if (!isLoaded()) return; final PlayerConnection connection = player.getPlayerConnection(); final long lastChange = getLastChangeTime(); @@ -141,7 +141,7 @@ public class DynamicChunk extends Chunk { } @Override - public void sendChunk() { + public synchronized void sendChunk() { if (!isLoaded()) return; if (getViewers().isEmpty()) return; final long lastChange = getLastChangeTime();