Added plugin count to the PluginsCommand.

This commit is contained in:
EvilSeph 2012-03-22 21:40:31 -04:00
parent ce87b04aae
commit 7f5c03101e

View File

@ -20,13 +20,14 @@ public class PluginsCommand extends BukkitCommand {
public boolean execute(CommandSender sender, String currentAlias, String[] args) { public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true; if (!testPermission(sender)) return true;
sender.sendMessage("Plugins: " + getPluginList()); sender.sendMessage("Plugins " + getPluginList());
return true; return true;
} }
private String getPluginList() { private String getPluginList() {
StringBuilder pluginList = new StringBuilder(); StringBuilder pluginList = new StringBuilder();
Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
int pluginCount = 0;
for (Plugin plugin : plugins) { for (Plugin plugin : plugins) {
if (pluginList.length() > 0) { if (pluginList.length() > 0) {
@ -36,8 +37,9 @@ public class PluginsCommand extends BukkitCommand {
pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED); pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
pluginList.append(plugin.getDescription().getName()); pluginList.append(plugin.getDescription().getName());
pluginCount++;
} }
return pluginList.toString(); return "(" + pluginCount + "): " + pluginList.toString();
} }
} }