mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2ffd1e6e47
@ -30,6 +30,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IrisCompat {
|
public class IrisCompat {
|
||||||
@ -154,10 +155,19 @@ public class IrisCompat {
|
|||||||
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
|
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
|
||||||
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
|
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
|
||||||
|
|
||||||
if (!f.exists()) {
|
|
||||||
J.attemptAsync(() -> IO.writeAll(f, defa));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!f.exists()) {
|
||||||
|
J.a(() -> {
|
||||||
|
try {
|
||||||
|
IO.writeAll(f, defa);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.error("Failed to write to compat file");
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// If the file doesn't exist, no additional mappings are present outside default
|
||||||
|
// so we shouldn't try getting them
|
||||||
try {
|
try {
|
||||||
IrisCompat rea = new Gson().fromJson(IO.readAll(f), IrisCompat.class);
|
IrisCompat rea = new Gson().fromJson(IO.readAll(f), IrisCompat.class);
|
||||||
|
|
||||||
@ -172,6 +182,7 @@ public class IrisCompat {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user