Skip to content

Commit 07eef95

Browse files
committed
Update Navtives version in LavaNativesManager
1 parent 25201a5 commit 07eef95

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

common/src/main/java/dev/felnull/imp/client/lava/LavaNativeManager.java

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class LavaNativeManager {
3636
);
3737
private static final Gson GSON = new Gson();
3838
private static final LavaNativeManager INSTANCE = new LavaNativeManager();
39-
private static final String NATIVES_VERSION = "2.2.3"; // Changed to 2.2.3 to match common version
39+
private static final String NATIVES_VERSION = "2.2.4";
4040
private static final String HASH_FILE_NAME = "hash.json";
4141
private static final int CONNECTION_TIMEOUT = 10000; // 10 seconds
4242
private static final int READ_TIMEOUT = 30000; // 30 seconds
@@ -154,7 +154,10 @@ private boolean downloadAndExtractNatives(String osAndArch) throws Exception {
154154
!manifestJson.get(NATIVES_VERSION).isJsonObject()
155155
) {
156156
throw new IllegalStateException(
157-
"Native library version " + NATIVES_VERSION + " not found in manifest. Available versions: " + manifestJson.keySet()
157+
"Native library version " +
158+
NATIVES_VERSION +
159+
" not found in manifest. Available versions: " +
160+
manifestJson.keySet()
158161
);
159162
}
160163

@@ -165,7 +168,10 @@ private boolean downloadAndExtractNatives(String osAndArch) throws Exception {
165168
!versionJson.has(osAndArch) || !versionJson.get(osAndArch).isJsonObject()
166169
) {
167170
throw new IllegalStateException(
168-
"Unsupported OS or architecture: " + osAndArch + ". Available platforms: " + versionJson.keySet()
171+
"Unsupported OS or architecture: " +
172+
osAndArch +
173+
". Available platforms: " +
174+
versionJson.keySet()
169175
);
170176
}
171177

@@ -238,7 +244,7 @@ private boolean downloadAndExtractNatives(String osAndArch) throws Exception {
238244
private JsonObject downloadManifest() throws Exception {
239245
String manifestUrlString = IamMusicPlayer.getConfig().lavaPlayerNativesURL;
240246
LOGGER.info("Downloading natives manifest from: {}", manifestUrlString);
241-
247+
242248
URL manifestUrl = new URI(manifestUrlString).toURL();
243249

244250
HttpURLConnection connection =
@@ -249,7 +255,9 @@ private JsonObject downloadManifest() throws Exception {
249255

250256
int responseCode = connection.getResponseCode();
251257
if (responseCode != 200) {
252-
throw new IOException("Failed to download manifest. HTTP response code: " + responseCode);
258+
throw new IOException(
259+
"Failed to download manifest. HTTP response code: " + responseCode
260+
);
253261
}
254262

255263
try (
@@ -317,10 +325,15 @@ private void downloadFile(URL url, Path destination) throws IOException {
317325
connection.setConnectTimeout(CONNECTION_TIMEOUT);
318326
connection.setReadTimeout(READ_TIMEOUT);
319327
connection.setRequestProperty("User-Agent", "IamMusicPlayer");
320-
328+
321329
int responseCode = connection.getResponseCode();
322330
if (responseCode != 200) {
323-
throw new IOException("Failed to download file. HTTP response code: " + responseCode + " for URL: " + url);
331+
throw new IOException(
332+
"Failed to download file. HTTP response code: " +
333+
responseCode +
334+
" for URL: " +
335+
url
336+
);
324337
}
325338

326339
try (
@@ -362,7 +375,7 @@ private void downloadFile(URL url, Path destination) throws IOException {
362375
}
363376
}
364377
}
365-
378+
366379
LOGGER.info("Downloaded {} bytes", position);
367380
}
368381
}
@@ -383,7 +396,7 @@ private void extractNatives(Path zipFile, Path targetDir) throws IOException {
383396
) {
384397
ZipEntry entry;
385398
int fileCount = 0;
386-
399+
387400
while ((entry = zipStream.getNextEntry()) != null) {
388401
if (entry.isDirectory()) {
389402
continue;
@@ -426,12 +439,12 @@ private void extractNatives(Path zipFile, Path targetDir) throws IOException {
426439
entryPath.toFile().setExecutable(true, false);
427440
LOGGER.debug("Set executable flag for: {}", fileName);
428441
}
429-
442+
430443
zipStream.closeEntry();
431444
}
432-
445+
433446
LOGGER.info("Extracted {} files", fileCount);
434-
447+
435448
if (fileCount == 0) {
436449
throw new IOException("No files were extracted from the archive");
437450
}
@@ -519,7 +532,10 @@ private boolean validateNativesIntegrity(File directory) {
519532
return false;
520533
}
521534

522-
LOGGER.debug("Found {} native library file(s) to validate", nativeLibs.size());
535+
LOGGER.debug(
536+
"Found {} native library file(s) to validate",
537+
nativeLibs.size()
538+
);
523539

524540
// 8. Validate hashes
525541
JsonElement hashElement = hashJson.get("hash");
@@ -607,7 +623,7 @@ private boolean validateHashes(
607623
);
608624
return false;
609625
}
610-
626+
611627
LOGGER.debug("Hash validated successfully for {}", filename);
612628
}
613629

0 commit comments

Comments
 (0)