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) {
final Player player = (Player) entity;
getWorldBorder().init(player);
player.getPlayerConnection().sendPacket(createTimePacket());
}
// Send all visible entities

View File

@ -183,23 +183,25 @@ public class NettyPlayerConnection extends PlayerConnection {
return;
}
// Retrieve safe copy
final ByteBuf copy;
synchronized (tickBuffer) {
final ByteBuf copy = tickBuffer.copy();
ChannelFuture channelFuture = channel.write(new FramedPacket(copy));
channelFuture.addListener(future -> copy.release());
// Netty debug
if (MinecraftServer.shouldProcessNettyErrors()) {
channelFuture.addListener(future -> {
if (!future.isSuccess() && channel.isActive()) {
MinecraftServer.getExceptionManager().handleException(future.cause());
}
});
}
copy = tickBuffer.copy();
tickBuffer.clear();
}
// Write copied buffer to netty
ChannelFuture channelFuture = channel.write(new FramedPacket(copy));
channelFuture.addListener(future -> copy.release());
// Netty debug
if (MinecraftServer.shouldProcessNettyErrors()) {
channelFuture.addListener(future -> {
if (!future.isSuccess() && channel.isActive()) {
MinecraftServer.getExceptionManager().handleException(future.cause());
}
});
}
}
public void flush() {