mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 14:56:05 -04:00
Add get/set/property methods for Config
This commit is contained in:
parent
8236f613e0
commit
3e8c8afcd1
@ -59,7 +59,7 @@ public class HMCLGameDownloadTask extends Task {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
File jar = profile.getRepository().getVersionJar(version);
|
File jar = profile.getRepository().getVersionJar(version);
|
||||||
|
|
||||||
File cache = new File(CONFIG.commonDirectory.get(), "jars/" + gameVersion + ".jar");
|
File cache = new File(CONFIG.getCommonDirectory(), "jars/" + gameVersion + ".jar");
|
||||||
if (cache.exists())
|
if (cache.exists())
|
||||||
try {
|
try {
|
||||||
FileUtils.copyFile(cache, jar);
|
FileUtils.copyFile(cache, jar);
|
||||||
|
@ -61,7 +61,7 @@ public class HMCLGameRepository extends DefaultGameRepository {
|
|||||||
if (useSelf(version, assetId))
|
if (useSelf(version, assetId))
|
||||||
return super.getAssetDirectory(version, assetId);
|
return super.getAssetDirectory(version, assetId);
|
||||||
else
|
else
|
||||||
return new File(CONFIG.commonDirectory.get(), "assets");
|
return new File(CONFIG.getCommonDirectory(), "assets");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,7 +86,7 @@ public class HMCLGameRepository extends DefaultGameRepository {
|
|||||||
if (self.exists() || vs.isNoCommon())
|
if (self.exists() || vs.isNoCommon())
|
||||||
return self;
|
return self;
|
||||||
else
|
else
|
||||||
return new File(CONFIG.commonDirectory.get(), "libraries/" + lib.getPath());
|
return new File(CONFIG.getCommonDirectory(), "libraries/" + lib.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public final class Accounts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static AuthlibInjectorServer getOrCreateAuthlibInjectorServer(String url) {
|
private static AuthlibInjectorServer getOrCreateAuthlibInjectorServer(String url) {
|
||||||
return CONFIG.authlibInjectorServers.stream()
|
return CONFIG.getAuthlibInjectorServers().stream()
|
||||||
.filter(server -> url.equals(server.getUrl()))
|
.filter(server -> url.equals(server.getUrl()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
@ -86,7 +86,7 @@ public final class Accounts {
|
|||||||
LOG.log(Level.WARNING, "Failed to migrate authlib injector server " + url, e);
|
LOG.log(Level.WARNING, "Failed to migrate authlib injector server " + url, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG.authlibInjectorServers.add(server);
|
CONFIG.getAuthlibInjectorServers().add(server);
|
||||||
return server;
|
return server;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -80,69 +80,70 @@ public final class Config implements Cloneable, Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SerializedName("last")
|
@SerializedName("last")
|
||||||
public final StringProperty selectedProfile = new SimpleStringProperty("");
|
private StringProperty selectedProfile = new SimpleStringProperty("");
|
||||||
|
|
||||||
@SerializedName("backgroundType")
|
@SerializedName("backgroundType")
|
||||||
public final ObjectProperty<EnumBackgroundImage> backgroundImageType = new SimpleObjectProperty<>(EnumBackgroundImage.DEFAULT);
|
private ObjectProperty<EnumBackgroundImage> backgroundImageType = new SimpleObjectProperty<>(EnumBackgroundImage.DEFAULT);
|
||||||
|
|
||||||
@SerializedName("bgpath")
|
@SerializedName("bgpath")
|
||||||
public final StringProperty backgroundImage = new SimpleStringProperty();
|
private StringProperty backgroundImage = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("commonpath")
|
@SerializedName("commonpath")
|
||||||
public final StringProperty commonDirectory = new SimpleStringProperty(Launcher.MINECRAFT_DIRECTORY.getAbsolutePath());
|
private StringProperty commonDirectory = new SimpleStringProperty(Launcher.MINECRAFT_DIRECTORY.getAbsolutePath());
|
||||||
|
|
||||||
@SerializedName("hasProxy")
|
@SerializedName("hasProxy")
|
||||||
public final BooleanProperty hasProxy = new SimpleBooleanProperty();
|
private BooleanProperty hasProxy = new SimpleBooleanProperty();
|
||||||
|
|
||||||
@SerializedName("hasProxyAuth")
|
@SerializedName("hasProxyAuth")
|
||||||
public final BooleanProperty hasProxyAuth = new SimpleBooleanProperty();
|
private BooleanProperty hasProxyAuth = new SimpleBooleanProperty();
|
||||||
|
|
||||||
@SerializedName("proxyType")
|
@SerializedName("proxyType")
|
||||||
public final ObjectProperty<Proxy.Type> proxyType = new SimpleObjectProperty<>(Proxy.Type.DIRECT);
|
private ObjectProperty<Proxy.Type> proxyType = new SimpleObjectProperty<>(Proxy.Type.DIRECT);
|
||||||
|
|
||||||
@SerializedName("proxyHost")
|
@SerializedName("proxyHost")
|
||||||
public final StringProperty proxyHost = new SimpleStringProperty();
|
private StringProperty proxyHost = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("proxyPort")
|
@SerializedName("proxyPort")
|
||||||
public final StringProperty proxyPort = new SimpleStringProperty();
|
private StringProperty proxyPort = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("proxyUserName")
|
@SerializedName("proxyUserName")
|
||||||
public final StringProperty proxyUser = new SimpleStringProperty();
|
private StringProperty proxyUser = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("proxyPassword")
|
@SerializedName("proxyPassword")
|
||||||
public final StringProperty proxyPass = new SimpleStringProperty();
|
private StringProperty proxyPass = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("theme")
|
@SerializedName("theme")
|
||||||
public final StringProperty theme = new SimpleStringProperty();
|
private StringProperty theme = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("localization")
|
@SerializedName("localization")
|
||||||
public final StringProperty localization = new SimpleStringProperty();
|
private StringProperty localization = new SimpleStringProperty();
|
||||||
|
|
||||||
@SerializedName("downloadtype")
|
@SerializedName("downloadtype")
|
||||||
public final IntegerProperty downloadType = new SimpleIntegerProperty(1);
|
private IntegerProperty downloadType = new SimpleIntegerProperty(1);
|
||||||
|
|
||||||
@SerializedName("configurations")
|
@SerializedName("configurations")
|
||||||
public final ObservableMap<String, Profile> configurations = FXCollections.observableMap(new TreeMap<>());
|
private ObservableMap<String, Profile> configurations = FXCollections.observableMap(new TreeMap<>());
|
||||||
|
|
||||||
@SerializedName("accounts")
|
@SerializedName("accounts")
|
||||||
public final ObservableList<Map<Object, Object>> accounts = FXCollections.observableArrayList();
|
private ObservableList<Map<Object, Object>> accounts = FXCollections.observableArrayList();
|
||||||
|
|
||||||
@SerializedName("selectedAccount")
|
@SerializedName("selectedAccount")
|
||||||
public final StringProperty selectedAccount = new SimpleStringProperty("");
|
private StringProperty selectedAccount = new SimpleStringProperty("");
|
||||||
|
|
||||||
@SerializedName("fontFamily")
|
@SerializedName("fontFamily")
|
||||||
public final StringProperty fontFamily = new SimpleStringProperty("Consolas");
|
private StringProperty fontFamily = new SimpleStringProperty("Consolas");
|
||||||
|
|
||||||
@SerializedName("fontSize")
|
@SerializedName("fontSize")
|
||||||
public final DoubleProperty fontSize = new SimpleDoubleProperty(12);
|
private DoubleProperty fontSize = new SimpleDoubleProperty(12);
|
||||||
|
|
||||||
@SerializedName("logLines")
|
@SerializedName("logLines")
|
||||||
public final IntegerProperty logLines = new SimpleIntegerProperty(100);
|
private IntegerProperty logLines = new SimpleIntegerProperty(100);
|
||||||
|
|
||||||
@SerializedName("firstLaunch")
|
@SerializedName("firstLaunch")
|
||||||
public final BooleanProperty firstLaunch = new SimpleBooleanProperty(true);
|
private BooleanProperty firstLaunch = new SimpleBooleanProperty(true);
|
||||||
|
|
||||||
public final ObservableList<AuthlibInjectorServer> authlibInjectorServers = FXCollections.observableArrayList();
|
@SerializedName("authlibInjectorServers")
|
||||||
|
private ObservableList<AuthlibInjectorServer> authlibInjectorServers = FXCollections.observableArrayList();
|
||||||
|
|
||||||
private transient ObservableHelper helper = new ObservableHelper(this);
|
private transient ObservableHelper helper = new ObservableHelper(this);
|
||||||
|
|
||||||
@ -151,10 +152,10 @@ public final class Config implements Cloneable, Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addListenerToProperties() {
|
private void addListenerToProperties() {
|
||||||
Stream.of(getClass().getFields())
|
Stream.of(getClass().getDeclaredFields())
|
||||||
.filter(it -> {
|
.filter(it -> {
|
||||||
int modifiers = it.getModifiers();
|
int modifiers = it.getModifiers();
|
||||||
return Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers);
|
return !Modifier.isTransient(modifiers) && !Modifier.isStatic(modifiers);
|
||||||
})
|
})
|
||||||
.filter(it -> Observable.class.isAssignableFrom(it.getType()))
|
.filter(it -> Observable.class.isAssignableFrom(it.getType()))
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
@ -185,4 +186,246 @@ public final class Config implements Cloneable, Observable {
|
|||||||
public Config clone() {
|
public Config clone() {
|
||||||
return fromJson(this.toJson());
|
return fromJson(this.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getters & Setters & Properties
|
||||||
|
public String getSelectedProfile() {
|
||||||
|
return selectedProfile.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedProfile(String selectedProfile) {
|
||||||
|
this.selectedProfile.set(selectedProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty selectedProfileProperty() {
|
||||||
|
return selectedProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumBackgroundImage getBackgroundImageType() {
|
||||||
|
return backgroundImageType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackgroundImageType(EnumBackgroundImage backgroundImageType) {
|
||||||
|
this.backgroundImageType.set(backgroundImageType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectProperty<EnumBackgroundImage> backgroundImageTypeProperty() {
|
||||||
|
return backgroundImageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackgroundImage() {
|
||||||
|
return backgroundImage.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackgroundImage(String backgroundImage) {
|
||||||
|
this.backgroundImage.set(backgroundImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty backgroundImageProperty() {
|
||||||
|
return backgroundImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommonDirectory() {
|
||||||
|
return commonDirectory.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommonDirectory(String commonDirectory) {
|
||||||
|
this.commonDirectory.set(commonDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty commonDirectoryProperty() {
|
||||||
|
return commonDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProxy() {
|
||||||
|
return hasProxy.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasProxy(boolean hasProxy) {
|
||||||
|
this.hasProxy.set(hasProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanProperty hasProxyProperty() {
|
||||||
|
return hasProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProxyAuth() {
|
||||||
|
return hasProxyAuth.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasProxyAuth(boolean hasProxyAuth) {
|
||||||
|
this.hasProxyAuth.set(hasProxyAuth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanProperty hasProxyAuthProperty() {
|
||||||
|
return hasProxyAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Proxy.Type getProxyType() {
|
||||||
|
return proxyType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyType(Proxy.Type proxyType) {
|
||||||
|
this.proxyType.set(proxyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectProperty<Proxy.Type> proxyTypeProperty() {
|
||||||
|
return proxyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyHost() {
|
||||||
|
return proxyHost.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyHost(String proxyHost) {
|
||||||
|
this.proxyHost.set(proxyHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty proxyHostProperty() {
|
||||||
|
return proxyHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyPort() {
|
||||||
|
return proxyPort.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyPort(String proxyPort) {
|
||||||
|
this.proxyPort.set(proxyPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty proxyPortProperty() {
|
||||||
|
return proxyPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyUser() {
|
||||||
|
return proxyUser.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyUser(String proxyUser) {
|
||||||
|
this.proxyUser.set(proxyUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty proxyUserProperty() {
|
||||||
|
return proxyUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProxyPass() {
|
||||||
|
return proxyPass.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProxyPass(String proxyPass) {
|
||||||
|
this.proxyPass.set(proxyPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty proxyPassProperty() {
|
||||||
|
return proxyPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTheme() {
|
||||||
|
return theme.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTheme(String theme) {
|
||||||
|
this.theme.set(theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty themeProperty() {
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocalization() {
|
||||||
|
return localization.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocalization(String localization) {
|
||||||
|
this.localization.set(localization);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty localizationProperty() {
|
||||||
|
return localization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDownloadType() {
|
||||||
|
return downloadType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloadType(int downloadType) {
|
||||||
|
this.downloadType.set(downloadType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntegerProperty downloadTypeProperty() {
|
||||||
|
return downloadType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableMap<String, Profile> getConfigurations() {
|
||||||
|
return configurations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableList<Map<Object, Object>> getAccounts() {
|
||||||
|
return accounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelectedAccount() {
|
||||||
|
return selectedAccount.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedAccount(String selectedAccount) {
|
||||||
|
this.selectedAccount.set(selectedAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty selectedAccountProperty() {
|
||||||
|
return selectedAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFontFamily() {
|
||||||
|
return fontFamily.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFontFamily(String fontFamily) {
|
||||||
|
this.fontFamily.set(fontFamily);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty fontFamilyProperty() {
|
||||||
|
return fontFamily;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getFontSize() {
|
||||||
|
return fontSize.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFontSize(double fontSize) {
|
||||||
|
this.fontSize.set(fontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleProperty fontSizeProperty() {
|
||||||
|
return fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLogLines() {
|
||||||
|
return logLines.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogLines(int logLines) {
|
||||||
|
this.logLines.set(logLines);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntegerProperty logLinesProperty() {
|
||||||
|
return logLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFirstLaunch() {
|
||||||
|
return firstLaunch.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstLaunch(boolean firstLaunch) {
|
||||||
|
this.firstLaunch.set(firstLaunch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanProperty firstLaunchProperty() {
|
||||||
|
return firstLaunch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableList<AuthlibInjectorServer> getAuthlibInjectorServers() {
|
||||||
|
return authlibInjectorServers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,18 +37,18 @@ public final class ProxyManager {
|
|||||||
|
|
||||||
public static final ObjectBinding<Proxy> proxyProperty = Bindings.createObjectBinding(
|
public static final ObjectBinding<Proxy> proxyProperty = Bindings.createObjectBinding(
|
||||||
() -> {
|
() -> {
|
||||||
String host = CONFIG.proxyHost.get();
|
String host = CONFIG.getProxyHost();
|
||||||
Integer port = Lang.toIntOrNull(CONFIG.proxyPort.get());
|
Integer port = Lang.toIntOrNull(CONFIG.getProxyPort());
|
||||||
if (!CONFIG.hasProxy.get() || StringUtils.isBlank(host) || port == null || CONFIG.proxyType.get() == Proxy.Type.DIRECT) {
|
if (!CONFIG.hasProxy() || StringUtils.isBlank(host) || port == null || CONFIG.getProxyType() == Proxy.Type.DIRECT) {
|
||||||
return Proxy.NO_PROXY;
|
return Proxy.NO_PROXY;
|
||||||
} else {
|
} else {
|
||||||
return new Proxy(CONFIG.proxyType.get(), new InetSocketAddress(host, port));
|
return new Proxy(CONFIG.getProxyType(), new InetSocketAddress(host, port));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CONFIG.proxyType,
|
CONFIG.proxyTypeProperty(),
|
||||||
CONFIG.proxyHost,
|
CONFIG.proxyHostProperty(),
|
||||||
CONFIG.proxyPort,
|
CONFIG.proxyPortProperty(),
|
||||||
CONFIG.hasProxy);
|
CONFIG.hasProxyProperty());
|
||||||
|
|
||||||
public static Proxy getProxy() {
|
public static Proxy getProxy() {
|
||||||
return proxyProperty.get();
|
return proxyProperty.get();
|
||||||
@ -67,9 +67,9 @@ public final class ProxyManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
if (CONFIG.hasProxyAuth.get()) {
|
if (CONFIG.hasProxyAuth()) {
|
||||||
String username = CONFIG.proxyUser.get();
|
String username = CONFIG.getProxyUser();
|
||||||
String password = CONFIG.proxyPass.get();
|
String password = CONFIG.getProxyPass();
|
||||||
if (username != null && password != null) {
|
if (username != null && password != null) {
|
||||||
return new PasswordAuthentication(username, password.toCharArray());
|
return new PasswordAuthentication(username, password.toCharArray());
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class Settings {
|
|||||||
private final boolean firstLaunch;
|
private final boolean firstLaunch;
|
||||||
|
|
||||||
private InvalidationListener accountChangeListener =
|
private InvalidationListener accountChangeListener =
|
||||||
source -> CONFIG.accounts.setAll(
|
source -> CONFIG.getAccounts().setAll(
|
||||||
accounts.values().stream()
|
accounts.values().stream()
|
||||||
.map(account -> {
|
.map(account -> {
|
||||||
Map<Object, Object> storage = account.toStorage();
|
Map<Object, Object> storage = account.toStorage();
|
||||||
@ -63,12 +63,12 @@ public class Settings {
|
|||||||
.collect(toList()));
|
.collect(toList()));
|
||||||
|
|
||||||
private Settings() {
|
private Settings() {
|
||||||
firstLaunch = CONFIG.firstLaunch.get();
|
firstLaunch = CONFIG.isFirstLaunch();
|
||||||
CONFIG.firstLaunch.set(false);
|
CONFIG.setFirstLaunch(false);
|
||||||
|
|
||||||
ProxyManager.getProxy(); // init ProxyManager
|
ProxyManager.getProxy(); // init ProxyManager
|
||||||
|
|
||||||
for (Iterator<Map<Object, Object>> iterator = CONFIG.accounts.iterator(); iterator.hasNext();) {
|
for (Iterator<Map<Object, Object>> iterator = CONFIG.getAccounts().iterator(); iterator.hasNext();) {
|
||||||
Map<Object, Object> settings = iterator.next();
|
Map<Object, Object> settings = iterator.next();
|
||||||
AccountFactory<?> factory = Accounts.ACCOUNT_FACTORY.get(tryCast(settings.get("type"), String.class).orElse(""));
|
AccountFactory<?> factory = Accounts.ACCOUNT_FACTORY.get(tryCast(settings.get("type"), String.class).orElse(""));
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
@ -90,9 +90,9 @@ public class Settings {
|
|||||||
account.addListener(accountChangeListener);
|
account.addListener(accountChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG.authlibInjectorServers.addListener(onInvalidating(this::removeDanglingAuthlibInjectorAccounts));
|
CONFIG.getAuthlibInjectorServers().addListener(onInvalidating(this::removeDanglingAuthlibInjectorAccounts));
|
||||||
|
|
||||||
this.selectedAccount.set(accounts.get(CONFIG.selectedAccount.get()));
|
this.selectedAccount.set(accounts.get(CONFIG.getSelectedAccount()));
|
||||||
|
|
||||||
checkProfileMap();
|
checkProfileMap();
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public class Settings {
|
|||||||
return firstLaunch;
|
return firstLaunch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Locales.SupportedLocale locale = Locales.getLocaleByName(CONFIG.localization.get());
|
private Locales.SupportedLocale locale = Locales.getLocaleByName(CONFIG.getLocalization());
|
||||||
|
|
||||||
public Locales.SupportedLocale getLocale() {
|
public Locales.SupportedLocale getLocale() {
|
||||||
return locale;
|
return locale;
|
||||||
@ -125,24 +125,24 @@ public class Settings {
|
|||||||
|
|
||||||
public void setLocale(Locales.SupportedLocale locale) {
|
public void setLocale(Locales.SupportedLocale locale) {
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
CONFIG.localization.set(Locales.getNameByLocale(locale));
|
CONFIG.setLocalization(Locales.getNameByLocale(locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Font getFont() {
|
public Font getFont() {
|
||||||
return Font.font(CONFIG.fontFamily.get(), CONFIG.fontSize.get());
|
return Font.font(CONFIG.getFontFamily(), CONFIG.getFontSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFont(Font font) {
|
public void setFont(Font font) {
|
||||||
CONFIG.fontFamily.set(font.getFamily());
|
CONFIG.setFontFamily(font.getFamily());
|
||||||
CONFIG.fontSize.set(font.getSize());
|
CONFIG.setFontSize(font.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLogLines() {
|
public int getLogLines() {
|
||||||
return Math.max(CONFIG.logLines.get(), 100);
|
return Math.max(CONFIG.getLogLines(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogLines(int logLines) {
|
public void setLogLines(int logLines) {
|
||||||
CONFIG.logLines.set(logLines);
|
CONFIG.setLogLines(logLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
@ -157,7 +157,7 @@ public class Settings {
|
|||||||
private void removeDanglingAuthlibInjectorAccounts() {
|
private void removeDanglingAuthlibInjectorAccounts() {
|
||||||
accounts.values().stream()
|
accounts.values().stream()
|
||||||
.filter(AuthlibInjectorAccount.class::isInstance)
|
.filter(AuthlibInjectorAccount.class::isInstance)
|
||||||
.filter(it -> !CONFIG.authlibInjectorServers.contains(((AuthlibInjectorAccount) it).getServer()))
|
.filter(it -> !CONFIG.getAuthlibInjectorServers().contains(((AuthlibInjectorAccount) it).getServer()))
|
||||||
.collect(toList())
|
.collect(toList())
|
||||||
.forEach(this::deleteAccount);
|
.forEach(this::deleteAccount);
|
||||||
}
|
}
|
||||||
@ -167,14 +167,14 @@ public class Settings {
|
|||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
public DownloadProvider getDownloadProvider() {
|
public DownloadProvider getDownloadProvider() {
|
||||||
return DownloadProviders.getDownloadProvider(CONFIG.downloadType.get());
|
return DownloadProviders.getDownloadProvider(CONFIG.getDownloadType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadProvider(DownloadProvider downloadProvider) {
|
public void setDownloadProvider(DownloadProvider downloadProvider) {
|
||||||
int index = DownloadProviders.DOWNLOAD_PROVIDERS.indexOf(downloadProvider);
|
int index = DownloadProviders.DOWNLOAD_PROVIDERS.indexOf(downloadProvider);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
throw new IllegalArgumentException("Unknown download provider: " + downloadProvider);
|
throw new IllegalArgumentException("Unknown download provider: " + downloadProvider);
|
||||||
CONFIG.downloadType.set(index);
|
CONFIG.setDownloadType(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
@ -203,7 +203,7 @@ public class Settings {
|
|||||||
public void invalidated() {
|
public void invalidated() {
|
||||||
super.invalidated();
|
super.invalidated();
|
||||||
|
|
||||||
CONFIG.selectedAccount.set(getValue() == null ? "" : Accounts.getAccountId(getValue()));
|
CONFIG.setSelectedAccount(getValue() == null ? "" : Accounts.getAccountId(getValue()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,12 +261,12 @@ public class Settings {
|
|||||||
* THEME *
|
* THEME *
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
private final ImmediateObjectProperty<Theme> theme = new ImmediateObjectProperty<Theme>(this, "theme", Theme.getTheme(CONFIG.theme.get()).orElse(Theme.BLUE)) {
|
private final ImmediateObjectProperty<Theme> theme = new ImmediateObjectProperty<Theme>(this, "theme", Theme.getTheme(CONFIG.getTheme()).orElse(Theme.BLUE)) {
|
||||||
@Override
|
@Override
|
||||||
public void invalidated() {
|
public void invalidated() {
|
||||||
super.invalidated();
|
super.invalidated();
|
||||||
|
|
||||||
CONFIG.theme.set(get().getName().toLowerCase());
|
CONFIG.setTheme(get().getName().toLowerCase());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -289,18 +289,18 @@ public class Settings {
|
|||||||
public Profile getSelectedProfile() {
|
public Profile getSelectedProfile() {
|
||||||
checkProfileMap();
|
checkProfileMap();
|
||||||
|
|
||||||
if (!hasProfile(CONFIG.selectedProfile.get())) {
|
if (!hasProfile(CONFIG.getSelectedProfile())) {
|
||||||
getProfileMap().keySet().stream().findFirst().ifPresent(selectedProfile -> {
|
getProfileMap().keySet().stream().findFirst().ifPresent(selectedProfile -> {
|
||||||
CONFIG.selectedProfile.set(selectedProfile);
|
CONFIG.setSelectedProfile(selectedProfile);
|
||||||
});
|
});
|
||||||
Schedulers.computation().schedule(this::onProfileChanged);
|
Schedulers.computation().schedule(this::onProfileChanged);
|
||||||
}
|
}
|
||||||
return getProfile(CONFIG.selectedProfile.get());
|
return getProfile(CONFIG.getSelectedProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedProfile(Profile selectedProfile) {
|
public void setSelectedProfile(Profile selectedProfile) {
|
||||||
if (hasProfile(selectedProfile.getName()) && !Objects.equals(selectedProfile.getName(), CONFIG.selectedProfile.get())) {
|
if (hasProfile(selectedProfile.getName()) && !Objects.equals(selectedProfile.getName(), CONFIG.getSelectedProfile())) {
|
||||||
CONFIG.selectedProfile.set(selectedProfile.getName());
|
CONFIG.setSelectedProfile(selectedProfile.getName());
|
||||||
Schedulers.computation().schedule(this::onProfileChanged);
|
Schedulers.computation().schedule(this::onProfileChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Profile> getProfileMap() {
|
public Map<String, Profile> getProfileMap() {
|
||||||
return CONFIG.configurations;
|
return CONFIG.getConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Profile> getProfiles() {
|
public Collection<Profile> getProfiles() {
|
||||||
|
@ -519,10 +519,10 @@ public final class VersionSetting {
|
|||||||
.setFullscreen(isFullscreen())
|
.setFullscreen(isFullscreen())
|
||||||
.setServerIp(getServerIp())
|
.setServerIp(getServerIp())
|
||||||
.setWrapper(getWrapper())
|
.setWrapper(getWrapper())
|
||||||
.setProxyHost(CONFIG.proxyHost.get())
|
.setProxyHost(CONFIG.getProxyHost())
|
||||||
.setProxyPort(CONFIG.proxyPort.get())
|
.setProxyPort(CONFIG.getProxyPort())
|
||||||
.setProxyUser(CONFIG.proxyUser.get())
|
.setProxyUser(CONFIG.getProxyUser())
|
||||||
.setProxyPass(CONFIG.proxyPass.get())
|
.setProxyPass(CONFIG.getProxyPass())
|
||||||
.setPrecalledCommand(getPreLaunchCommand())
|
.setPrecalledCommand(getPreLaunchCommand())
|
||||||
.setNoGeneratedJVMArgs(isNoJVMArgs())
|
.setNoGeneratedJVMArgs(isNoJVMArgs())
|
||||||
.create();
|
.create();
|
||||||
|
@ -82,7 +82,7 @@ public class AddAccountPane extends StackPane {
|
|||||||
|
|
||||||
cboServers.setCellFactory(jfxListCellFactory(server -> new TwoLineListItem(server.getName(), server.getUrl())));
|
cboServers.setCellFactory(jfxListCellFactory(server -> new TwoLineListItem(server.getName(), server.getUrl())));
|
||||||
cboServers.setConverter(stringConverter(AuthlibInjectorServer::getName));
|
cboServers.setConverter(stringConverter(AuthlibInjectorServer::getName));
|
||||||
Bindings.bindContent(cboServers.getItems(), CONFIG.authlibInjectorServers);
|
Bindings.bindContent(cboServers.getItems(), CONFIG.getAuthlibInjectorServers());
|
||||||
cboServers.getItems().addListener(onInvalidating(this::selectDefaultServer));
|
cboServers.getItems().addListener(onInvalidating(this::selectDefaultServer));
|
||||||
selectDefaultServer();
|
selectDefaultServer();
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ public class AddAuthlibInjectorServerPane extends StackPane {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onAddFinish() {
|
private void onAddFinish() {
|
||||||
if (!CONFIG.authlibInjectorServers.contains(serverBeingAdded)) {
|
if (!CONFIG.getAuthlibInjectorServers().contains(serverBeingAdded)) {
|
||||||
CONFIG.authlibInjectorServers.add(serverBeingAdded);
|
CONFIG.getAuthlibInjectorServers().add(serverBeingAdded);
|
||||||
}
|
}
|
||||||
fireEvent(new DialogCloseEvent());
|
fireEvent(new DialogCloseEvent());
|
||||||
}
|
}
|
||||||
|
@ -49,15 +49,15 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa
|
|||||||
smoothScrolling(scrollPane);
|
smoothScrolling(scrollPane);
|
||||||
|
|
||||||
serversListener = observable -> updateServersList();
|
serversListener = observable -> updateServersList();
|
||||||
CONFIG.authlibInjectorServers.addListener(new WeakInvalidationListener(serversListener));
|
CONFIG.getAuthlibInjectorServers().addListener(new WeakInvalidationListener(serversListener));
|
||||||
updateServersList();
|
updateServersList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateServersList() {
|
private void updateServersList() {
|
||||||
listPane.getChildren().setAll(
|
listPane.getChildren().setAll(
|
||||||
CONFIG.authlibInjectorServers.stream()
|
CONFIG.getAuthlibInjectorServers().stream()
|
||||||
.map(server -> new AuthlibInjectorServerItem(server,
|
.map(server -> new AuthlibInjectorServerItem(server,
|
||||||
item -> CONFIG.authlibInjectorServers.remove(item.getServer())))
|
item -> CONFIG.getAuthlibInjectorServers().remove(item.getServer())))
|
||||||
.collect(toList()));
|
.collect(toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,10 +221,10 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
try {
|
try {
|
||||||
Image background;
|
Image background;
|
||||||
|
|
||||||
if (CONFIG.backgroundImageType.get() == EnumBackgroundImage.DEFAULT)
|
if (CONFIG.getBackgroundImageType() == EnumBackgroundImage.DEFAULT)
|
||||||
background = searchBackgroundImage(new Image("/assets/img/background.jpg"), "");
|
background = searchBackgroundImage(new Image("/assets/img/background.jpg"), "");
|
||||||
else
|
else
|
||||||
background = searchBackgroundImage(new Image("/assets/img/background.jpg"), CONFIG.backgroundImage.get());
|
background = searchBackgroundImage(new Image("/assets/img/background.jpg"), CONFIG.getBackgroundImage());
|
||||||
|
|
||||||
drawerWrapper.setBackground(new Background(new BackgroundImage(background, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, new BackgroundSize(800, 480, false, false, true, true))));
|
drawerWrapper.setBackground(new Background(new BackgroundImage(background, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, new BackgroundSize(800, 480, false, false, true, true))));
|
||||||
} catch (IllegalArgumentException ignore) {
|
} catch (IllegalArgumentException ignore) {
|
||||||
|
@ -106,10 +106,10 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
|
|
||||||
FXUtils.smoothScrolling(scroll);
|
FXUtils.smoothScrolling(scroll);
|
||||||
|
|
||||||
txtProxyHost.textProperty().bindBidirectional(CONFIG.proxyHost);
|
txtProxyHost.textProperty().bindBidirectional(CONFIG.proxyHostProperty());
|
||||||
txtProxyPort.textProperty().bindBidirectional(CONFIG.proxyPort);
|
txtProxyPort.textProperty().bindBidirectional(CONFIG.proxyPortProperty());
|
||||||
txtProxyUsername.textProperty().bindBidirectional(CONFIG.proxyUser);
|
txtProxyUsername.textProperty().bindBidirectional(CONFIG.proxyUserProperty());
|
||||||
txtProxyPassword.textProperty().bindBidirectional(CONFIG.proxyPass);
|
txtProxyPassword.textProperty().bindBidirectional(CONFIG.proxyPassProperty());
|
||||||
|
|
||||||
cboDownloadSource.getSelectionModel().select(DownloadProviders.DOWNLOAD_PROVIDERS.indexOf(Settings.INSTANCE.getDownloadProvider()));
|
cboDownloadSource.getSelectionModel().select(DownloadProviders.DOWNLOAD_PROVIDERS.indexOf(Settings.INSTANCE.getDownloadProvider()));
|
||||||
cboDownloadSource.getSelectionModel().selectedIndexProperty().addListener((a, b, newValue) -> Settings.INSTANCE.setDownloadProvider(DownloadProviders.getDownloadProvider(newValue.intValue())));
|
cboDownloadSource.getSelectionModel().selectedIndexProperty().addListener((a, b, newValue) -> Settings.INSTANCE.setDownloadProvider(DownloadProviders.getDownloadProvider(newValue.intValue())));
|
||||||
@ -149,28 +149,28 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
chkProxySocks.setToggleGroup(proxyConfigurationGroup);
|
chkProxySocks.setToggleGroup(proxyConfigurationGroup);
|
||||||
|
|
||||||
for (Toggle toggle : proxyConfigurationGroup.getToggles())
|
for (Toggle toggle : proxyConfigurationGroup.getToggles())
|
||||||
if (toggle.getUserData() == CONFIG.proxyType.get())
|
if (toggle.getUserData() == CONFIG.getProxyType())
|
||||||
toggle.setSelected(true);
|
toggle.setSelected(true);
|
||||||
|
|
||||||
ToggleGroup hasProxyGroup = new ToggleGroup();
|
ToggleGroup hasProxyGroup = new ToggleGroup();
|
||||||
chkNoProxy.setToggleGroup(hasProxyGroup);
|
chkNoProxy.setToggleGroup(hasProxyGroup);
|
||||||
chkManualProxy.setToggleGroup(hasProxyGroup);
|
chkManualProxy.setToggleGroup(hasProxyGroup);
|
||||||
if (!CONFIG.hasProxy.get())
|
if (!CONFIG.hasProxy())
|
||||||
chkNoProxy.setSelected(true);
|
chkNoProxy.setSelected(true);
|
||||||
else
|
else
|
||||||
chkManualProxy.setSelected(true);
|
chkManualProxy.setSelected(true);
|
||||||
proxyPane.disableProperty().bind(chkNoProxy.selectedProperty());
|
proxyPane.disableProperty().bind(chkNoProxy.selectedProperty());
|
||||||
|
|
||||||
hasProxyGroup.selectedToggleProperty().addListener((a, b, newValue) ->
|
hasProxyGroup.selectedToggleProperty().addListener((a, b, newValue) ->
|
||||||
CONFIG.hasProxy.set(newValue != chkNoProxy));
|
CONFIG.setHasProxy(newValue != chkNoProxy));
|
||||||
|
|
||||||
proxyConfigurationGroup.selectedToggleProperty().addListener((a, b, newValue) ->
|
proxyConfigurationGroup.selectedToggleProperty().addListener((a, b, newValue) ->
|
||||||
CONFIG.proxyType.set((Proxy.Type) newValue.getUserData()));
|
CONFIG.setProxyType((Proxy.Type) newValue.getUserData()));
|
||||||
|
|
||||||
chkProxyAuthentication.selectedProperty().bindBidirectional(CONFIG.hasProxyAuth);
|
chkProxyAuthentication.selectedProperty().bindBidirectional(CONFIG.hasProxyAuthProperty());
|
||||||
authPane.disableProperty().bind(chkProxyAuthentication.selectedProperty().not());
|
authPane.disableProperty().bind(chkProxyAuthentication.selectedProperty().not());
|
||||||
|
|
||||||
fileCommonLocation.pathProperty().bindBidirectional(CONFIG.commonDirectory);
|
fileCommonLocation.pathProperty().bindBidirectional(CONFIG.commonDirectoryProperty());
|
||||||
|
|
||||||
FXUtils.installTooltip(btnUpdate, i18n("update.tooltip"));
|
FXUtils.installTooltip(btnUpdate, i18n("update.tooltip"));
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
@ -180,17 +180,17 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
backgroundItem.createChildren(i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
backgroundItem.createChildren(i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
||||||
));
|
));
|
||||||
|
|
||||||
FXUtils.bindString(backgroundItem.getTxtCustom(), CONFIG.backgroundImage);
|
FXUtils.bindString(backgroundItem.getTxtCustom(), CONFIG.backgroundImageProperty());
|
||||||
|
|
||||||
backgroundItem.setCustomUserData(EnumBackgroundImage.CUSTOM);
|
backgroundItem.setCustomUserData(EnumBackgroundImage.CUSTOM);
|
||||||
backgroundItem.getGroup().getToggles().stream().filter(it -> it.getUserData() == CONFIG.backgroundImageType.get()).findFirst().ifPresent(it -> it.setSelected(true));
|
backgroundItem.getGroup().getToggles().stream().filter(it -> it.getUserData() == CONFIG.getBackgroundImageType()).findFirst().ifPresent(it -> it.setSelected(true));
|
||||||
|
|
||||||
CONFIG.backgroundImage.addListener(onInvalidating(this::initBackgroundItemSubtitle));
|
CONFIG.backgroundImageProperty().addListener(onInvalidating(this::initBackgroundItemSubtitle));
|
||||||
CONFIG.backgroundImageType.addListener(onInvalidating(this::initBackgroundItemSubtitle));
|
CONFIG.backgroundImageTypeProperty().addListener(onInvalidating(this::initBackgroundItemSubtitle));
|
||||||
initBackgroundItemSubtitle();
|
initBackgroundItemSubtitle();
|
||||||
|
|
||||||
backgroundItem.setToggleSelectedListener(newValue ->
|
backgroundItem.setToggleSelectedListener(newValue ->
|
||||||
CONFIG.backgroundImageType.set((EnumBackgroundImage) newValue.getUserData()));
|
CONFIG.setBackgroundImageType((EnumBackgroundImage) newValue.getUserData()));
|
||||||
|
|
||||||
// theme
|
// theme
|
||||||
JFXColorPicker picker = new JFXColorPicker(Color.web(Settings.INSTANCE.getTheme().getColor()), null);
|
JFXColorPicker picker = new JFXColorPicker(Color.web(Settings.INSTANCE.getTheme().getColor()), null);
|
||||||
@ -207,12 +207,12 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBackgroundItemSubtitle() {
|
private void initBackgroundItemSubtitle() {
|
||||||
switch (CONFIG.backgroundImageType.get()) {
|
switch (CONFIG.getBackgroundImageType()) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
backgroundItem.setSubtitle(i18n("launcher.background.default"));
|
backgroundItem.setSubtitle(i18n("launcher.background.default"));
|
||||||
break;
|
break;
|
||||||
case CUSTOM:
|
case CUSTOM:
|
||||||
backgroundItem.setSubtitle(CONFIG.backgroundImage.get());
|
backgroundItem.setSubtitle(CONFIG.getBackgroundImage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ import org.jackhuang.hmcl.mod.Modpack;
|
|||||||
import org.jackhuang.hmcl.setting.Config;
|
import org.jackhuang.hmcl.setting.Config;
|
||||||
import org.jackhuang.hmcl.setting.ConfigHolder;
|
import org.jackhuang.hmcl.setting.ConfigHolder;
|
||||||
import org.jackhuang.hmcl.setting.Profile;
|
import org.jackhuang.hmcl.setting.Profile;
|
||||||
import org.jackhuang.hmcl.setting.Settings;
|
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
||||||
@ -83,16 +82,16 @@ public final class ExportWizardProvider implements WizardProvider {
|
|||||||
try (ZipEngine zip = new ZipEngine(modpackFile)) {
|
try (ZipEngine zip = new ZipEngine(modpackFile)) {
|
||||||
Config config = ConfigHolder.CONFIG.clone();
|
Config config = ConfigHolder.CONFIG.clone();
|
||||||
|
|
||||||
config.hasProxy.set(false);
|
config.setHasProxy(false);
|
||||||
config.selectedProfile.set("");
|
config.setSelectedProfile("");
|
||||||
config.commonDirectory.set(null);
|
config.setCommonDirectory(null);
|
||||||
config.fontFamily.set("Consolas");
|
config.setFontFamily("Consolas");
|
||||||
config.fontSize.set(12);
|
config.setFontSize(12);
|
||||||
config.localization.set(null);
|
config.setLocalization(null);
|
||||||
config.accounts.clear();
|
config.getAccounts().clear();
|
||||||
config.selectedAccount.set("");
|
config.setSelectedAccount("");
|
||||||
config.logLines.set(100);
|
config.setLogLines(100);
|
||||||
config.configurations.clear();
|
config.getConfigurations().clear();
|
||||||
|
|
||||||
zip.putTextFile(config.toJson(), ConfigHolder.CONFIG_FILENAME);
|
zip.putTextFile(config.toJson(), ConfigHolder.CONFIG_FILENAME);
|
||||||
zip.putFile(tempModpack, "modpack.zip");
|
zip.putFile(tempModpack, "modpack.zip");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user