mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
This can never be null, and there's no reason to pass that as a variable.
This commit is contained in:
parent
9c6d1ce020
commit
57541ec233
@ -236,24 +236,17 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
/* mySQL */
|
/* mySQL */
|
||||||
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
|
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
|
||||||
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
|
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
|
||||||
public String getMySQLDatabaseName() { return getStringIncludingInts(config, "MySQL.Database.Name"); }
|
public String getMySQLDatabaseName() { return getStringIncludingInts("MySQL.Database.Name"); }
|
||||||
public String getMySQLUserName() { return getStringIncludingInts(config, "MySQL.Database.User_Name"); }
|
public String getMySQLUserName() { return getStringIncludingInts("MySQL.Database.User_Name"); }
|
||||||
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
||||||
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
||||||
|
public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
|
||||||
|
|
||||||
public String getMySQLUserPassword() {
|
private String getStringIncludingInts(String key) {
|
||||||
if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
|
String str = config.getString(key);
|
||||||
return getStringIncludingInts(config, "MySQL.Database.User_Password");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
|
|
||||||
String str = cfg.getString(key);
|
|
||||||
|
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
str = String.valueOf(cfg.getInt(key));
|
str = String.valueOf(config.getInt(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str.equals("0")) {
|
if (str.equals("0")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user