mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 09:27:58 +01:00
Add converter from Component to JsonMessage
This commit is contained in:
parent
653859e784
commit
52831e7091
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user