mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-10 18:37:57 +01:00
3.5.4
This commit is contained in:
parent
407cdf987e
commit
16aabd16ee
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>Plan</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<version>3.5.4</version>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>Plan</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<version>3.5.4</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -28,10 +28,10 @@ public class ManageCommand extends TreeCommand<Plan> {
|
||||
|
||||
@Override
|
||||
public void addCommands() {
|
||||
commands.add(new ManageMoveCommand(plugin));
|
||||
// commands.add(new ManageMoveCommand(plugin));
|
||||
commands.add(new ManageHotswapCommand(plugin));
|
||||
commands.add(new ManageBackupCommand(plugin));
|
||||
commands.add(new ManageRestoreCommand(plugin));
|
||||
// commands.add(new ManageBackupCommand(plugin));
|
||||
// commands.add(new ManageRestoreCommand(plugin));
|
||||
commands.add(new ManageStatusCommand(plugin));
|
||||
commands.add(new ManageImportCommand(plugin));
|
||||
commands.add(new ManageRemoveCommand(plugin));
|
||||
|
@ -128,7 +128,7 @@ public abstract class SQLDB extends Database {
|
||||
}
|
||||
if (newDatabase) {
|
||||
Log.info("New Database created.");
|
||||
setVersion(4);
|
||||
setVersion(5);
|
||||
}
|
||||
Benchmark.start("Database: Create tables");
|
||||
for (Table table : getAllTables()) {
|
||||
@ -142,8 +142,8 @@ public abstract class SQLDB extends Database {
|
||||
return false;
|
||||
}
|
||||
Benchmark.stop("Database: Create tables");
|
||||
if (!newDatabase && getVersion() < 4) {
|
||||
setVersion(4);
|
||||
if (!newDatabase && getVersion() < 5) {
|
||||
setVersion(5);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -110,6 +110,9 @@ public class UsersTable extends Table {
|
||||
if (version < 4) {
|
||||
alterTablesV4();
|
||||
}
|
||||
if (version < 5) {
|
||||
alterTablesV5();
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
Log.toLog(this.getClass().getName(), ex);
|
||||
@ -117,6 +120,17 @@ public class UsersTable extends Table {
|
||||
}
|
||||
}
|
||||
|
||||
private void alterTablesV5() {
|
||||
if (usingMySQL) {
|
||||
try {
|
||||
execute("ALTER TABLE " + tableName
|
||||
+ " DROP COLUMN " + columnDemAge + ","
|
||||
+ " DROP COLUMN " + columnDemGender);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void alterTablesV4() {
|
||||
String[] queries;
|
||||
if (usingMySQL) {
|
||||
@ -531,21 +545,7 @@ public class UsersTable extends Table {
|
||||
int userId = getUserId(uuid);
|
||||
int update = 0;
|
||||
if (userId != -1) {
|
||||
String sql = "UPDATE " + tableName + " SET "
|
||||
+ columnGeolocation + "=?, "
|
||||
+ columnLastGM + "=?, "
|
||||
+ columnLastGMSwapTime + "=?, "
|
||||
+ columnPlayTime + "=?, "
|
||||
+ columnLoginTimes + "=?, "
|
||||
+ columnLastPlayed + "=?, "
|
||||
+ columnDeaths + "=?, "
|
||||
+ columnMobKills + "=?, "
|
||||
+ columnContainsBukkitData + "=?, "
|
||||
+ columnOP + "=?, "
|
||||
+ columnBanned + "=?, "
|
||||
+ columnName + "=?, "
|
||||
+ columnRegistered + "=? "
|
||||
+ "WHERE UPPER(" + columnUUID + ") LIKE UPPER(?)";
|
||||
String sql = getUpdateStatement();
|
||||
|
||||
statement = prepareStatement(sql);
|
||||
statement.setString(1, data.getGeolocation());
|
||||
@ -571,22 +571,7 @@ public class UsersTable extends Table {
|
||||
}
|
||||
if (update == 0) {
|
||||
close(statement);
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||
+ columnUUID + ", "
|
||||
+ columnGeolocation + ", "
|
||||
+ columnLastGM + ", "
|
||||
+ columnLastGMSwapTime + ", "
|
||||
+ columnPlayTime + ", "
|
||||
+ columnLoginTimes + ", "
|
||||
+ columnLastPlayed + ", "
|
||||
+ columnDeaths + ", "
|
||||
+ columnMobKills + ", "
|
||||
+ columnContainsBukkitData + ", "
|
||||
+ columnOP + ", "
|
||||
+ columnBanned + ", "
|
||||
+ columnName + ", "
|
||||
+ columnRegistered
|
||||
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
statement = prepareStatement(getInsertStatement());
|
||||
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, data.getGeolocation());
|
||||
@ -615,6 +600,72 @@ public class UsersTable extends Table {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tableHasV4Columns() {
|
||||
if (usingMySQL) {
|
||||
return false;
|
||||
} else {
|
||||
PreparedStatement statement = null;
|
||||
ResultSet set = null;
|
||||
try {
|
||||
try {
|
||||
statement = prepareStatement("SELECT " + columnDemAge + " FROM " + tableName + " LIMIT 1");
|
||||
set = statement.executeQuery();
|
||||
Log.debug("UsersTable has V4 columns.");
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
close(set, statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getInsertStatement() {
|
||||
final boolean hasV4Columns = tableHasV4Columns();
|
||||
String v4rows = hasV4Columns ? columnDemAge + ", " + columnDemGender + ", " : "";
|
||||
String v4values = hasV4Columns ? "-1, Deprecated, " : "";
|
||||
return "INSERT INTO " + tableName + " ("
|
||||
+ v4rows
|
||||
+ columnUUID + ", "
|
||||
+ columnGeolocation + ", "
|
||||
+ columnLastGM + ", "
|
||||
+ columnLastGMSwapTime + ", "
|
||||
+ columnPlayTime + ", "
|
||||
+ columnLoginTimes + ", "
|
||||
+ columnLastPlayed + ", "
|
||||
+ columnDeaths + ", "
|
||||
+ columnMobKills + ", "
|
||||
+ columnContainsBukkitData + ", "
|
||||
+ columnOP + ", "
|
||||
+ columnBanned + ", "
|
||||
+ columnName + ", "
|
||||
+ columnRegistered
|
||||
+ ") VALUES (" + v4values + "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
}
|
||||
|
||||
private String getUpdateStatement() {
|
||||
final boolean hasV4Columns = tableHasV4Columns();
|
||||
String v4rows = hasV4Columns ? columnDemAge + "=-1, " + columnDemGender + "='Deprecated', " : "";
|
||||
String sql = "UPDATE " + tableName + " SET "
|
||||
+ v4rows
|
||||
+ columnGeolocation + "=?, "
|
||||
+ columnLastGM + "=?, "
|
||||
+ columnLastGMSwapTime + "=?, "
|
||||
+ columnPlayTime + "=?, "
|
||||
+ columnLoginTimes + "=?, "
|
||||
+ columnLastPlayed + "=?, "
|
||||
+ columnDeaths + "=?, "
|
||||
+ columnMobKills + "=?, "
|
||||
+ columnContainsBukkitData + "=?, "
|
||||
+ columnOP + "=?, "
|
||||
+ columnBanned + "=?, "
|
||||
+ columnName + "=?, "
|
||||
+ columnRegistered + "=? "
|
||||
+ "WHERE " + columnUUID + "=?";
|
||||
return sql;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
@ -638,22 +689,7 @@ public class UsersTable extends Table {
|
||||
private void insertNewUserData(Collection<UserData> data) throws SQLException {
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||
+ columnUUID + ", "
|
||||
+ columnGeolocation + ", "
|
||||
+ columnLastGM + ", "
|
||||
+ columnLastGMSwapTime + ", "
|
||||
+ columnPlayTime + ", "
|
||||
+ columnLoginTimes + ", "
|
||||
+ columnLastPlayed + ", "
|
||||
+ columnDeaths + ", "
|
||||
+ columnMobKills + ", "
|
||||
+ columnContainsBukkitData + ", "
|
||||
+ columnOP + ", "
|
||||
+ columnBanned + ", "
|
||||
+ columnName + ", "
|
||||
+ columnRegistered
|
||||
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
statement = prepareStatement(getInsertStatement());
|
||||
boolean commitRequired = false;
|
||||
int i = 0;
|
||||
for (UserData uData : data) {
|
||||
@ -694,22 +730,8 @@ public class UsersTable extends Table {
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
List<UserData> saveLast = new ArrayList<>();
|
||||
String uSQL = "UPDATE " + tableName + " SET "
|
||||
+ columnGeolocation + "=?, "
|
||||
+ columnLastGM + "=?, "
|
||||
+ columnLastGMSwapTime + "=?, "
|
||||
+ columnPlayTime + "=?, "
|
||||
+ columnLoginTimes + "=?, "
|
||||
+ columnLastPlayed + "=?, "
|
||||
+ columnDeaths + "=?, "
|
||||
+ columnMobKills + "=?, "
|
||||
+ columnContainsBukkitData + "=?, "
|
||||
+ columnOP + "=?, "
|
||||
+ columnBanned + "=?, "
|
||||
+ columnName + "=?, "
|
||||
+ columnRegistered + "=? "
|
||||
+ "WHERE " + columnUUID + "=?";
|
||||
statement = prepareStatement(uSQL);
|
||||
String sql = getUpdateStatement();
|
||||
statement = prepareStatement(sql);
|
||||
boolean commitRequired = false;
|
||||
Set<UUID> savedUUIDs = getSavedUUIDs();
|
||||
int i = 0;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package main.java.com.djrapitops.plan.ui.html;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -124,8 +125,9 @@ public enum Html {
|
||||
* @return
|
||||
*/
|
||||
public String parse(String... p) {
|
||||
Verify.nullCheck(p);
|
||||
String returnValue = this.html;
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
returnValue = returnValue.replace("REPLACE" + i, p[i]);
|
||||
}
|
||||
return returnValue;
|
||||
|
@ -14,6 +14,9 @@ import java.util.List;
|
||||
public class DouglasPeckerAlgorithm {
|
||||
|
||||
public static List<Point> reducePoints(List<Point> points, double epsilon) {
|
||||
if (points.isEmpty()) {
|
||||
return points;
|
||||
}
|
||||
if (epsilon == -1) {
|
||||
epsilon = 0.002;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: main.java.com.djrapitops.plan.Plan
|
||||
version: 3.5.3
|
||||
version: 3.5.4
|
||||
|
||||
softdepend:
|
||||
- OnTime
|
||||
|
Loading…
Reference in New Issue
Block a user