1 package org.bukkit.command.defaults;
3 import java.util.ArrayList;
4 import java.util.Arrays;
7 import org.apache.commons.lang.Validate;
8 import org.bukkit.Bukkit;
9 import org.bukkit.ChatColor;
10 import org.bukkit.command.CommandSender;
11 import org.bukkit.plugin.Plugin;
12 import org.bukkit.plugin.PluginDescriptionFile;
13 import org.bukkit.util.StringUtil;
15 import com.google.common.collect.ImmutableList;
21 this.
description =
"Gets the version of this server including any plugins in use";
24 this.
setAliases(Arrays.asList(
"ver",
"about"));
31 if (args.length == 0) {
34 StringBuilder name =
new StringBuilder();
36 for (String arg : args) {
37 if (name.length() > 0) {
44 String pluginName = name.toString();
46 if (exactPlugin != null) {
47 describeToSender(exactPlugin, sender);
51 boolean found =
false;
52 pluginName = pluginName.toLowerCase();
54 if (plugin.getName().toLowerCase().contains(pluginName)) {
55 describeToSender(plugin, sender);
61 sender.
sendMessage(
"This server is not running any plugin by that name.");
62 sender.
sendMessage(
"Use /plugins to get a list of plugins.");
89 private String getAuthors(
final PluginDescriptionFile desc) {
90 StringBuilder result =
new StringBuilder();
91 List<String> authors = desc.getAuthors();
93 for (
int i = 0; i < authors.size(); i++) {
94 if (result.length() > 0) {
95 result.append(ChatColor.WHITE);
97 if (i < authors.size() - 1) {
100 result.append(
" and ");
104 result.append(ChatColor.GREEN);
105 result.append(authors.get(i));
108 return result.toString();
113 Validate.notNull(sender,
"Sender cannot be null");
114 Validate.notNull(args,
"Arguments cannot be null");
115 Validate.notNull(alias,
"Alias cannot be null");
117 if (args.length == 1) {
118 List<String> completions =
new ArrayList<String>();
119 String toComplete = args[0].toLowerCase();
122 completions.add(plugin.
getName());
127 return ImmutableList.of();