mirror of https://github.com/LOOHP/Limbo.git
Update of mappings.json when in the .jar it is different.
This commit is contained in:
parent
7902520968
commit
0250d1b564
|
|
@ -206,13 +206,19 @@ public class Limbo {
|
|||
|
||||
String mappingName = "mapping.json";
|
||||
File mappingFile = new File(internalDataFolder, mappingName);
|
||||
InputStream mappingStreamIn = getClass().getClassLoader().getResourceAsStream(mappingName);
|
||||
try {
|
||||
if (!mappingFile.exists()) {
|
||||
try (InputStream in = getClass().getClassLoader().getResourceAsStream(mappingName)) {
|
||||
Files.copy(in, mappingFile.toPath());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Files.copy(mappingStreamIn, mappingFile.toPath());
|
||||
} 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 ...");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue