diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java index f6300c8e..88b6ead4 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java @@ -205,7 +205,12 @@ public class LeavesProtocolManager { if (codec == null) { return null; } - return codec.decode(ProtocolUtils.decorate(buf)); + try { + return codec.decode(ProtocolUtils.decorate(buf)); + } catch (Exception e) { + LOGGER.severe("Failed to decode " + location, e); + throw e; + } } public static void encode(FriendlyByteBuf buf, LeavesCustomPayload payload) { @@ -214,8 +219,13 @@ public class LeavesProtocolManager { if (location == null || codec == null) { throw new IllegalArgumentException("Payload " + payload.getClass() + " is not configured correctly " + location + " " + codec); } - buf.writeResourceLocation(location); - codec.encode(ProtocolUtils.decorate(buf), payload); + try { + buf.writeResourceLocation(location); + codec.encode(ProtocolUtils.decorate(buf), payload); + } catch (Exception e) { + LOGGER.severe("Failed to encode payload " + location, e); + throw e; + } } public static void handlePayload(IdentifierSelector selector, LeavesCustomPayload payload) {