перенос настроек базы даный в конфиг
This commit is contained in:
@@ -37,10 +37,14 @@ public class PrisonAPI extends JavaPlugin {
|
|||||||
public static Connection CONN;
|
public static Connection CONN;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
saveDefaultConfig();
|
||||||
|
|
||||||
|
final String dbUrl = getConfig().getString("database.url");
|
||||||
|
final String dbUser = getConfig().getString("database.user");
|
||||||
|
final String dbPasswd = getConfig().getString("database.password");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CONN = DriverManager.getConnection(
|
CONN = DriverManager.getConnection(dbUrl, dbUser, dbPasswd);
|
||||||
"jdbc:mysql://localhost:3306/prison4life",
|
|
||||||
"root", "root");
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/main/resources/config.yml
Normal file
4
src/main/resources/config.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
database:
|
||||||
|
url: jdbc:mysql://localhost:3306/prison4life
|
||||||
|
user: root
|
||||||
|
password: root
|
||||||
Reference in New Issue
Block a user