diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java index cbce524442..abbd1c35f9 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java @@ -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 names) { StringBuilder result = new StringBuilder(); - List 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(); diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index 70d508190d..f78a7df6e2 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -78,6 +78,10 @@ import org.yaml.snakeyaml.nodes.Tag; * * author
authors * {@link #getAuthors()} + * The plugin authors + * + * contributors + * {@link #getContributors()} * The plugin contributors * * description @@ -142,6 +146,7 @@ import org.yaml.snakeyaml.nodes.Tag; *# name is displayed first *author: CaptainInflamo *authors: [Cogito, verrier, EvilSeph] + *contributors: [Choco, md_5] *website: http://www.curse.com/server-mods/minecraft/myplugin * *main: com.captaininflamo.bukkit.inferno.Inferno @@ -233,6 +238,7 @@ public final class PluginDescriptionFile { private Map> commands = ImmutableMap.of(); private String description = null; private List authors = null; + private List contributors = null; private String website = null; private String prefix = null; private PluginLoadOrder order = PluginLoadOrder.POSTWORLD; @@ -434,7 +440,7 @@ public final class PluginDescriptionFile { *
  • Gives credit to the developer. *
  • Used in some server error messages to provide helpful feedback on * who to contact when an error occurs. - *
  • A bukkit.org forum handle or email address is recommended. + *
  • A SpigotMC forum handle or email address is recommended. *
  • Is displayed when a user types /version PluginName *
  • authors must be in YAML list @@ -464,6 +470,30 @@ public final class PluginDescriptionFile { return authors; } + /** + * Gives the list of contributors for the plugin. + * + *

    + * Example: + *

    authors: [Choco, md_5]
    + * + * @return an immutable list of the plugin's contributors + */ + @NotNull + public List getContributors() { + return contributors; + } + /** * Gives the plugin's or plugin's author's website. *
      @@ -1057,6 +1087,20 @@ public final class PluginDescriptionFile { authors = ImmutableList.of(); } + if (map.get("contributors") != null) { + ImmutableList.Builder contributorsBuilder = ImmutableList.builder(); + try { + for (Object o : (Iterable) map.get("contributors")) { + contributorsBuilder.add(o.toString()); + } + } catch (ClassCastException ex) { + throw new InvalidDescriptionException(ex, "contributors are of wrong type"); + } + contributors = contributorsBuilder.build(); + } else { + contributors = ImmutableList.of(); + } + if (map.get("default-permission") != null) { try { defaultPerm = PermissionDefault.getByName(map.get("default-permission").toString()); @@ -1149,6 +1193,10 @@ public final class PluginDescriptionFile { map.put("authors", authors); } + if (contributors != null) { + map.put("contributors", contributors); + } + if (apiVersion != null) { map.put("api-version", apiVersion); }