-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4b03ae
commit f24c4c1
Showing
16 changed files
with
1,599 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
48
src/main/java/com/srfairyox/Corvus/Config/ConfigLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.