Add downloadPath and renderPath settings

This commit is contained in:
johni0702
2016-08-15 10:09:05 +02:00
parent edf57490a6
commit 108d25c574
5 changed files with 23 additions and 7 deletions

View File

@@ -39,8 +39,6 @@ public class ReplayModOnline {
private Logger logger;
private File downloadsFolder = new File("replay_downloads");
private ApiClient apiClient;
/**
@@ -64,8 +62,8 @@ public class ReplayModOnline {
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
if (!downloadsFolder.mkdirs()) {
logger.warn("Failed to create downloads folder: " + downloadsFolder);
if (!getDownloadsFolder().mkdirs()) {
logger.warn("Failed to create downloads folder: " + getDownloadsFolder());
}
new GuiHandler(this).register();
@@ -103,11 +101,11 @@ public class ReplayModOnline {
}
public File getDownloadsFolder() {
return downloadsFolder;
return new File(core.getSettingsRegistry().get(Setting.DOWNLOAD_PATH));
}
public File getDownloadedFile(int id) {
return new File(downloadsFolder, id + ".mcpr");
return new File(getDownloadsFolder(), id + ".mcpr");
}
public boolean hasDownloaded(int id) {

View File

@@ -4,6 +4,8 @@ import com.replaymod.core.SettingsRegistry;
public final class Setting<T> extends SettingsRegistry.SettingKeys<T> {
public static final Setting<Boolean> SKIP_LOGIN_PROMPT = make("skipLoginPrompt", null, false);
public static final SettingsRegistry.SettingKey<String> DOWNLOAD_PATH =
new SettingsRegistry.SettingKeys<>("advanced", "downloadPath", null, "./replay_downloads/");
private static <T> Setting<T> make(String key, String displayName, T defaultValue) {
return new Setting<>(key, displayName, defaultValue);