mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 05:05:24 +01:00
Add Helper methods in AdventureComponentConverter for relocating plugins (#2934)
This commit is contained in:
parent
7d4458bb5f
commit
e07f01ece8
@ -38,6 +38,33 @@ public class AdventureComponentConverter {
|
||||
return GsonComponentSerializer.gson().deserialize(wrapper.getJson());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link WrappedChatComponent} into a {@link Component}
|
||||
* @param wrapper ProtocolLib wrapper
|
||||
* @return Component
|
||||
*/
|
||||
public static Object fromWrapperAsObject(WrappedChatComponent wrapper) {
|
||||
return fromWrapper(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a JSON {@link String} into a Component
|
||||
* @param json Json String
|
||||
* @return Component
|
||||
*/
|
||||
public static Component fromJson(final String json) {
|
||||
return GsonComponentSerializer.gson().deserialize(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a JSON {@link String} into a Component object
|
||||
* @param json Json String
|
||||
* @return Component object
|
||||
*/
|
||||
public static Object fromJsonAsObject(final String json) {
|
||||
return fromJson(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link Component} into a ProtocolLib wrapper
|
||||
* @param component Component
|
||||
|
Loading…
Reference in New Issue
Block a user