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";
|
String mappingName = "mapping.json";
|
||||||
File mappingFile = new File(internalDataFolder, mappingName);
|
File mappingFile = new File(internalDataFolder, mappingName);
|
||||||
|
InputStream mappingStreamIn = getClass().getClassLoader().getResourceAsStream(mappingName);
|
||||||
|
try {
|
||||||
if (!mappingFile.exists()) {
|
if (!mappingFile.exists()) {
|
||||||
try (InputStream in = getClass().getClassLoader().getResourceAsStream(mappingName)) {
|
Files.copy(mappingStreamIn, mappingFile.toPath());
|
||||||
Files.copy(in, mappingFile.toPath());
|
} else {
|
||||||
|
if (Files.newInputStream(mappingFile.toPath()) != mappingStreamIn) {
|
||||||
|
mappingFile.delete();
|
||||||
|
Files.copy(mappingStreamIn, mappingFile.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (IOException e){
|
} catch (IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
console.sendMessage("Loading packet id mappings from mapping.json ...");
|
console.sendMessage("Loading packet id mappings from mapping.json ...");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue