diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java index b0265d08..36a707cd 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java @@ -254,6 +254,12 @@ public void updateOptionalGraph() { file.conflict[i] = getOptionalFile(file.conflictFile[i].name); } } + if(file.xorConflictFile != null) { + file.xorConflict = new OptionalFile[file.xorConflictFile.length]; + for(int i = 0; i < file.xorConflictFile.length; ++i) { + file.xorConflict[i] = getOptionalFile(file.xorConflictFile[i].name); + } + } } } @@ -369,6 +375,10 @@ public void verify() { if (s == null) throw new IllegalArgumentException(String.format("Found null entry in updateOptional.%s.dependenciesFile", f.name)); } + if(f.xorConflictFile != null) for (OptionalDepend s : f.xorConflictFile) { + if (s == null) + throw new IllegalArgumentException(String.format("Found null entry in updateOptional.%s.xorConflictFile", f.name)); + } if (f.triggersList != null) { for (OptionalTrigger trigger : f.triggersList) { if (trigger == null) diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java index a5ad4f25..449b8287 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java @@ -24,10 +24,14 @@ public class OptionalFile { @LauncherNetworkAPI public OptionalDepend[] conflictFile; @LauncherNetworkAPI + public OptionalDepend[] xorConflictFile; + @LauncherNetworkAPI public transient OptionalFile[] dependencies; @LauncherNetworkAPI public transient OptionalFile[] conflict; @LauncherNetworkAPI + public transient OptionalFile[] xorConflict; + @LauncherNetworkAPI public int subTreeLevel = 1; @LauncherNetworkAPI public boolean isPreset; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java index 658edd0b..26859c2a 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.Arrays; import java.util.function.BiConsumer; public class OptionalView { @@ -111,6 +112,11 @@ public void enable(OptionalFile file, boolean manual, BiConsumer callback) { @@ -129,6 +135,11 @@ public void disable(OptionalFile file, BiConsumer callbac } } } + if (file.xorConflict != null) { + if (Arrays.stream(file.xorConflict).noneMatch(this::isEnabled)) { + enable(file.xorConflict[0], false, callback); + } + } } private boolean contains(OptionalFile file, OptionalFile[] array) {