Add Helper methods in AdventureComponentConverter for relocating plugins (#2934)
This commit is contained in:
1 parent
7d4458bb5f
commit
e07f01ece8
1 file changed
+27
@@ -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
|
||||
|
||||
Reference in new issue
Block a user