Skip to content

Commit 421497d

Browse files
committed
Fix non-JSON sign text rendering, such as on 1.7.10. Closes #135
src/format.rs Component from_string() attempts JSON deserialization using serde_json::from_str, and if it fails falls back to a literal text string. Call from_string() instead of deserializing in format::Component read_from() and then from_value(). Note the from_string() comment: // Sometimes mojang sends a literal string, so we should interpret it literally
1 parent 31a89a7 commit 421497d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

protocol/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ impl Serializable for format::Component {
277277
let len = VarInt::read_from(buf)?.0;
278278
let mut ret = String::new();
279279
buf.take(len as u64).read_to_string(&mut ret)?;
280-
let val: serde_json::Value = serde_json::from_str(&ret[..]).unwrap();
281-
Result::Ok(Self::from_value(&val))
280+
Result::Ok(Self::from_string(&ret[..]))
282281
}
283282
fn write_to<W: io::Write>(&self, buf: &mut W) -> Result<(), Error> {
284283
let val = serde_json::to_string(&self.to_value()).unwrap();

0 commit comments

Comments
 (0)