Add format for disabled plugins in plugin list
This commit is contained in:
parent
59f721ee98
commit
0132c06483
2 changed files with 10 additions and 3 deletions
|
|
@ -18,15 +18,21 @@ public class CommandPlugins extends BaseCommand {
|
||||||
@CommandPermission("serverutils.plugins")
|
@CommandPermission("serverutils.plugins")
|
||||||
@Description("Shows the plugins of this server.")
|
@Description("Shows the plugins of this server.")
|
||||||
public void onPlugins(CommandSender sender) {
|
public void onPlugins(CommandSender sender) {
|
||||||
sendPlugins(sender, plugin -> Messenger.getMessage("serverutils.plugins.format", "%plugin%", plugin.getName()));
|
sendPlugins(sender, pl -> {
|
||||||
|
String format = "serverutils.plugins.format" + (pl.isEnabled() ? "" : "_disabled");
|
||||||
|
return Messenger.getMessage(format, "%plugin%", pl.getName());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("-v")
|
@Subcommand("-v")
|
||||||
@CommandPermission("serverutils.plugins.version")
|
@CommandPermission("serverutils.plugins.version")
|
||||||
@Description("Shows the plugins of this server with version.")
|
@Description("Shows the plugins of this server with version.")
|
||||||
public void onPluginsWithVersion(CommandSender sender) {
|
public void onPluginsWithVersion(CommandSender sender) {
|
||||||
sendPlugins(sender, plugin -> Messenger.getMessage("serverutils.plugins.format", "%plugin%", plugin.getName())
|
sendPlugins(sender, pl -> {
|
||||||
+ Messenger.getMessage("serverutils.plugins.version", "%version%", plugin.getDescription().getVersion()));
|
String format = "serverutils.plugins.format" + (pl.isEnabled() ? "" : "_disabled");
|
||||||
|
String version = Messenger.getMessage("serverutils.plugins.version", "%version%", pl.getDescription().getVersion());
|
||||||
|
return Messenger.getMessage(format, "%plugin%", pl.getName()) + version;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendPlugins(CommandSender sender, ListFormat<Plugin> pluginFormat) {
|
private static void sendPlugins(CommandSender sender, ListFormat<Plugin> pluginFormat) {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public class Messenger {
|
||||||
"plugins", Defaults.of(
|
"plugins", Defaults.of(
|
||||||
"header", "&8&m------------=&r&8[ &b&lServerUtils Plugins&r &8]&m=-------------",
|
"header", "&8&m------------=&r&8[ &b&lServerUtils Plugins&r &8]&m=-------------",
|
||||||
"format", "&3%plugin%",
|
"format", "&3%plugin%",
|
||||||
|
"format_disabled", "&c%plugin%",
|
||||||
"seperator", "&b, ",
|
"seperator", "&b, ",
|
||||||
"last_seperator", " &band ",
|
"last_seperator", " &band ",
|
||||||
"version", " &8(&a%version%&8)",
|
"version", " &8(&a%version%&8)",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue