#525: Add contributors plugin.yml field.

Unlike "authors", names listed under the "contributors" field will not be named when AuthorNagExceptions are thrown. This makes a clear distinction between authorship and contributors as most contributions do not warrant the status of "author".

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot
2020-07-22 18:17:07 +10:00
parent 2b0e21f46d
commit 4e44fa11b3
2 changed files with 59 additions and 8 deletions

View File

@@ -91,23 +91,26 @@ public class VersionCommand extends BukkitCommand {
if (!desc.getAuthors().isEmpty()) {
if (desc.getAuthors().size() == 1) {
sender.sendMessage("Author: " + getAuthors(desc));
sender.sendMessage("Author: " + getNameList(desc.getAuthors()));
} else {
sender.sendMessage("Authors: " + getAuthors(desc));
sender.sendMessage("Authors: " + getNameList(desc.getAuthors()));
}
}
if (!desc.getContributors().isEmpty()) {
sender.sendMessage("Contributors: " + getNameList(desc.getContributors()));
}
}
@NotNull
private String getAuthors(@NotNull final PluginDescriptionFile desc) {
private String getNameList(@NotNull final List<String> names) {
StringBuilder result = new StringBuilder();
List<String> authors = desc.getAuthors();
for (int i = 0; i < authors.size(); i++) {
for (int i = 0; i < names.size(); i++) {
if (result.length() > 0) {
result.append(ChatColor.WHITE);
if (i < authors.size() - 1) {
if (i < names.size() - 1) {
result.append(", ");
} else {
result.append(" and ");
@@ -115,7 +118,7 @@ public class VersionCommand extends BukkitCommand {
}
result.append(ChatColor.GREEN);
result.append(authors.get(i));
result.append(names.get(i));
}
return result.toString();