Skip to content

Commit f3e8554

Browse files
author
Yovach
committed
add: example
1 parent 085f4c5 commit f3e8554

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ player.sendMessage(component);
4646
```
4747
This will send "Stone sword" for a player whose language of play is English and "Espada de piedre" for a Spanish player.
4848

49+
Translatable component into a sentence :
50+
```
51+
/* Our text component (a sentence for example) */
52+
final TextComponent text = new TextComponent("Please use your ");
53+
/* Our component which will be translated by client */
54+
final TranslatableComponent translatableDiamond = new TranslatableComponent(MaterialLang.DIAMOND.getTranslation());
55+
text.addExtra(translatableDiamond);
56+
/* We can put a color on the translated component :) */
57+
translatableDiamond.setColor(net.md_5.bungee.api.ChatColor.GOLD);
58+
player.sendMessage(text);
59+
```
60+
4961
**NOTE :** When I started to create the plugin, I hadn't noticed that there was a plugin similar to this one but that only supports 1.7-1.12 versions. (https://www.spigotmc.org/resources/1-7-x-1-12-language-utils.8859/)
5062

5163

0 commit comments

Comments
 (0)