mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-11 11:40:21 +00:00
MySQL table prefix and connection pool size settings
This commit is contained in:
parent
08405801b6
commit
3bf5f899bd
3 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,7 @@ package dev.esophose.playerparticles.database;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@ -19,7 +20,7 @@ public class MySQLConnector implements DatabaseConnector {
|
||||||
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=" + useSSL);
|
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=" + useSSL);
|
||||||
config.setUsername(username);
|
config.setUsername(username);
|
||||||
config.setPassword(password);
|
config.setPassword(password);
|
||||||
config.setMaximumPoolSize(5);
|
config.setMaximumPoolSize(Setting.MYSQL_CONNECTION_POOL_SIZE.getInt());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.hikari = new HikariDataSource(config);
|
this.hikari = new HikariDataSource(config);
|
||||||
|
|
|
@ -63,7 +63,9 @@ public class ConfigurationManager extends Manager {
|
||||||
MYSQL_DATABASE_NAME("mysql-settings.database-name", "", "MySQL Database Name"),
|
MYSQL_DATABASE_NAME("mysql-settings.database-name", "", "MySQL Database Name"),
|
||||||
MYSQL_USER_NAME("mysql-settings.user-name", "", "MySQL Database User Name"),
|
MYSQL_USER_NAME("mysql-settings.user-name", "", "MySQL Database User Name"),
|
||||||
MYSQL_USER_PASSWORD("mysql-settings.user-password", "", "MySQL Database User Password"),
|
MYSQL_USER_PASSWORD("mysql-settings.user-password", "", "MySQL Database User Password"),
|
||||||
|
MYSQL_TABLE_PREFIX("mysql-settings.table-prefix", PlayerParticles.getInstance().getDescription().getName().toLowerCase() + "_", "The prefix of the tables in the database", "Do not change this after tables have already been created or you will have data loss"),
|
||||||
MYSQL_USE_SSL("mysql-settings.use-ssl", false, "If the database connection should use SSL", "You should enable this if your database supports SSL"),
|
MYSQL_USE_SSL("mysql-settings.use-ssl", false, "If the database connection should use SSL", "You should enable this if your database supports SSL"),
|
||||||
|
MYSQL_CONNECTION_POOL_SIZE("mysql-settings.connection-pool-size", 5, "The size of the connection pool to the database", "Not recommended to go below 2 or above 5"),
|
||||||
|
|
||||||
GUI_ICON("gui-icon", null,
|
GUI_ICON("gui-icon", null,
|
||||||
"This configuration option allows you to change any of the GUI",
|
"This configuration option allows you to change any of the GUI",
|
||||||
|
|
|
@ -547,7 +547,7 @@ public class DataManager extends Manager {
|
||||||
* @return the prefix to be used by all table names
|
* @return the prefix to be used by all table names
|
||||||
*/
|
*/
|
||||||
public String getTablePrefix() {
|
public String getTablePrefix() {
|
||||||
return this.playerParticles.getDescription().getName().toLowerCase() + '_';
|
return Setting.MYSQL_TABLE_PREFIX.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue