Search in sources :

Example 1 with TextTemplate

use of org.spongepowered.api.text.TextTemplate in project Nucleus by NucleusPowered.

the class MessageProvider method getTextMessageWithTextFormat.

private Text getTextMessageWithTextFormat(String key, List<Text> textList) {
    TextTemplate template = this.textTemplateMap.computeIfAbsent(key, k -> templateCreator(getMessageWithFormat(k)));
    if (textList.isEmpty()) {
        return template.toText();
    }
    Map<String, Text> objs = Maps.newHashMap();
    for (int i = 0; i < textList.size(); i++) {
        objs.put(String.valueOf(i), textList.get(i));
    }
    return template.apply(objs).build();
}
Also used : Text(org.spongepowered.api.text.Text) TextTemplate(org.spongepowered.api.text.TextTemplate)

Aggregations

Text (org.spongepowered.api.text.Text)1 TextTemplate (org.spongepowered.api.text.TextTemplate)1