mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
Added plugin count to the PluginsCommand.
By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user