This commit is contained in:
Fuzzlemann 2017-07-25 19:49:04 +02:00
commit 3b5a079c4a
6 changed files with 26 additions and 13 deletions

View File

@ -17,11 +17,11 @@
</repository>
</repositories>
<dependencies>
<!-- Spigot 1.12 built with Buildtools for Database classes.-->
<!-- PaperSpigot 1.12 built with Buildtools for Database classes.-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-spigot</artifactId>
<version>1.12</version>
<scope>provided</scope>
</dependency>
<!-- PaperSpigot 1.12 built for TPS Getter Support.-->

View File

@ -122,7 +122,7 @@ public abstract class SQLDB extends Database {
}
if (newDatabase) {
Log.info("New Database created.");
setVersion(5);
setVersion(6);
}
Benchmark.start("Database: Create tables");
for (Table table : getAllTables()) {
@ -136,8 +136,8 @@ public abstract class SQLDB extends Database {
return false;
}
Benchmark.stop("Database: Create tables");
if (!newDatabase && getVersion() < 5) {
setVersion(5);
if (!newDatabase && getVersion() < 6) {
setVersion(6);
}
}
return true;

View File

@ -28,7 +28,6 @@ public class TPSTable extends Table {
private final String columnCPUUsage;
/**
*
* @param db
* @param usingMySQL
*/
@ -50,6 +49,10 @@ public class TPSTable extends Table {
+ columnCPUUsage + " double NOT NULL"
+ ")"
);
int version = getVersion();
if (version < 6) {
alterTablesV6();
}
return true;
} catch (SQLException ex) {
Log.toLog(this.getClass().getName(), ex);
@ -57,8 +60,19 @@ public class TPSTable extends Table {
}
}
private void alterTablesV6() {
try {
if (usingMySQL) {
execute("ALTER TABLE " + tableName + " ADD " + columnCPUUsage + " double NOT NULL DEFAULT 0");
} else {
execute("ALTER TABLE " + tableName + " ADD COLUMN " + columnCPUUsage + " double NOT NULL DEFAULT 0");
}
} catch (SQLException e) {
}
}
/**
*
* @return @throws SQLException
*/
public List<TPS> getTPSData() throws SQLException {
@ -85,7 +99,6 @@ public class TPSTable extends Table {
}
/**
*
* @param data
* @throws SQLException
*/
@ -127,7 +140,6 @@ public class TPSTable extends Table {
}
/**
*
* @throws SQLException
*/
public void clean() throws SQLException {

View File

@ -62,7 +62,7 @@
}
.sidenav a.active {
background-color: #5da341
background-color: #5da341;
}
.sidenav a:hover, .offcanvas a:focus{

View File

@ -60,7 +60,7 @@
}
.sidenav a.active {
background-color: #5da341
background-color: #5da341;
}
.sidenav a:hover, .offcanvas a:focus{

View File

@ -86,6 +86,7 @@ public class TestInit {
Server mockServer = PowerMockito.mock(Server.class);
when(mockServer.getIp()).thenReturn("0.0.0.0");
when(mockServer.getMaxPlayers()).thenReturn(20);
when(mockServer.getName()).thenReturn("Bukkit");
OfflinePlayer[] ops = new OfflinePlayer[]{MockUtils.mockPlayer(), MockUtils.mockPlayer2()};
when(mockServer.getOfflinePlayers()).thenReturn(ops);
return mockServer;