diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java index 0d9a74e..cd2651a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java @@ -92,7 +92,13 @@ public class ScreenNetworkingImpl implements ScreenNetworking { if (receiver != null) { buf.retain(); - executor.execute(() -> receiver.onMessage(buf)); + executor.execute(() -> { + try { + receiver.onMessage(buf); + } finally { + buf.release(); + } + }); } else { LOGGER.warn("Message {} not registered for {} on side {}", messageId, screenHandler, networking.side); } |