Update of mappings.json when in the .jar it is different.

This commit is contained in:
Louis 2022-06-11 15:11:51 +02:00 committed by GitHub
parent 7902520968
commit 0250d1b564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 7 deletions

View File

@ -206,13 +206,19 @@ public class Limbo {
String mappingName = "mapping.json"; String mappingName = "mapping.json";
File mappingFile = new File(internalDataFolder, mappingName); File mappingFile = new File(internalDataFolder, mappingName);
if (!mappingFile.exists()) { InputStream mappingStreamIn = getClass().getClassLoader().getResourceAsStream(mappingName);
try (InputStream in = getClass().getClassLoader().getResourceAsStream(mappingName)) { try {
Files.copy(in, mappingFile.toPath()); if (!mappingFile.exists()) {
} catch (IOException e) { Files.copy(mappingStreamIn, mappingFile.toPath());
e.printStackTrace(); } else {
} if (Files.newInputStream(mappingFile.toPath()) != mappingStreamIn) {
} mappingFile.delete();
Files.copy(mappingStreamIn, mappingFile.toPath());
}
}
} catch (IOException e){
e.printStackTrace();
}
console.sendMessage("Loading packet id mappings from mapping.json ..."); console.sendMessage("Loading packet id mappings from mapping.json ...");