84 lines
3.2 KiB
Java
Executable File
84 lines
3.2 KiB
Java
Executable File
package core;
|
|
|
|
import java.io.*;
|
|
import java.util.Properties;
|
|
|
|
public class config {
|
|
public String token;
|
|
public String GameWatching = "Den NinjaSäuen zu";
|
|
|
|
public String targetRole = "Ninjasau";
|
|
public String authorizedRole = "Chief Ninjasau";
|
|
|
|
public String userNotFound = "Benutzer nicht gefunden";
|
|
public String noPrivilegs = "Du bist nicht berechtigt den Befehl auszuführen";
|
|
|
|
public String hasGroup = "%Member% hat bereits die Gruppe %Group%";
|
|
public String becameGroup = "%Member% wurde der Gruppe %Group% zugeteilt";
|
|
|
|
public String notInGroup = "%Member% ist nicht in der Gruppe %Group%";
|
|
public String removeGroup = "%Member% wurde aus der Gruppe %Group% entfernt";
|
|
|
|
|
|
public void readConfig() {
|
|
FileInputStream input = null;
|
|
OutputStream output = null;
|
|
Properties config = new Properties();
|
|
try {
|
|
File f = new File("config.cfg");
|
|
if (f.isFile() && f.canRead()) {
|
|
|
|
input = new FileInputStream("config.cfg");
|
|
config.load(input);
|
|
if(config.containsKey("token"))
|
|
this.token = config.getProperty("token");
|
|
if(config.containsKey("GameWatching"))
|
|
this.GameWatching = config.getProperty("GameWatching");
|
|
|
|
if(config.containsKey("targetRole"))
|
|
this.targetRole = config.getProperty("targetRole");
|
|
if(config.containsKey("authorizedRole"))
|
|
this.authorizedRole = config.getProperty("authorizedRole");
|
|
if(config.containsKey("userNotFound"))
|
|
this.userNotFound = config.getProperty("userNotFound");
|
|
if(config.containsKey("noPrivilegs"))
|
|
this.noPrivilegs = config.getProperty("noPrivilegs");
|
|
if(config.containsKey("hasGroup"))
|
|
this.hasGroup = config.getProperty("hasGroup");
|
|
if(config.containsKey("becameGroup"))
|
|
this.becameGroup = config.getProperty("becameGroup");
|
|
if(config.containsKey("notInGroup"))
|
|
this.notInGroup = config.getProperty("notInGroup");
|
|
if(config.containsKey("removeGroup"))
|
|
this.removeGroup = config.getProperty("removeGroup");
|
|
|
|
}
|
|
else {
|
|
output = new FileOutputStream("config.cfg");
|
|
config.setProperty("targetRole", this.targetRole);
|
|
config.setProperty("authorizedRole", this.authorizedRole);
|
|
config.setProperty("userNotFound", this.userNotFound);
|
|
config.setProperty("noPrivilegs", this.noPrivilegs);
|
|
config.setProperty("hasGroup", this.hasGroup);
|
|
config.setProperty("becameGroup", this.becameGroup);
|
|
config.setProperty("notInGroup", this.notInGroup);
|
|
config.setProperty("removeGroup", this.removeGroup);
|
|
config.store(output, null);
|
|
|
|
}
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
finally {
|
|
if (input != null) {
|
|
try {
|
|
input.close();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|