@@ -52,9 +52,10 @@ public static void addMavenRepo(String url) {
52
52
}
53
53
54
54
@ SuppressWarnings ("ResultOfMethodCallIgnored" )
55
- public static void loadLibrary (String loadingModId , String groupId , String artifactId , @ NonNull Version minVersion , Version maxVersion , @ NonNull Version preferredVersion , String devSuffix ) {
56
- libLog .info ("Adding library {}:{}:{}, requested by mod {}" , groupId , artifactId , preferredVersion , loadingModId );
57
- var artifact = groupId + ":" + artifactId ;
55
+ public static void loadLibrary (String loadingModId , String groupId , String artifactId , @ NonNull Version minVersion , Version maxVersion , @ NonNull Version preferredVersion , String regularSuffix , String devSuffix ) {
56
+ val suffix = developerEnvironment ? devSuffix : regularSuffix ;
57
+ libLog .info ("Adding library {}:{}:{}{}, requested by mod {}" , groupId , artifactId , preferredVersion , suffix != null ? "-" + suffix : "" , loadingModId );
58
+ var artifact = groupId + ":" + artifactId + ":" + suffix ;
58
59
if (loadedLibraries .containsKey (artifact )) {
59
60
val currentVer = loadedLibraries .get (artifact );
60
61
if (currentVer .equals (preferredVersion )) return ;
@@ -63,27 +64,27 @@ public static void loadLibrary(String loadingModId, String groupId, String artif
63
64
for (int i = 0 ; i < 16 ; i ++) {
64
65
libLog .fatal ("ALERT VVVVVVVVVVVV ALERT" );
65
66
}
66
- libLog .fatal ("Library {}:{} already loaded with version {}, " +
67
+ libLog .fatal ("Library {}:{}{} already loaded with version {}, " +
67
68
"but a version in the range {} was requested! Thing may go horribly wrong! " +
68
69
"Requested by mod: {}, previously loaded by mod: {}" ,
69
- groupId , artifactId , currentVer ,
70
+ groupId , artifactId , suffix != null ? ":" + suffix : "" , currentVer ,
70
71
rangeString ,
71
72
loadingModId , loadedLibraryMods .get (artifact ));
72
73
for (int i = 0 ; i < 16 ; i ++) {
73
74
libLog .fatal ("ALERT ^^^^^^^^^^^^ ALERT" );
74
75
}
75
76
} else {
76
- libLog .info ("Attempted loading of library {}:{} with preferred version {}, " +
77
+ libLog .info ("Attempted loading of library {}:{}{} with preferred version {}, " +
77
78
"but version {} was already loaded, which matched the range {}. This is not an error. " +
78
79
"Requested by mod: {}, previously loaded by mod: {}" ,
79
- groupId , artifactId , preferredVersion ,
80
+ groupId , artifactId , suffix != null ? ":" + suffix : "" , preferredVersion ,
80
81
currentVer , rangeString ,
81
82
loadingModId , loadedLibraryMods .get (artifact ));
82
83
}
83
84
return ;
84
85
}
85
86
val modsDir = new File (CoreLoadingPlugin .mcDir , "mods" );
86
- val mavenJarName = String .format ("%s-%s%s.jar" , artifactId , preferredVersion , (developerEnvironment && devSuffix != null ) ? ("-" + devSuffix ) : "" );
87
+ val mavenJarName = String .format ("%s-%s%s.jar" , artifactId , preferredVersion , (suffix != null ) ? ("-" + suffix ) : "" );
87
88
val jarName = groupId + "-" + mavenJarName ;
88
89
val libDir = new File (modsDir , "falsepattern" );
89
90
if (!libDir .exists ()) {
@@ -94,10 +95,10 @@ public static void loadLibrary(String loadingModId, String groupId, String artif
94
95
try {
95
96
addToClasspath (file );
96
97
loadedLibraries .put (artifact , preferredVersion );
97
- libLog .info ("Library {}:{}:{} successfully loaded from disk!" , groupId , artifactId , preferredVersion );
98
+ libLog .info ("Library {}:{}:{}{} successfully loaded from disk!" , groupId , artifactId , preferredVersion , ( suffix != null ) ? ":" + suffix : "" );
98
99
return ;
99
100
} catch (RuntimeException e ) {
100
- libLog .warn ("Failed to load library {}:{}:{} from file! Redownloading..." , groupId , artifactId , preferredVersion );
101
+ libLog .warn ("Failed to load library {}:{}:{}{} from file! Redownloading..." , groupId , artifactId , preferredVersion , ( suffix != null ) ? ":" + suffix : "" );
101
102
file .delete ();
102
103
}
103
104
}
@@ -111,20 +112,20 @@ public static void loadLibrary(String loadingModId, String groupId, String artif
111
112
connection .setReadTimeout (1500 );
112
113
connection .setRequestProperty ("User-Agent" , "FalsePatternLib Downloader" );
113
114
if (connection .getResponseCode () != 200 ) {
114
- libLog .info ("Artifact {}:{}:{} was not found on repo {}" , groupId , artifactId , preferredVersion , repo );
115
+ libLog .info ("Artifact {}:{}:{}{} was not found on repo {}" , groupId , artifactId , preferredVersion , ( suffix != null ) ? ":" + suffix : "" , repo );
115
116
connection .disconnect ();
116
117
continue ;
117
118
}
118
- libLog .info ("Downloading {}:{}:{} from {}" , groupId , artifactId , preferredVersion , repo );
119
+ libLog .info ("Downloading {}:{}:{}{} from {}" , groupId , artifactId , preferredVersion , ( suffix != null ) ? ":" + suffix : "" , repo );
119
120
download (connection .getInputStream (), file );
120
- libLog .info ("Downloaded {}:{}:{}" , groupId , artifactId , preferredVersion );
121
+ libLog .info ("Downloaded {}:{}:{}{} " , groupId , artifactId , preferredVersion , ( suffix != null ) ? ":" + suffix : "" );
121
122
loadedLibraries .put (artifact , preferredVersion );
122
123
loadedLibraryMods .put (artifact , loadingModId );
123
124
addToClasspath (file );
124
125
return ;
125
126
} catch (IOException ignored ) {}
126
127
}
127
- val errorMessage = "Failed to download library " + groupId + ":" + artifactId + ":" + preferredVersion + " from any repository! Requested by mod: " + loadingModId ;
128
+ val errorMessage = "Failed to download library " + groupId + ":" + artifactId + ":" + preferredVersion + (( suffix != null ) ? ":" + suffix : "" ) + " from any repository! Requested by mod: " + loadingModId ;
128
129
libLog .fatal (errorMessage );
129
130
throw new IllegalStateException (errorMessage );
130
131
}
0 commit comments