fix: десериализация Text
This commit is contained in:
@@ -50,6 +50,9 @@ public class StatusServerResponse implements Packet {
|
||||
* "favicon": "data:image/png;base64,<data>"
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>Следует обратить внимание, что <code>"description"</code>
|
||||
* может содержать как JSON объект, так и просто Текст</p>
|
||||
*/
|
||||
private String serverInfo;
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ public class TextDeserializer extends StdDeserializer<Text> {
|
||||
|
||||
final JsonNode jsonNode = parser.getCodec().readTree(parser);
|
||||
|
||||
if (jsonNode.isTextual()) {
|
||||
builder.append(jsonNode.asText());
|
||||
} else {
|
||||
Optional.ofNullable(jsonNode.get("text"))
|
||||
.ifPresent(node -> builder.append(node.asText()));
|
||||
Optional.ofNullable(jsonNode.get("color"))
|
||||
@@ -63,6 +66,7 @@ public class TextDeserializer extends StdDeserializer<Text> {
|
||||
builder.append(parser.getCodec().treeToValue(node, Text.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user