Code Refactor - Whitespace Refactor
This commit is contained in:
@@ -18,93 +18,90 @@ import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CustomConfiguration extends YamlConfiguration{
|
||||
public class CustomConfiguration extends YamlConfiguration {
|
||||
|
||||
private File configFile;
|
||||
private File configFile;
|
||||
|
||||
public CustomConfiguration(File file)
|
||||
{
|
||||
this.configFile = file;
|
||||
public CustomConfiguration(File file) {
|
||||
this.configFile = file;
|
||||
|
||||
load();
|
||||
}
|
||||
load();
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
try {
|
||||
super.load(configFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Could not find " + configFile.getName() + ", creating new one...");
|
||||
reLoad();
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Could not load " + configFile.getName(), e);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, configFile.getName() + " is no valid configuration file", e);
|
||||
}
|
||||
}
|
||||
public void load() {
|
||||
try {
|
||||
super.load(configFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(
|
||||
Level.SEVERE,
|
||||
"Could not find " + configFile.getName()
|
||||
+ ", creating new one...");
|
||||
reLoad();
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,
|
||||
"Could not load " + configFile.getName(), e);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName())
|
||||
.log(Level.SEVERE,
|
||||
configFile.getName()
|
||||
+ " is no valid configuration file", e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean reLoad() {
|
||||
boolean out = true;
|
||||
if (!configFile.exists())
|
||||
{
|
||||
out = loadRessource(configFile);
|
||||
}
|
||||
if (out) load();
|
||||
return out;
|
||||
}
|
||||
public boolean reLoad() {
|
||||
boolean out = true;
|
||||
if (!configFile.exists()) {
|
||||
out = loadRessource(configFile);
|
||||
}
|
||||
if (out) load();
|
||||
return out;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
super.save(configFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Could not save config to " + configFile.getName(), ex);
|
||||
}
|
||||
}
|
||||
public void save() {
|
||||
try {
|
||||
super.save(configFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,
|
||||
"Could not save config to " + configFile.getName(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean loadRessource(File file) {
|
||||
boolean out = true;
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
InputStream fis = getClass().getResourceAsStream("/" + file.getName());
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8").newDecoder()));
|
||||
String str;
|
||||
Writer writer = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(file), Charset.forName("UTF-8").newEncoder()));
|
||||
while ((str = reader.readLine()) != null) {
|
||||
writer.append(str).append("\r\n");
|
||||
}
|
||||
writer.flush();
|
||||
writer.close();
|
||||
reader.close();
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Failed to load config from JAR");
|
||||
out = false;
|
||||
}
|
||||
/*FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(file);
|
||||
byte[] buf = new byte[1024];
|
||||
int i = 0;
|
||||
while ((i = fis.read(buf)) != -1) {
|
||||
fos.write(buf, 0, i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Failed to load config from JAR");
|
||||
out = false;
|
||||
} finally {
|
||||
try {
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
}
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
public boolean loadRessource(File file) {
|
||||
boolean out = true;
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
InputStream fis = getClass().getResourceAsStream(
|
||||
"/" + file.getName());
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(fis, Charset.forName("UTF-8")
|
||||
.newDecoder()));
|
||||
String str;
|
||||
Writer writer = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(file), Charset.forName("UTF-8")
|
||||
.newEncoder()));
|
||||
while ((str = reader.readLine()) != null) {
|
||||
writer.append(str).append("\r\n");
|
||||
}
|
||||
writer.flush();
|
||||
writer.close();
|
||||
reader.close();
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,
|
||||
"Failed to load config from JAR");
|
||||
out = false;
|
||||
}
|
||||
/*
|
||||
* FileOutputStream fos = null; try { fos = new
|
||||
* FileOutputStream(file); byte[] buf = new byte[1024]; int i = 0;
|
||||
* while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } }
|
||||
* catch (Exception e) {
|
||||
* Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE,
|
||||
* "Failed to load config from JAR"); out = false; } finally { try {
|
||||
* if (fis != null) { fis.close(); } if (fos != null) { fos.close();
|
||||
* } } catch (Exception e) { } } }
|
||||
*/
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,12 @@ public class Messages extends CustomConfiguration {
|
||||
/**
|
||||
* Loads a file from the plugin jar and sets as default
|
||||
*
|
||||
* @param filename The filename to open
|
||||
* @param filename
|
||||
* The filename to open
|
||||
*/
|
||||
public final void loadDefaults(File file) {
|
||||
InputStream stream = AuthMe.getInstance().getResource(file.getName());
|
||||
if(stream == null) return;
|
||||
if (stream == null) return;
|
||||
|
||||
setDefaults(YamlConfiguration.loadConfiguration(stream));
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public class Messages extends CustomConfiguration {
|
||||
return success;
|
||||
}
|
||||
|
||||
private void loadFile() {
|
||||
private void loadFile() {
|
||||
this.load();
|
||||
this.save();
|
||||
}
|
||||
@@ -69,32 +70,40 @@ public class Messages extends CustomConfiguration {
|
||||
public void _(CommandSender sender, String msg) {
|
||||
String loc = (String) this.get(msg);
|
||||
if (loc == null) {
|
||||
loc = "Error with Translation files; Please contact the admin for verify or update translation";
|
||||
ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !");
|
||||
loc = "Error with Translation files; Please contact the admin for verify or update translation";
|
||||
ConsoleLogger.showError("Error with the " + msg
|
||||
+ " translation, verify in your " + Settings.MESSAGE_FILE
|
||||
+ "_" + Settings.messagesLanguage + ".yml !");
|
||||
}
|
||||
for (String l : loc.split("&n")) {
|
||||
sender.sendMessage(l.replace("&", "\u00a7"));
|
||||
sender.sendMessage(l.replace("&", "\u00a7"));
|
||||
}
|
||||
}
|
||||
|
||||
public String[] _(String msg) {
|
||||
int i = ((String) this.get(msg)).split("&n").length;
|
||||
int i = ((String) this.get(msg)).split("&n").length;
|
||||
String[] loc = new String[i];
|
||||
int a;
|
||||
for (a = 0 ; a < i ; a++) {
|
||||
loc[a] = ((String) this.get(msg)).split("&n")[a].replace("&", "\u00a7");
|
||||
for (a = 0; a < i; a++) {
|
||||
loc[a] = ((String) this.get(msg)).split("&n")[a].replace("&",
|
||||
"\u00a7");
|
||||
}
|
||||
if (loc == null || loc.length == 0) {
|
||||
loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files";
|
||||
ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + Settings.MESSAGE_FILE + "_" + Settings.messagesLanguage + ".yml !");
|
||||
loc[0] = "Error with "
|
||||
+ msg
|
||||
+ " translation; Please contact the admin for verify or update translation files";
|
||||
ConsoleLogger.showError("Error with the " + msg
|
||||
+ " translation, verify in your " + Settings.MESSAGE_FILE
|
||||
+ "_" + Settings.messagesLanguage + ".yml !");
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
public static Messages getInstance() {
|
||||
public static Messages getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new Messages(new File(Settings.MESSAGE_FILE+"_"+Settings.messagesLanguage+".yml"));
|
||||
}
|
||||
singleton = new Messages(new File(Settings.MESSAGE_FILE + "_"
|
||||
+ Settings.messagesLanguage + ".yml"));
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,25 +9,25 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class OtherAccounts extends CustomConfiguration {
|
||||
private static OtherAccounts others = null;
|
||||
private static OtherAccounts others = null;
|
||||
|
||||
public OtherAccounts() {
|
||||
super(new File("./plugins/AuthMe/otheraccounts.yml"));
|
||||
others = this;
|
||||
load();
|
||||
save();
|
||||
}
|
||||
public OtherAccounts() {
|
||||
super(new File("./plugins/AuthMe/otheraccounts.yml"));
|
||||
others = this;
|
||||
load();
|
||||
save();
|
||||
}
|
||||
|
||||
public void clear(UUID uuid) {
|
||||
set(uuid.toString(), new ArrayList<String>());
|
||||
save();
|
||||
}
|
||||
public void clear(UUID uuid) {
|
||||
set(uuid.toString(), new ArrayList<String>());
|
||||
save();
|
||||
}
|
||||
|
||||
public static OtherAccounts getInstance() {
|
||||
public static OtherAccounts getInstance() {
|
||||
if (others == null) {
|
||||
others = new OtherAccounts();
|
||||
}
|
||||
@@ -35,33 +35,33 @@ public class OtherAccounts extends CustomConfiguration {
|
||||
}
|
||||
|
||||
public void addPlayer(UUID uuid) {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (!this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).add(player.getName());
|
||||
save();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (!this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).add(player.getName());
|
||||
save();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(UUID uuid) {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).remove(player.getName());
|
||||
save();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
public void removePlayer(UUID uuid) {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).remove(player.getName());
|
||||
save();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<String> getAllPlayersByUUID(UUID uuid) {
|
||||
return this.getStringList(uuid.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getAllPlayersByUUID(UUID uuid) {
|
||||
return this.getStringList(uuid.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,27 +5,27 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class PlayersLogs extends CustomConfiguration {
|
||||
private static PlayersLogs pllog = null;
|
||||
public List<String> players;
|
||||
private static PlayersLogs pllog = null;
|
||||
public List<String> players;
|
||||
|
||||
public PlayersLogs() {
|
||||
super(new File("./plugins/AuthMe/players.yml"));
|
||||
pllog = this;
|
||||
load();
|
||||
save();
|
||||
players = this.getStringList("players");
|
||||
}
|
||||
public PlayersLogs() {
|
||||
super(new File("./plugins/AuthMe/players.yml"));
|
||||
pllog = this;
|
||||
load();
|
||||
save();
|
||||
players = this.getStringList("players");
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
set("players", new ArrayList<String>());
|
||||
save();
|
||||
}
|
||||
public void clear() {
|
||||
set("players", new ArrayList<String>());
|
||||
save();
|
||||
}
|
||||
|
||||
public static PlayersLogs getInstance() {
|
||||
public static PlayersLogs getInstance() {
|
||||
if (pllog == null) {
|
||||
pllog = new PlayersLogs();
|
||||
}
|
||||
@@ -41,12 +41,12 @@ public class PlayersLogs extends CustomConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(String user) {
|
||||
public void removePlayer(String user) {
|
||||
players = this.getStringList("players");
|
||||
if (players.contains(user.toLowerCase())) {
|
||||
players.remove(user.toLowerCase());
|
||||
set("players", players);
|
||||
save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,106 +5,118 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class Spawn extends CustomConfiguration {
|
||||
|
||||
private static Spawn spawn;
|
||||
private static Spawn spawn;
|
||||
|
||||
public Spawn() {
|
||||
super(new File("./plugins/AuthMe/spawn.yml"));
|
||||
spawn = this;
|
||||
load();
|
||||
save();
|
||||
saveDefault();
|
||||
}
|
||||
public Spawn() {
|
||||
super(new File("./plugins/AuthMe/spawn.yml"));
|
||||
spawn = this;
|
||||
load();
|
||||
save();
|
||||
saveDefault();
|
||||
}
|
||||
|
||||
private void saveDefault() {
|
||||
if (!contains("spawn")) {
|
||||
set("spawn.world", "");
|
||||
set("spawn.x", "");
|
||||
set("spawn.y", "");
|
||||
set("spawn.z", "");
|
||||
set("spawn.yaw", "");
|
||||
set("spawn.pitch", "");
|
||||
save();
|
||||
}
|
||||
if (!contains("firstspawn")) {
|
||||
set("firstspawn.world", "");
|
||||
set("firstspawn.x", "");
|
||||
set("firstspawn.y", "");
|
||||
set("firstspawn.z", "");
|
||||
set("firstspawn.yaw", "");
|
||||
set("firstspawn.pitch", "");
|
||||
save();
|
||||
}
|
||||
}
|
||||
private void saveDefault() {
|
||||
if (!contains("spawn")) {
|
||||
set("spawn.world", "");
|
||||
set("spawn.x", "");
|
||||
set("spawn.y", "");
|
||||
set("spawn.z", "");
|
||||
set("spawn.yaw", "");
|
||||
set("spawn.pitch", "");
|
||||
save();
|
||||
}
|
||||
if (!contains("firstspawn")) {
|
||||
set("firstspawn.world", "");
|
||||
set("firstspawn.x", "");
|
||||
set("firstspawn.y", "");
|
||||
set("firstspawn.z", "");
|
||||
set("firstspawn.yaw", "");
|
||||
set("firstspawn.pitch", "");
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public static Spawn getInstance() {
|
||||
public static Spawn getInstance() {
|
||||
if (spawn == null) {
|
||||
spawn = new Spawn();
|
||||
}
|
||||
}
|
||||
return spawn;
|
||||
}
|
||||
|
||||
public boolean setSpawn(Location location) {
|
||||
try {
|
||||
set("spawn.world", location.getWorld().getName());
|
||||
set("spawn.x", location.getX());
|
||||
set("spawn.y", location.getY());
|
||||
set("spawn.z", location.getZ());
|
||||
set("spawn.yaw", location.getYaw());
|
||||
set("spawn.pitch", location.getPitch());
|
||||
save();
|
||||
return true;
|
||||
} catch (NullPointerException npe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean setSpawn(Location location) {
|
||||
try {
|
||||
set("spawn.world", location.getWorld().getName());
|
||||
set("spawn.x", location.getX());
|
||||
set("spawn.y", location.getY());
|
||||
set("spawn.z", location.getZ());
|
||||
set("spawn.yaw", location.getYaw());
|
||||
set("spawn.pitch", location.getPitch());
|
||||
save();
|
||||
return true;
|
||||
} catch (NullPointerException npe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setFirstSpawn(Location location) {
|
||||
try {
|
||||
set("firstspawn.world", location.getWorld().getName());
|
||||
set("firstspawn.x", location.getX());
|
||||
set("firstspawn.y", location.getY());
|
||||
set("firstspawn.z", location.getZ());
|
||||
set("firstspawn.yaw", location.getYaw());
|
||||
set("firstspawn.pitch", location.getPitch());
|
||||
save();
|
||||
return true;
|
||||
} catch (NullPointerException npe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Location getLocation() {
|
||||
return getSpawn();
|
||||
}
|
||||
|
||||
public Location getSpawn() {
|
||||
try {
|
||||
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
|
||||
return location;
|
||||
} catch (NullPointerException npe) {
|
||||
return null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Location getFirstSpawn() {
|
||||
try {
|
||||
if (this.getString("firstspawn.world").isEmpty() || this.getString("firstspawn.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
|
||||
return location;
|
||||
} catch (NullPointerException npe) {
|
||||
return null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public boolean setFirstSpawn(Location location) {
|
||||
try {
|
||||
set("firstspawn.world", location.getWorld().getName());
|
||||
set("firstspawn.x", location.getX());
|
||||
set("firstspawn.y", location.getY());
|
||||
set("firstspawn.z", location.getZ());
|
||||
set("firstspawn.yaw", location.getYaw());
|
||||
set("firstspawn.pitch", location.getPitch());
|
||||
save();
|
||||
return true;
|
||||
} catch (NullPointerException npe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Location getLocation() {
|
||||
return getSpawn();
|
||||
}
|
||||
|
||||
public Location getSpawn() {
|
||||
try {
|
||||
if (this.getString("spawn.world").isEmpty()
|
||||
|| this.getString("spawn.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this
|
||||
.getString("spawn.world")), this.getDouble("spawn.x"),
|
||||
this.getDouble("spawn.y"), this.getDouble("spawn.z"),
|
||||
Float.parseFloat(this.getString("spawn.yaw")),
|
||||
Float.parseFloat(this.getString("spawn.pitch")));
|
||||
return location;
|
||||
} catch (NullPointerException npe) {
|
||||
return null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Location getFirstSpawn() {
|
||||
try {
|
||||
if (this.getString("firstspawn.world").isEmpty()
|
||||
|| this.getString("firstspawn.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this
|
||||
.getString("firstspawn.world")),
|
||||
this.getDouble("firstspawn.x"),
|
||||
this.getDouble("firstspawn.y"),
|
||||
this.getDouble("firstspawn.z"), Float.parseFloat(this
|
||||
.getString("firstspawn.yaw")),
|
||||
Float.parseFloat(this.getString("firstspawn.pitch")));
|
||||
return location;
|
||||
} catch (NullPointerException npe) {
|
||||
return null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,36 +3,38 @@ package fr.xephi.authme.settings;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SpoutCfg extends CustomConfiguration{
|
||||
public class SpoutCfg extends CustomConfiguration {
|
||||
|
||||
private static SpoutCfg instance = null;
|
||||
private static SpoutCfg instance = null;
|
||||
|
||||
public SpoutCfg(File file)
|
||||
{
|
||||
super(file);
|
||||
loadDefaults();
|
||||
load();
|
||||
save();
|
||||
}
|
||||
public SpoutCfg(File file) {
|
||||
super(file);
|
||||
loadDefaults();
|
||||
load();
|
||||
save();
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private void loadDefaults() {
|
||||
this.set("Spout GUI enabled", true);
|
||||
this.set("LoginScreen.enabled", true);
|
||||
this.set("LoginScreen.exit button", "Quit");
|
||||
this.set("LoginScreen.exit message", "Good Bye");
|
||||
this.set("LoginScreen.login button", "Login");
|
||||
this.set("LoginScreen.title", "LOGIN");
|
||||
this.set("LoginScreen.text", new ArrayList<String>() {{
|
||||
add("Sample text");
|
||||
add("Change this at spout.yml");
|
||||
add("--- AuthMe Reloaded by ---");
|
||||
add("Xephi59");
|
||||
}});
|
||||
}
|
||||
@SuppressWarnings("serial")
|
||||
private void loadDefaults() {
|
||||
this.set("Spout GUI enabled", true);
|
||||
this.set("LoginScreen.enabled", true);
|
||||
this.set("LoginScreen.exit button", "Quit");
|
||||
this.set("LoginScreen.exit message", "Good Bye");
|
||||
this.set("LoginScreen.login button", "Login");
|
||||
this.set("LoginScreen.title", "LOGIN");
|
||||
this.set("LoginScreen.text", new ArrayList<String>() {
|
||||
{
|
||||
add("Sample text");
|
||||
add("Change this at spout.yml");
|
||||
add("--- AuthMe Reloaded by ---");
|
||||
add("Xephi59");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static SpoutCfg getInstance() {
|
||||
if (instance == null) instance = new SpoutCfg(new File("plugins/AuthMe", "spout.yml"));
|
||||
return instance;
|
||||
}
|
||||
public static SpoutCfg getInstance() {
|
||||
if (instance == null) instance = new SpoutCfg(new File(
|
||||
"plugins/AuthMe", "spout.yml"));
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user