Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 457d725

Browse files
authored
Merge pull request #65 from DeathsGun/features/62_disable_update_checking
Allow mods to disable update checking for themselves
2 parents 8e2b81a + c1ffddf commit 457d725

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/kotlin/xyz/deathsgun/modmanager/update/UpdateManager.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,23 @@ class UpdateManager {
357357
return ids
358358
}
359359

360-
fun getCheckableMods(): List<ModMetadata> {
360+
private fun getCheckableMods(): List<ModMetadata> {
361361
return FabricLoader.getInstance().allMods.map { it.metadata }.filter {
362362
!it.id.startsWith("fabric") &&
363363
!CustomValueUtil.getBoolean("fabric-loom:generated", it).orElse(false) &&
364+
!hasDisabledUpdates(it) &&
364365
!blockedIds.contains(it.id)
365366
}
366367
}
367368

369+
private fun hasDisabledUpdates(meta: ModMetadata): Boolean {
370+
if (!meta.containsCustomValue("modmanager")) {
371+
return false
372+
}
373+
val modmenu = meta.getCustomValue("modmanager").asObject
374+
return modmenu.containsKey("disable-checking") && modmenu.get("disable-checking").asBoolean
375+
}
376+
368377
private fun Path.delete() {
369378
try {
370379
Files.delete(this)

0 commit comments

Comments
 (0)