Merge branch 'master' into acquirable

This commit is contained in:
TheMode 2021-04-16 02:36:46 +02:00
commit be0c425dfc
2 changed files with 17 additions and 14 deletions

View File

@ -869,6 +869,7 @@ public abstract class Instance implements BlockModifier, Tickable, EventHandler,
if (isPlayer) { if (isPlayer) {
final Player player = (Player) entity; final Player player = (Player) entity;
getWorldBorder().init(player); getWorldBorder().init(player);
player.getPlayerConnection().sendPacket(createTimePacket());
} }
// Send all visible entities // Send all visible entities

View File

@ -183,9 +183,14 @@ public class NettyPlayerConnection extends PlayerConnection {
return; return;
} }
// Retrieve safe copy
final ByteBuf copy;
synchronized (tickBuffer) { synchronized (tickBuffer) {
final ByteBuf copy = tickBuffer.copy(); copy = tickBuffer.copy();
tickBuffer.clear();
}
// Write copied buffer to netty
ChannelFuture channelFuture = channel.write(new FramedPacket(copy)); ChannelFuture channelFuture = channel.write(new FramedPacket(copy));
channelFuture.addListener(future -> copy.release()); channelFuture.addListener(future -> copy.release());
@ -197,9 +202,6 @@ public class NettyPlayerConnection extends PlayerConnection {
} }
}); });
} }
tickBuffer.clear();
}
} }
public void flush() { public void flush() {