This commit is contained in:
Anuken
2020-08-18 11:52:38 -04:00
parent 47f5127bf8
commit 9efdb0af5d

View File

@@ -22,7 +22,7 @@ import static mindustry.Vars.*;
/** Handles control of bleeding edge builds. */ /** Handles control of bleeding edge builds. */
public class BeControl{ public class BeControl{
private static final int updateInterval = 60 * 2; private static final int updateInterval = 60 * 1;
private AsyncExecutor executor = new AsyncExecutor(1); private AsyncExecutor executor = new AsyncExecutor(1);
private boolean checkUpdates = true; private boolean checkUpdates = true;
@@ -47,7 +47,7 @@ public class BeControl{
/** asynchronously checks for updates. */ /** asynchronously checks for updates. */
public void checkUpdate(Boolc done){ public void checkUpdate(Boolc done){
Core.net.httpGet("https://api.github.com/repos/Anuken/MindustryBuilds/releases/latest", res -> Core.app.post(() -> { Core.net.httpGet("https://api.github.com/repos/Anuken/MindustryBuilds/releases/latest", res -> {
if(res.getStatus() == HttpStatus.OK){ if(res.getStatus() == HttpStatus.OK){
Jval val = Jval.read(res.getResultAsString()); Jval val = Jval.read(res.getResultAsString());
int newBuild = Strings.parseInt(val.getString("tag_name", "0")); int newBuild = Strings.parseInt(val.getString("tag_name", "0"));
@@ -57,15 +57,17 @@ public class BeControl{
updateAvailable = true; updateAvailable = true;
updateBuild = newBuild; updateBuild = newBuild;
updateUrl = url; updateUrl = url;
showUpdateDialog(); Core.app.post(() -> {
Core.app.post(() -> done.get(true)); showUpdateDialog();
done.get(true);
});
}else{ }else{
Core.app.post(() -> done.get(false)); Core.app.post(() -> done.get(false));
} }
}else{ }else{
Core.app.post(() -> done.get(false)); Core.app.post(() -> done.get(false));
} }
}), error -> Core.app.post(() -> { }, error -> Core.app.post(() -> {
if(!headless){ if(!headless){
ui.showException(error); ui.showException(error);
}else{ }else{