Skip to content

Commit

Permalink
直接 toString
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jan 13, 2025
1 parent 6de2cac commit f567779
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ public void write(JsonWriter out, TranslationComponent value) throws IOException
// 如果是 TranslationComponent,递归调用 write 方法
TranslationComponentTypeAdapter.INSTANCE.write(out, (TranslationComponent) param);
} else {
out.nullValue(); // 如果是其他类型,写入 null(可以根据需求调整)
out.value(value.toString());
}
}
out.endArray(); // 结束 JSON 数组
out.endObject(); // 结束 JSON 对象

// 特别注意嵌套里面不允许出现除了 TranslationComponent 以外的 JsonObject,否则必翻车
}

@Override
Expand Down

0 comments on commit f567779

Please sign in to comment.