mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 01:47:54 +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());
|
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.
|
* Gets the Json representation.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user