mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 10:12:06 -07:00
#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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user