Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fede-Coder committed Dec 23, 2020
1 parent b4b03ae commit f24c4c1
Show file tree
Hide file tree
Showing 16 changed files with 1,599 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Corvus.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
46 changes: 46 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.srfairyox</groupId>
<artifactId>Corvus</artifactId>
<version>0.1</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<mainClass>com.srfairyox.Corvus.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20201115</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.srfairyox.Corvus.Main

48 changes: 48 additions & 0 deletions src/main/java/com/srfairyox/Corvus/Config/ConfigLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.srfairyox.Corvus.Config;

import com.srfairyox.Corvus.Main;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;

public class ConfigLoader {
private static File configJSON;

public ConfigLoader() {
configJSON = new File("config.json");
if(!configJSON.exists()) {
try {
Files.copy(Objects.requireNonNull(Main.instance.getClass().getClassLoader().getResourceAsStream(configJSON.getName())), configJSON.toPath());
} catch (IOException e) {
e.printStackTrace();
}
}
}

public void save(Boolean enableLog, Boolean enableDebugConsole, int gateSelectedIndex, Boolean placeGateOnMap, Boolean spinOnlyEE, int minUridium, int maxSpinCost) throws IOException {
JSONObject jsonObject = new JSONObject();

jsonObject.put("enableLog", enableLog);
jsonObject.put("enableDebugConsole", enableDebugConsole);
jsonObject.put("gateSelectedIndex", gateSelectedIndex);
jsonObject.put("placeGateOnMap", placeGateOnMap);
jsonObject.put("spinOnlyEE", spinOnlyEE);
jsonObject.put("minUridium", minUridium);
jsonObject.put("maxSpinCost", maxSpinCost);

Files.write(Paths.get(configJSON.getName()), jsonObject.toString().getBytes());
}

public String load() {
try {
return new String(Files.readAllBytes(configJSON.toPath()));
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
Loading

0 comments on commit f24c4c1

Please sign in to comment.