@@ -63,8 +63,8 @@ public static JsonObject createDefaultJson() {
6363
6464 private final String packName ;
6565 private final String packId ;
66- private final String packAuthor ;
6766 private final String version ;
67+ private final List <String > packAuthors ;
6868 private final Map <String , List <String >> loaderPaths = new Object2ObjectOpenHashMap <>();
6969 private final List <String > packmodeList = new ArrayList <>();
7070 private final Set <String > packmodeSet = new ObjectOpenHashSet <>();
@@ -94,19 +94,36 @@ public RunConfig(JsonObject json) {
9494 name = CaseFormat .LOWER_UNDERSCORE .to (CaseFormat .UPPER_CAMEL , id ).replace ('_' , ' ' );
9595 }
9696 this .packName = name ;
97- this .packAuthor = JsonHelper .getString (json , "" , "packAuthor" , "author" );
9897 this .packId = id ;
9998 this .version = JsonHelper .getString (json , "1.0.0" , "version" , "ver" );
99+ JsonElement authors = null ;
100+ if (json .has ("author" )) authors = json .get ("author" );
101+ else if (json .has ("packAuthors" )) authors = json .get ("packAuthors" );
102+ if (authors != null ) {
103+ List <String > packAuthors = new ArrayList <>();
104+ if (authors .isJsonPrimitive ()) {
105+ // author list in a single string separated by a comma
106+ packAuthors .addAll (Arrays .stream (StringUtils .split (authors .getAsString (), "," ))
107+ .map (String ::trim )
108+ .filter (s -> !s .isEmpty ())
109+ .collect (Collectors .toList ()));
110+ } else if (authors .isJsonArray ()) {
111+ // authors in a json list, each entry is an author
112+ for (JsonElement author : authors .getAsJsonArray ()) {
113+ if (author .isJsonPrimitive ()) {
114+ packAuthors .add (author .getAsString ());
115+ }
116+ }
117+ }
118+ this .packAuthors = Collections .unmodifiableList (packAuthors );
119+ } else {
120+ this .packAuthors = Collections .emptyList ();
121+ }
100122 modMetadata .modId = this .packId ;
101123 modMetadata .name = this .packName ;
102124 modMetadata .version = this .version ;
103125 modMetadata .parent = GroovyScript .ID ;
104- modMetadata .authorList .addAll (
105- Arrays .stream (StringUtils .split (this .packAuthor , "," ))
106- .map (String ::trim )
107- .filter (s -> !s .isEmpty ())
108- .collect (Collectors .toList ())
109- );
126+ modMetadata .authorList .addAll (this .packAuthors );
110127 }
111128
112129 @ ApiStatus .Internal
@@ -223,6 +240,10 @@ public String getVersion() {
223240 return version ;
224241 }
225242
243+ public List <String > getPackAuthors () {
244+ return packAuthors ;
245+ }
246+
226247 public boolean isDebug () {
227248 return debug ;
228249 }
0 commit comments