Sending chunks should be thread safe

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-03 13:57:19 +02:00
parent 3d5ae6fe94
commit 538ef75552

View File

@ -124,7 +124,7 @@ public class DynamicChunk extends Chunk {
} }
@Override @Override
public void sendChunk(@NotNull Player player) { public synchronized void sendChunk(@NotNull Player player) {
if (!isLoaded()) return; if (!isLoaded()) return;
final PlayerConnection connection = player.getPlayerConnection(); final PlayerConnection connection = player.getPlayerConnection();
final long lastChange = getLastChangeTime(); final long lastChange = getLastChangeTime();
@ -141,7 +141,7 @@ public class DynamicChunk extends Chunk {
} }
@Override @Override
public void sendChunk() { public synchronized void sendChunk() {
if (!isLoaded()) return; if (!isLoaded()) return;
if (getViewers().isEmpty()) return; if (getViewers().isEmpty()) return;
final long lastChange = getLastChangeTime(); final long lastChange = getLastChangeTime();