mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 09:37:54 +01:00
Fix TPS table cpu addition for older db schemas
Changed Spigot dependency to PaperSpigot jar.
This commit is contained in:
parent
fab93565b7
commit
31987a4fa5
@ -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.-->
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
} else {
|
||||
execute("ALTER TABLE " + tableName + " ADD COLUMN " + columnCPUUsage + " double NOT NULL");
|
||||
}
|
||||
} 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 {
|
||||
|
@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
.sidenav a.active {
|
||||
background-color: #5da341
|
||||
background-color: #5da341;
|
||||
}
|
||||
|
||||
.sidenav a:hover, .offcanvas a:focus{
|
||||
|
@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
.sidenav a.active {
|
||||
background-color: #5da341
|
||||
background-color: #5da341;
|
||||
}
|
||||
|
||||
.sidenav a:hover, .offcanvas a:focus{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user