/** * Construct a wrapper around a new text chat component with the given text. * @param text - the text of the text chat component. * @return The wrapper around the new chat component. */ public static WrappedChatComponent fromText(String text) { Preconditions.checkNotNull(text, "text cannot be NULL."); return fromHandle(CONSTRUCT_TEXT_COMPONENT.invoke(text)); }
/** * Retrieve the message of the day. * @return The messge of the day. */ public WrappedChatComponent getMotD() { return WrappedChatComponent.fromHandle(DESCRIPTION.get(handle)); }
/** * Construct an array of chat components from a standard Minecraft message. * <p> * This uses {@link ChatColor} for formating. * @param message - the message. * @return The equivalent chat components. */ public static WrappedChatComponent[] fromChatMessage(String message) { Object[] components = (Object[]) CONSTRUCT_COMPONENT.invoke(null, message); WrappedChatComponent[] result = new WrappedChatComponent[components.length]; for (int i = 0; i < components.length; i++) { result[i] = fromHandle(components[i]); } return result; }
WrappedChatComponent componentWrapper = WrappedChatComponent.fromHandle(customNameOptional.get()); customName = componentWrapper.getJson();
return WrappedChatComponent.fromHandle(value); } else if (is(MinecraftReflection.getItemStackClass(), value)) { return BukkitConverters.getItemStackConverter().getSpecific(value);