/pl improvement

This commit is contained in:
Frank van der Heijden 2021-08-04 02:39:50 +02:00
parent 5200840296
commit ae6f361ac1
No known key found for this signature in database
GPG key ID: B808721C2DD5B5B8

View file

@ -7,6 +7,8 @@ import net.frankheijden.serverutils.common.config.MessagesResource;
import net.frankheijden.serverutils.common.entities.ServerUtilsAudience;
import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
import net.frankheijden.serverutils.common.utils.ListComponentBuilder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template;
public abstract class CommandPlugins<U extends ServerUtilsPlugin<P, ?, C, ?, ?>, P, C extends ServerUtilsAudience<?>>
@ -28,14 +30,16 @@ public abstract class CommandPlugins<U extends ServerUtilsPlugin<P, ?, C, ?, ?>,
MessagesResource messages = plugin.getMessagesResource();
sender.sendMessage(messages.get(MessageKey.PLUGINS_HEADER).toComponent());
sender.sendMessage(messages.get(MessageKey.PLUGINS_PREFIX).toComponent(
TextComponent.Builder builder = Component.text();
builder.append(messages.get(MessageKey.PLUGINS_PREFIX).toComponent(
Template.of("count", String.valueOf(plugins.size()))
));
sender.sendMessage(ListComponentBuilder.create(plugins)
builder.append(ListComponentBuilder.create(plugins)
.separator(messages.get(MessageKey.PLUGINS_SEPARATOR).toComponent())
.lastSeparator(messages.get(MessageKey.PLUGINS_LAST_SEPARATOR).toComponent())
.format(pluginFormat)
.build());
sender.sendMessage(builder.build());
sender.sendMessage(messages.get(MessageKey.PLUGININFO_FOOTER).toComponent());
}
}