mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-02 22:02:17 +00:00
Log error on protocol encode & decode fail
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user