Add Helper methods in AdventureComponentConverter for relocating plugins (#2934)

This commit is contained in:
iiAhmedYT 2024-06-03 06:35:22 +03:00 committed by GitHub
parent 7d4458bb5f
commit e07f01ece8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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