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.bukkit.entities.BukkitAudience;
|
||||
import net.frankheijden.serverutils.bukkit.entities.BukkitPlugin;
|
||||
import net.frankheijden.serverutils.bukkit.entities.BukkitPluginDescription;
|
||||
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 org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
public class BukkitCommandPlugins extends CommandPlugins<BukkitPlugin, Plugin, BukkitAudience> {
|
||||
@SuppressWarnings("LineLength")
|
||||
public class BukkitCommandPlugins extends CommandPlugins<BukkitPlugin, Plugin, BukkitAudience, BukkitPluginDescription> {
|
||||
|
||||
public BukkitCommandPlugins(BukkitPlugin plugin) {
|
||||
super(plugin);
|
||||
|
|
@ -35,21 +31,6 @@ public class BukkitCommandPlugins extends CommandPlugins<BukkitPlugin, Plugin, B
|
|||
BukkitAudience sender = context.getSender();
|
||||
boolean hasVersionFlag = context.flags().contains("version");
|
||||
|
||||
MessagesResource messages = plugin.getMessagesResource();
|
||||
handlePlugins(sender, plugin.getPluginManager().getPluginsSorted(), bukkitPlugin -> {
|
||||
PluginDescriptionFile description = bukkitPlugin.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(), hasVersionFlag);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue