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
This commit is contained in:
parent
1476d0628a
commit
04246d4c88
|
@ -277,8 +277,7 @@ impl Serializable for format::Component {
|
||||||
let len = VarInt::read_from(buf)?.0;
|
let len = VarInt::read_from(buf)?.0;
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
buf.take(len as u64).read_to_string(&mut ret)?;
|
buf.take(len as u64).read_to_string(&mut ret)?;
|
||||||
let val: serde_json::Value = serde_json::from_str(&ret[..]).unwrap();
|
Result::Ok(Self::from_string(&ret[..]))
|
||||||
Result::Ok(Self::from_value(&val))
|
|
||||||
}
|
}
|
||||||
fn write_to<W: io::Write>(&self, buf: &mut W) -> Result<(), Error> {
|
fn write_to<W: io::Write>(&self, buf: &mut W) -> Result<(), Error> {
|
||||||
let val = serde_json::to_string(&self.to_value()).unwrap();
|
let val = serde_json::to_string(&self.to_value()).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue