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