mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-28 05:05:14 +01:00
Removed max mysql connections options from config.
This commit is contained in:
parent
45c6bf0a78
commit
1f001f2225
@ -1,5 +1,7 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
|
import com.google.common.io.Files;
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -8,10 +10,14 @@ import fr.xephi.authme.security.HashAlgorithm;
|
|||||||
import fr.xephi.authme.util.Wrapper;
|
import fr.xephi.authme.util.Wrapper;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import java.io.BufferedReader;
|
||||||
import com.google.common.io.Files;
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
import java.io.*;
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -94,7 +100,7 @@ public final class Settings {
|
|||||||
getMailPort, maxLoginTry, captchaLength, saltLength,
|
getMailPort, maxLoginTry, captchaLength, saltLength,
|
||||||
getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup,
|
getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup,
|
||||||
antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp,
|
antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp,
|
||||||
getMaxJoinPerIp, getMySQLMaxConnections;
|
getMaxJoinPerIp;
|
||||||
protected static YamlConfiguration configFile;
|
protected static YamlConfiguration configFile;
|
||||||
private static AuthMe plugin;
|
private static AuthMe plugin;
|
||||||
private static Settings instance;
|
private static Settings instance;
|
||||||
@ -170,7 +176,6 @@ public final class Settings {
|
|||||||
isCachingEnabled = configFile.getBoolean("DataSource.caching", true);
|
isCachingEnabled = configFile.getBoolean("DataSource.caching", true);
|
||||||
getMySQLHost = configFile.getString("DataSource.mySQLHost", "127.0.0.1");
|
getMySQLHost = configFile.getString("DataSource.mySQLHost", "127.0.0.1");
|
||||||
getMySQLPort = configFile.getString("DataSource.mySQLPort", "3306");
|
getMySQLPort = configFile.getString("DataSource.mySQLPort", "3306");
|
||||||
getMySQLMaxConnections = configFile.getInt("DataSource.mySQLMaxConections", 25);
|
|
||||||
getMySQLUsername = configFile.getString("DataSource.mySQLUsername", "authme");
|
getMySQLUsername = configFile.getString("DataSource.mySQLUsername", "authme");
|
||||||
getMySQLPassword = configFile.getString("DataSource.mySQLPassword", "12345");
|
getMySQLPassword = configFile.getString("DataSource.mySQLPassword", "12345");
|
||||||
getMySQLDatabase = configFile.getString("DataSource.mySQLDatabase", "authme");
|
getMySQLDatabase = configFile.getString("DataSource.mySQLDatabase", "authme");
|
||||||
@ -301,39 +306,36 @@ public final class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String loadEmailText() {
|
private static String loadEmailText() {
|
||||||
if (!EMAIL_FILE.exists())
|
if (!EMAIL_FILE.exists())
|
||||||
saveDefaultEmailText();
|
saveDefaultEmailText();
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE));
|
BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE));
|
||||||
String s;
|
String s;
|
||||||
while ((s = in.readLine()) != null)
|
while ((s = in.readLine()) != null)
|
||||||
str.append(s);
|
str.append(s);
|
||||||
in.close();
|
in.close();
|
||||||
} catch(IOException e)
|
} catch (IOException ignored) {
|
||||||
{
|
}
|
||||||
}
|
return str.toString();
|
||||||
return str.toString();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void saveDefaultEmailText() {
|
private static void saveDefaultEmailText() {
|
||||||
InputStream file = plugin.getResource("email.html");
|
InputStream file = plugin.getResource("email.html");
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(file, Charset.forName("utf-8")));
|
BufferedReader in = new BufferedReader(new InputStreamReader(file, Charset.forName("utf-8")));
|
||||||
String s;
|
String s;
|
||||||
while ((s = in.readLine()) != null)
|
while ((s = in.readLine()) != null)
|
||||||
str.append(s);
|
str.append(s);
|
||||||
in.close();
|
in.close();
|
||||||
Files.touch(EMAIL_FILE);
|
Files.touch(EMAIL_FILE);
|
||||||
Files.write(str.toString(), EMAIL_FILE, Charsets.UTF_8);
|
Files.write(str.toString(), EMAIL_FILE, Charsets.UTF_8);
|
||||||
}
|
} catch (Exception ignored) {
|
||||||
catch(Exception e)
|
}
|
||||||
{
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setValue(String key, Object value) {
|
public static void setValue(String key, Object value) {
|
||||||
instance.set(key, value);
|
instance.set(key, value);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@ -713,10 +715,9 @@ public final class Settings {
|
|||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contains("Email.mailText"))
|
if (contains("Email.mailText")) {
|
||||||
{
|
set("Email.mailText", null);
|
||||||
set("Email.mailText", null);
|
ConsoleLogger.showError("Remove Email.mailText from config, we now use the email.html file");
|
||||||
ConsoleLogger.showError("Remove Email.mailText from config, we now use the email.html file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes) {
|
if (changes) {
|
||||||
|
@ -8,8 +8,6 @@ DataSource:
|
|||||||
mySQLHost: 127.0.0.1
|
mySQLHost: 127.0.0.1
|
||||||
# Database Port
|
# Database Port
|
||||||
mySQLPort: '3306'
|
mySQLPort: '3306'
|
||||||
# MySql Max Connections
|
|
||||||
mySQLMaxConections: 8
|
|
||||||
# Username about Database Connection Infos
|
# Username about Database Connection Infos
|
||||||
mySQLUsername: authme
|
mySQLUsername: authme
|
||||||
# Password about Database Connection Infos
|
# Password about Database Connection Infos
|
||||||
|
Loading…
Reference in New Issue
Block a user