publicvoid sendCoolMessage
(Player player
){ FunctionalApi api
= FunctionalApi.
get(); if(api
!=null){ Component.
SimplifiedComponent[] components
=newComponent.
SimplifiedComponent[]{newComponent.
SimplifiedComponent("")}; TextComponent[] components2
=newTextComponent[]{newTextComponent(""),
newTextComponent("")}; Component.
SimplifiedComponent simplifiedComponent
=newComponent.
SimplifiedComponent();//Creating a lightweight version of TextComponent from md_5 simplifiedComponent
.
append(newTextComponent("your ")) .
append("custom ") .
append(" ", components
)// " " - delimiter .
append(" ", components2
) .
setHoverEvent(HoverEvent.
Action.
SHOW_TEXT,
"Some hover text") .
setClickEvent(ClickEvent.
Action.
OPEN_URL,
"https://vk.com/alphatwo") .
appendOnStart(newComponent.
SimplifiedComponent("re ")) .
appendOnStart("He") .
translateDefaultColorCodes();//Correctly replaces color codes (usually when switching to a new line, colors using '§' and '&' do not work) String content
= simplifiedComponent.
getString();//We get the text content of the component TextComponent component
= simplifiedComponent.
get();//We get the original component from md_5 api.
getCoreAdapter().
expansion().
sendMessage(player, simplifiedComponent
);//We send the Simplified Component to the player api.
getCoreAdapter().
expansion().
sendMessage(player, component
);//We send the original component to the player
player.
spigot().
sendMessage(simplifiedComponent
);// <- Does not work player.
spigot().
sendMessage(component
);// <- Does not work } }