mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-28 03:17:47 +01:00
Merge branch 'development'
This commit is contained in:
commit
442a1294c6
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateStacker</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>2.0.9</version>
|
||||
<version>2.0.10</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateStacker-${project.version}</finalName>
|
||||
|
@ -32,7 +32,7 @@ public class _2_EntityStacks extends DataMigration {
|
||||
statement.execute("CREATE TABLE " + tablePrefix + "stacked_entities (" +
|
||||
"uuid VARCHAR(36) PRIMARY KEY NOT NULL," +
|
||||
"host INTEGER NOT NULL," +
|
||||
"serialized_entity VARBINARY NOT NULL" +
|
||||
"serialized_entity VARBINARY(255) NOT NULL" +
|
||||
")");
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class _3_BlockStacks extends DataMigration {
|
||||
statement.execute("CREATE TABLE " + tablePrefix + "blocks (" +
|
||||
"id INTEGER PRIMARY KEY" + autoIncrement + ", " +
|
||||
"amount INTEGER NOT NULL," +
|
||||
"material STRING NOT NULL," +
|
||||
"material TEXT NOT NULL," +
|
||||
"world TEXT NOT NULL, " +
|
||||
"x DOUBLE NOT NULL, " +
|
||||
"y DOUBLE NOT NULL, " +
|
||||
|
@ -1,46 +0,0 @@
|
||||
package com.songoda.ultimatestacker.utils;
|
||||
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MySQLDatabase {
|
||||
|
||||
private final UltimateStacker instance;
|
||||
|
||||
private Connection connection;
|
||||
|
||||
public MySQLDatabase(UltimateStacker instance) {
|
||||
this.instance = instance;
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
|
||||
String url = "jdbc:mysql://" + instance.getConfig().getString("Database.IP") + ":" + instance.getConfig().getString("Database.Port") + "/" + instance.getConfig().getString("Database.Database Name") + "?autoReconnect=true&useSSL=false";
|
||||
this.connection = DriverManager.getConnection(url, instance.getConfig().getString("Database.Username"), instance.getConfig().getString("Database.Password"));
|
||||
|
||||
createTables();
|
||||
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
System.out.println("Database connection failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private void createTables() {
|
||||
try {
|
||||
|
||||
connection.createStatement().execute("CREATE TABLE IF NOT EXISTS `" + instance.getConfig().getString("Database.Prefix") + "spawners` (\n" +
|
||||
"\t`location` TEXT NULL,\n" +
|
||||
"\t`amount` INT NULL\n" +
|
||||
")");
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user