Skip to content

Commit 69b33dc

Browse files
Handle invalid disconnect message in 1.8->1.9 (ViaVersion#3834)
1 parent c24169c commit 69b33dc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ protected void registerPackets() {
9393
return;
9494
}
9595

96-
STRING_TO_JSON.write(wrapper, wrapper.read(Type.STRING));
96+
final String reason = wrapper.read(Type.STRING);
97+
try {
98+
STRING_TO_JSON.write(wrapper, reason);
99+
} catch (Exception e) {
100+
// Dirty fix for https://github.com/Lenni0451/MCStructs/issues/4, I personally don't think it matters
101+
// too much since it's only the login disconnect message and nothing relevant to the gameplay
102+
wrapper.write(Type.COMPONENT, ComponentUtil.plainToJson(reason));
103+
}
97104
});
98105

99106
// Other Handlers

0 commit comments

Comments
 (0)