Add converter from Component to JsonMessage

This commit is contained in:
Kieran Wallbanks 2021-03-02 14:45:54 +00:00
parent 653859e784
commit 52831e7091

View File

@ -58,6 +58,10 @@ public abstract class JsonMessage implements ComponentLike {
return GsonComponentSerializer.gson().deserialize(this.toString());
}
public static @NotNull JsonMessage fromComponent(@NotNull Component component) {
return new RawJsonMessage(GsonComponentSerializer.gson().serialize(component));
}
/**
* Gets the Json representation.
* <p>