Remove newlines on /pl command

This commit is contained in:
Frank van der Heijden 2021-08-04 00:42:56 +02:00
parent ae0005a82a
commit 11392b847b
No known key found for this signature in database
GPG key ID: B808721C2DD5B5B8

View file

@ -7,7 +7,6 @@ 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.minimessage.Template;
public abstract class CommandPlugins<U extends ServerUtilsPlugin<P, ?, C, ?, ?>, P, C extends ServerUtilsAudience<?>>
@ -27,19 +26,16 @@ public abstract class CommandPlugins<U extends ServerUtilsPlugin<P, ?, C, ?, ?>,
*/
protected void handlePlugins(C sender, List<P> plugins, ListComponentBuilder.Format<P> pluginFormat) {
MessagesResource messages = plugin.getMessagesResource();
sender.sendMessage(Component.text()
.append(messages.get(MessageKey.PLUGINS_HEADER).toComponent())
.append(Component.newline())
.append(messages.get(MessageKey.PLUGINS_PREFIX).toComponent(
Template.of("count", String.valueOf(plugins.size()))
))
.append(ListComponentBuilder.create(plugins)
.separator(messages.get(MessageKey.PLUGINS_SEPARATOR).toComponent())
.lastSeparator(messages.get(MessageKey.PLUGINS_LAST_SEPARATOR).toComponent())
.format(pluginFormat)
.build())
.append(Component.newline())
.append(messages.get(MessageKey.PLUGININFO_FOOTER).toComponent())
sender.sendMessage(messages.get(MessageKey.PLUGINS_HEADER).toComponent());
sender.sendMessage(messages.get(MessageKey.PLUGINS_PREFIX).toComponent(
Template.of("count", String.valueOf(plugins.size()))
));
sender.sendMessage(ListComponentBuilder.create(plugins)
.separator(messages.get(MessageKey.PLUGINS_SEPARATOR).toComponent())
.lastSeparator(messages.get(MessageKey.PLUGINS_LAST_SEPARATOR).toComponent())
.format(pluginFormat)
.build());
sender.sendMessage(messages.get(MessageKey.PLUGININFO_FOOTER).toComponent());
}
}