Recognize translate text components, instead of showing "UNHANDLED"

For example, if a server connection times out and you are kicked, Steven
will now show disconnect.reason timeout, versus a non-descriptive
UNHANDLED message. This text is supposed to be looked up in a
translation table for localization, not yet supported, but showing the
translation identifier is more informative than nothing.
This commit is contained in:
ice_iix 2018-12-02 12:29:05 -08:00
parent 8dade5b230
commit 36d9c1383e
1 changed files with 3 additions and 0 deletions

View File

@ -45,6 +45,9 @@ impl Component {
})
} else if v.get("text").is_some() {
Component::Text(TextComponent::from_value(v, modifier))
} else if v.get("translate").is_some() {
// TODO: translations
Component::Text(TextComponent::new(v.get("translate").unwrap().as_str().unwrap()))
} else {
modifier.color = Some(Color::RGB(255, 0, 0));
Component::Text(TextComponent {