Fix disabled plugins format + cleanup
This commit is contained in:
parent
37823c34c5
commit
8850983a4d
4 changed files with 37 additions and 73 deletions
|
|
@ -5,16 +5,12 @@ import cloud.commandframework.CommandManager;
|
|||
import cloud.commandframework.context.CommandContext;
|
||||
import net.frankheijden.serverutils.bungee.entities.BungeeAudience;
|
||||
import net.frankheijden.serverutils.bungee.entities.BungeePlugin;
|
||||
import net.frankheijden.serverutils.bungee.entities.BungeePluginDescription;
|
||||
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
||||
import net.frankheijden.serverutils.common.config.MessageKey;
|
||||
import net.frankheijden.serverutils.common.config.MessagesResource;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.api.plugin.PluginDescription;
|
||||
|
||||
public class BungeeCommandPlugins extends CommandPlugins<BungeePlugin, Plugin, BungeeAudience> {
|
||||
@SuppressWarnings("LineLength")
|
||||
public class BungeeCommandPlugins extends CommandPlugins<BungeePlugin, Plugin, BungeeAudience, BungeePluginDescription> {
|
||||
|
||||
public BungeeCommandPlugins(BungeePlugin plugin) {
|
||||
super(plugin);
|
||||
|
|
@ -37,21 +33,6 @@ public class BungeeCommandPlugins extends CommandPlugins<BungeePlugin, Plugin, B
|
|||
boolean hasVersionFlag = context.flags().contains("version");
|
||||
boolean hasModulesFlag = context.flags().contains("modules");
|
||||
|
||||
MessagesResource messages = plugin.getMessagesResource();
|
||||
handlePlugins(sender, plugin.getPluginManager().getPluginsSorted(hasModulesFlag), bungeePlugin -> {
|
||||
PluginDescription description = bungeePlugin.getDescription();
|
||||
|
||||
TextComponent.Builder builder = Component.text();
|
||||
builder.append(messages.get(MessageKey.PLUGINS_FORMAT).toComponent(
|
||||
Template.of("plugin", description.getName())
|
||||
));
|
||||
if (hasVersionFlag) {
|
||||
builder.append(messages.get(MessageKey.PLUGINS_VERSION).toComponent(
|
||||
Template.of("version", description.getVersion())
|
||||
));
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
});
|
||||
handlePlugins(sender, plugin.getPluginManager().getPluginsSorted(hasModulesFlag), hasVersionFlag);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue