@@ -63,8 +63,8 @@ public static JsonObject createDefaultJson() {
63
63
64
64
private final String packName ;
65
65
private final String packId ;
66
- private final String packAuthor ;
67
66
private final String version ;
67
+ private final List <String > packAuthors ;
68
68
private final Map <String , List <String >> loaderPaths = new Object2ObjectOpenHashMap <>();
69
69
private final List <String > packmodeList = new ArrayList <>();
70
70
private final Set <String > packmodeSet = new ObjectOpenHashSet <>();
@@ -94,19 +94,36 @@ public RunConfig(JsonObject json) {
94
94
name = CaseFormat .LOWER_UNDERSCORE .to (CaseFormat .UPPER_CAMEL , id ).replace ('_' , ' ' );
95
95
}
96
96
this .packName = name ;
97
- this .packAuthor = JsonHelper .getString (json , "" , "packAuthor" , "author" );
98
97
this .packId = id ;
99
98
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
+ }
100
122
modMetadata .modId = this .packId ;
101
123
modMetadata .name = this .packName ;
102
124
modMetadata .version = this .version ;
103
125
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 );
110
127
}
111
128
112
129
@ ApiStatus .Internal
@@ -223,6 +240,10 @@ public String getVersion() {
223
240
return version ;
224
241
}
225
242
243
+ public List <String > getPackAuthors () {
244
+ return packAuthors ;
245
+ }
246
+
226
247
public boolean isDebug () {
227
248
return debug ;
228
249
}
0 commit comments