Allow FramedPackets to be sent safely

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-16 19:37:30 +02:00
parent be4542e936
commit 4b5ec566bd
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -246,7 +246,7 @@ public class PlayerSocketConnection extends PlayerConnection {
}
public void write(@NotNull FramedPacket framedPacket) {
write(framedPacket.body().position(0));
write(framedPacket.body().duplicate().position(0));
}
public void write(@NotNull ServerPacket packet) {