diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-16 17:51:21 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-16 17:51:21 +0900 |
commit | e6f83a23279ba7f2254efa4b49074fbc49bfb054 (patch) | |
tree | efea89836c3376ff1edbe3fdb22c6d95d3221b2c /src/main/java/kr/syeyoung/dungeonsguide/e.java | |
parent | 3305b6493ca089226c5ad194068231c8e1605bcf (diff) | |
download | Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.tar.gz Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.tar.bz2 Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.zip |
asd
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/e.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/e.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index 201a9b3c..d9f0e68a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -7,14 +7,18 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import org.apache.commons.io.IOUtils; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -29,6 +33,10 @@ public class e implements c { @Getter private b authenticator; + + @Getter + private Configuration configuration; + public e(b authenticator) { this.authenticator = authenticator; } @@ -68,7 +76,25 @@ public class e implements c { Keybinds.register(); } public void pre(FMLPreInitializationEvent event) { - configDir = new File(event.getModConfigurationDirectory(),"z"); + configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide"); + File configFile = new File(configDir, "config.conf"); + if (!configFile.exists()) { + configDir.mkdirs(); + try { + copy(e.class.getResourceAsStream("defaultConfig.conf"), configFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + configuration = new Configuration(configFile); + configuration.load(); + } + private void copy(InputStream inputStream, File f) throws IOException { + FileOutputStream fos = new FileOutputStream(f); + IOUtils.copy(inputStream, fos); + fos.flush(); + fos.close(); + inputStream.close(); } @Getter |