mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 08:39:04 +00:00
Implementation of Gradle build framework (#369)
* Cleanup * Add build file * The great migration * Restore MINA to 1.1.7 * Removed .gradle * Added flatdir for libs with no artifact repository * Add README.md, rename Implementation-Title
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.rebotted.integrations;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.rebotted.GameEngine;
|
||||
import com.rebotted.integrations.discord.JavaCord;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SettingsLoader {
|
||||
private static void initialize() {
|
||||
JSONObject main = new JSONObject();
|
||||
main
|
||||
.put("bot-token", "")
|
||||
.put("websitepass", "")
|
||||
.put("erssecret", "");
|
||||
try {
|
||||
BufferedWriter br = new BufferedWriter(new FileWriter("data/secrets.json"));
|
||||
br.write(main.toString());
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadSettings() throws IOException {
|
||||
if (!new File("data/secrets.json").exists()) {
|
||||
initialize();
|
||||
System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!");
|
||||
System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!");
|
||||
|
||||
} else {
|
||||
BufferedReader br = new BufferedReader(new FileReader("data/secrets.json"));
|
||||
String out = br.lines().collect(Collectors.joining("\n"));
|
||||
JSONObject obj = new JSONObject(out);
|
||||
|
||||
JavaCord.token = obj.getString("bot-token");
|
||||
PlayersOnlineWebsite.password = obj.getString("websitepass");
|
||||
RegisteredAccsWebsite.password = obj.getString("websitepass");
|
||||
GameEngine.ersSecret = obj.getString("erssecret");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user