mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-10 09:21:28 +01:00
Prevent memory leak when dealing with cached packets
This commit is contained in:
parent
56bdb402b1
commit
abbf7f932d
@ -118,13 +118,7 @@ public class NettyPlayerConnection extends PlayerConnection {
|
||||
if (getPlayer() != null) {
|
||||
// Flush happen during #update()
|
||||
if (serverPacket instanceof CacheablePacket && MinecraftServer.hasPacketCaching()) {
|
||||
// Check if the packet is cached or can be
|
||||
final FramedPacket cachedPacket = CacheablePacket.getCache(serverPacket);
|
||||
if (cachedPacket != null) {
|
||||
write(cachedPacket);
|
||||
} else {
|
||||
write(serverPacket, skipTranslating);
|
||||
}
|
||||
CacheablePacket.writeCache(tickBuffer, serverPacket);
|
||||
} else {
|
||||
write(serverPacket, skipTranslating);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user