mirror of https://github.com/LOOHP/Limbo.git
Update of dimension_registry.json when in the .jar it is different.
This commit is contained in:
parent
0250d1b564
commit
ce364c9d69
|
|
@ -46,16 +46,22 @@ public class DimensionRegistry {
|
|||
this.defaultTag = new CompoundTag();
|
||||
|
||||
String name = "dimension_registry.json";
|
||||
File file = new File(Limbo.getInstance().getInternalDataFolder(), name);
|
||||
if (!file.exists()) {
|
||||
try (InputStream in = Limbo.class.getClassLoader().getResourceAsStream(name)) {
|
||||
Files.copy(in, file.toPath());
|
||||
File dimensionRegistryFile = new File(Limbo.getInstance().getInternalDataFolder(), name);
|
||||
InputStream dimensionRegistryIn = Limbo.class.getClassLoader().getResourceAsStream(name);
|
||||
try {
|
||||
if (!dimensionRegistryFile.exists()) {
|
||||
Files.copy(dimensionRegistryIn, dimensionRegistryFile.toPath());
|
||||
} else {
|
||||
if(Files.newInputStream(dimensionRegistryFile.toPath()) != dimensionRegistryIn) {
|
||||
dimensionRegistryFile.delete();
|
||||
Files.copy(dimensionRegistryIn, dimensionRegistryFile.toPath());
|
||||
}
|
||||
}
|
||||
} catch (IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
this.reg = file;
|
||||
this.reg = dimensionRegistryFile;
|
||||
|
||||
try (InputStreamReader reader = new InputStreamReader(Files.newInputStream(reg.toPath()), StandardCharsets.UTF_8)) {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(reader);
|
||||
|
|
|
|||
Loading…
Reference in New Issue