generated from Anuken/MindustryJavaModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4a8e95
commit 72432e2
Showing
7 changed files
with
73 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fosost.updateavailable.title = Update Available | ||
fosost.updateavailable.description = An update for FOS OST was found. Download it now? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fosost.updateavailable.title = Доступно обновление | ||
fosost.updateavailable.description = Найдено обновление для FOS OST. Загрузить его сейчас? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ jar{ | |
} | ||
|
||
from(rootDir){ | ||
include "mod.hjson" | ||
include "mod.json" | ||
include "icon.png" | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "fosost", | ||
"displayName": "Fictional Octo System OST", | ||
"author": "Team Oct", | ||
"main": "fosost.FOSOSTMod", | ||
"repo": "TeamOct/FOS-OST", | ||
"description": "Original soundtrack (made by Saigo no-nozomi) for a Mindustry mod Fictional Octo System.", | ||
"version": "1.0.1", | ||
"minGameVersion": 140.3, | ||
"java": true, | ||
"hidden": true, | ||
"hideBrowser": true, | ||
"dependencies": [ | ||
"fos" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import arc.util.*; | ||
import arc.util.serialization.Jval; | ||
import fosost.FOSOSTMod; | ||
|
||
import static mindustry.Vars.*; | ||
import static mindustry.mod.Mods.LoadedMod; | ||
|
||
// stolen from ApsZoldat/MindustryMappingUtilities, thanks | ||
public class AutoUpdater { | ||
public AutoUpdater() { | ||
LoadedMod mod = mods.getMod(FOSOSTMod.class); | ||
Http.get(ghApi + "/repos/" + mod.getRepo() + "/releases", result -> { | ||
var json = Jval.read(result.getResultAsString()); | ||
Jval.JsonArray releases = json.asArray(); | ||
|
||
if(releases.size == 0) return; | ||
|
||
String latest = releases.first().getString("tag_name"); | ||
String current = mod.meta.version; | ||
float latestFloat = Float.parseFloat(latest.replace("v", "")); | ||
float currentFloat = Float.parseFloat(current.replace("v", "")); | ||
if(currentFloat >= latestFloat) { | ||
Log.info("[FOS OST] Mod is on the latest version."); | ||
return; | ||
} | ||
|
||
ui.showConfirm("@fosost.updateavailable.title", "@fosost.updateavailable.description", () -> { | ||
ui.mods.githubImportMod(mod.getRepo(), true); | ||
}); | ||
}, this::error); | ||
} | ||
|
||
void error(Throwable e) { | ||
Log.err("[FOS OST] Failed to check for updates!\n@", e); | ||
} | ||
} |