mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] More fixes
This commit is contained in:
parent
69bd5f3c66
commit
98b096dff5
5 changed files with 33 additions and 26 deletions
|
@ -228,6 +228,7 @@ private static void launch(ClientProfile profile, ClientLauncherProcess.ClientPa
|
|||
System.setProperty("minecraft.applet.TargetDirectory", params.clientDir);
|
||||
}
|
||||
Collections.addAll(args, profile.getClientArgs());
|
||||
profile.pushOptionalClientArgs(args);
|
||||
List<String> copy = new ArrayList<>(args);
|
||||
for (int i = 0, l = copy.size(); i < l; i++) {
|
||||
String s = copy.get(i);
|
||||
|
|
|
@ -70,6 +70,7 @@ private void applyClientProfile()
|
|||
{
|
||||
this.systemClassPath.add(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toAbsolutePath().toString());
|
||||
Collections.addAll(this.jvmArgs, this.params.profile.getJvmArgs());
|
||||
this.params.profile.pushOptionalJvmArgs(this.jvmArgs);
|
||||
this.systemEnv.put("JAVA_HOME", javaDir.toString());
|
||||
Collections.addAll(this.systemClassPath, this.params.profile.getAlternativeClassPath());
|
||||
if (params.ram > 0) {
|
||||
|
|
|
@ -248,20 +248,11 @@ public Collection<String> getShared() {
|
|||
}
|
||||
|
||||
|
||||
public void markOptional(String name, OptionalType type) {
|
||||
OptionalFile file = getOptionalFile(name, type);
|
||||
if (file == null) {
|
||||
throw new SecurityException(String.format("Optional %s not found in optionalList", name));
|
||||
}
|
||||
markOptional(file);
|
||||
}
|
||||
|
||||
|
||||
public void markOptional(OptionalFile file) {
|
||||
|
||||
if (file.mark) return;
|
||||
file.mark = true;
|
||||
file.notifyObservers(true);
|
||||
file.watchEvent(true);
|
||||
if (file.dependencies != null) {
|
||||
for (OptionalFile dep : file.dependencies) {
|
||||
if (dep.dependenciesCount == null) dep.dependenciesCount = new HashSet<>();
|
||||
|
@ -277,19 +268,10 @@ public void markOptional(OptionalFile file) {
|
|||
}
|
||||
|
||||
|
||||
public void unmarkOptional(String name, OptionalType type) {
|
||||
OptionalFile file = getOptionalFile(name, type);
|
||||
if (file == null) {
|
||||
throw new SecurityException(String.format("Optional %s not found in optionalList", name));
|
||||
}
|
||||
unmarkOptional(file);
|
||||
}
|
||||
|
||||
|
||||
public void unmarkOptional(OptionalFile file) {
|
||||
if (!file.mark) return;
|
||||
file.mark = false;
|
||||
file.notifyObservers(false);
|
||||
file.watchEvent(false);
|
||||
if (file.dependenciesCount != null) {
|
||||
for (OptionalFile f : file.dependenciesCount) {
|
||||
if (f.isPreset) continue;
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.Observable;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class OptionalFile extends Observable {
|
||||
public class OptionalFile {
|
||||
@LauncherNetworkAPI
|
||||
public String[] list;
|
||||
@LauncherNetworkAPI
|
||||
|
@ -18,7 +18,7 @@ public class OptionalFile extends Observable {
|
|||
@LauncherNetworkAPI
|
||||
public boolean mark;
|
||||
@LauncherNetworkAPI
|
||||
public final boolean visible = true;
|
||||
public boolean visible = true;
|
||||
@LauncherNetworkAPI
|
||||
public String name;
|
||||
@LauncherNetworkAPI
|
||||
|
@ -125,4 +125,27 @@ public static OptionalType readType(HInput input) throws IOException {
|
|||
}
|
||||
return type;
|
||||
}
|
||||
private volatile transient Collection<BiConsumer<OptionalFile, Boolean>> watchList = null;
|
||||
public void registerWatcher(BiConsumer<OptionalFile, Boolean> watcher)
|
||||
{
|
||||
if(watchList == null) watchList = ConcurrentHashMap.newKeySet();
|
||||
watchList.add(watcher);
|
||||
}
|
||||
public void removeWatcher(BiConsumer<OptionalFile, Boolean> watcher)
|
||||
{
|
||||
if(watchList == null) return;
|
||||
watchList.remove(watcher);
|
||||
}
|
||||
public void clearAllWatchers()
|
||||
{
|
||||
if(watchList == null) return;
|
||||
watchList.clear();
|
||||
}
|
||||
public void watchEvent(boolean isMark)
|
||||
{
|
||||
if(watchList == null) return;
|
||||
watchList.forEach((e) -> {
|
||||
e.accept(this, isMark);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public enum TriggerType
|
|||
public boolean need = true;
|
||||
public long value;
|
||||
public long compareMode = 0;
|
||||
boolean isTriggered()
|
||||
public boolean isTriggered()
|
||||
{
|
||||
long test;
|
||||
switch (type)
|
||||
|
|
Loading…
Reference in a new issue