Skip to content

Commit 47f9fa7

Browse files
committed
feat: allows to override the syncOptionalModsForCurrentEnv in ScriptConfig, change syncOnlyModsForCurrentEnv default to false
1 parent 2e0a2dc commit 47f9fa7

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

common/src/main/kotlin/syncInfo/models/mod/ModSyncInfo.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ data class ModSyncInfo(
4343
* You will get an error from the mod loader.
4444
*
4545
* */
46-
val syncOnlyModsForCurrentEnv: Boolean = true,
46+
val syncOnlyModsForCurrentEnv: Boolean = false,
4747
/**
4848
* Indicates whether optional mods for the current [Environment] should be synced.
4949
*
@@ -55,6 +55,8 @@ data class ModSyncInfo(
5555
* if [syncOptionalModsForCurrentEnv] is `false`, then will only sync the
5656
* required mods for the current system [Environment].
5757
*
58+
* This option is overridable in the script config for a specific client.
59+
*
5860
* @see Mod.syncOptionalForCurrentEnv
5961
* */
6062
val syncOptionalModsForCurrentEnv: Boolean = true,

sync-script/src/main/kotlin/config/models/ScriptConfig.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import gui.theme.ThemeMode
88
import kotlinx.serialization.Serializable
99
import syncInfo.models.Environment
1010
import syncInfo.models.SyncInfo
11+
import syncInfo.models.mod.ModSyncInfo
1112

1213
/**
1314
* A data class that represent the json for the [SyncScriptDotMinecraftFiles.SyncScriptData.ScriptConfig]
@@ -82,6 +83,10 @@ data class ScriptConfig(
8283
* the update process will always update to the minimized JAR.
8384
* */
8485
val autoUpdateEnabled: Boolean = false,
86+
/**
87+
* Overrides [ModSyncInfo.syncOnlyModsForCurrentEnv] for this user.
88+
* */
89+
val syncOnlyModsForCurrentEnv: Boolean? = null
8590
) {
8691
companion object {
8792
var instance: ScriptConfig? = null

sync-script/src/main/kotlin/syncService/ModsSyncService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package syncService
22

3+
import config.models.ScriptConfig
34
import constants.SyncScriptDotMinecraftFiles
45
import gui.dialogs.LoadingIndicatorDialog
56
import kotlinx.coroutines.Dispatchers
@@ -100,7 +101,8 @@ class ModsSyncService :
100101
}
101102

102103
private fun getCurrentEnvironmentModsOrAll(mods: List<Mod>): List<Mod> {
103-
if (!modSyncInfo.syncOnlyModsForCurrentEnv) {
104+
val syncOnlyModsForCurrentEnv = ScriptConfig.instance?.syncOnlyModsForCurrentEnv ?: modSyncInfo.syncOnlyModsForCurrentEnv
105+
if (!syncOnlyModsForCurrentEnv) {
104106
return mods
105107
}
106108
val currentEnvironmentMods =

0 commit comments

Comments
 (0)