mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Use a finalizer for light packet instead of onPacketDone
Sadly sharing packets is breaking the ability to do this :( We can prob still do a little better than this but will save that for another commit.
This commit is contained in:
parent
9204e8c641
commit
7f8e789cf3
1 changed files with 8 additions and 4 deletions
|
@ -151,12 +151,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public PacketPlayOutLightUpdate() {}
|
||||
+ // Paper start
|
||||
+ private final java.util.List<byte[]> usedBytes = new java.util.ArrayList<>();
|
||||
+ private java.util.List<byte[]> usedBytes = new java.util.ArrayList<>();
|
||||
+
|
||||
+ @Override
|
||||
+ public void onPacketDone() {
|
||||
+ usedBytes.forEach(NibbleArray::releaseBytes);
|
||||
+ usedBytes.clear();
|
||||
+ public void finalize() throws Throwable {
|
||||
+ try {
|
||||
+ usedBytes.forEach(NibbleArray::releaseBytes);
|
||||
+ usedBytes.clear();
|
||||
+ } finally {
|
||||
+ super.finalize();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
|
|
Loading…
Reference in a new issue