mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-30 20:11:45 +01:00
ActionsTable, moved some column declarations
This commit is contained in:
parent
91415d9125
commit
fe9c32c324
60
Plan/src/main/java/com/djrapitops/plan/data/Action.java
Normal file
60
Plan/src/main/java/com/djrapitops/plan/data/Action.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Licence is provided in the jar as license.yml also here:
|
||||||
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||||
|
*/
|
||||||
|
package main.java.com.djrapitops.plan.data;
|
||||||
|
|
||||||
|
import main.java.com.djrapitops.plan.database.tables.Actions;
|
||||||
|
import main.java.com.djrapitops.plan.ui.html.Html;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that represents an action made by a player.
|
||||||
|
*
|
||||||
|
* @author Rsl1122
|
||||||
|
*/
|
||||||
|
public class Action {
|
||||||
|
private final long date;
|
||||||
|
private final Actions doneAction;
|
||||||
|
private final String additionalInfo;
|
||||||
|
private int serverID;
|
||||||
|
|
||||||
|
public Action(long date, Actions doneAction, String additionalInfo) {
|
||||||
|
this.date = date;
|
||||||
|
this.doneAction = doneAction;
|
||||||
|
this.additionalInfo = additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action(long date, Actions doneAction, String additionalInfo, int serverID) {
|
||||||
|
this.date = date;
|
||||||
|
this.doneAction = doneAction;
|
||||||
|
this.additionalInfo = additionalInfo;
|
||||||
|
this.serverID = serverID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Actions getDoneAction() {
|
||||||
|
return doneAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdditionalInfo() {
|
||||||
|
return additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can only be used on Action classes returned by the ActionsTable.
|
||||||
|
*
|
||||||
|
* @return ID of the server the action occurred on.
|
||||||
|
*/
|
||||||
|
public int getServerID() {
|
||||||
|
return serverID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Html.TABLELINE_3.parse(FormatUtils.formatTimeStampYear(date), doneAction.toString(), additionalInfo);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package main.java.com.djrapitops.plan.data;
|
package main.java.com.djrapitops.plan.data;
|
||||||
|
|
||||||
|
import main.java.com.djrapitops.plan.database.tables.Actions;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -12,20 +14,20 @@ import java.util.UUID;
|
|||||||
public class KillData {
|
public class KillData {
|
||||||
|
|
||||||
private final UUID victim;
|
private final UUID victim;
|
||||||
private final long date;
|
private final long time;
|
||||||
private final String weapon;
|
private final String weapon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a KillData object with given parameters.
|
* Creates a KillData object with given parameters.
|
||||||
*
|
*
|
||||||
* @param victim UUID of the victim.
|
* @param victim UUID of the victim.
|
||||||
* @param weapon Weapon used.
|
* @param weapon Weapon used.
|
||||||
* @param date Epoch millisecond at which the kill occurred.
|
* @param time Epoch millisecond at which the kill occurred.
|
||||||
*/
|
*/
|
||||||
public KillData(UUID victim, String weapon, long date) {
|
public KillData(UUID victim, String weapon, long time) {
|
||||||
this.victim = victim;
|
this.victim = victim;
|
||||||
this.weapon = weapon;
|
this.weapon = weapon;
|
||||||
this.date = date;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,8 +44,8 @@ public class KillData {
|
|||||||
*
|
*
|
||||||
* @return long in ms.
|
* @return long in ms.
|
||||||
*/
|
*/
|
||||||
public long getDate() {
|
public long getTime() {
|
||||||
return date;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +60,7 @@ public class KillData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{victim:" + victim + "|date:" + date + "|weapon:" + weapon + '}';
|
return "{victim:" + victim + "|time:" + time + "|weapon:" + weapon + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,7 +75,7 @@ public class KillData {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final KillData other = (KillData) obj;
|
final KillData other = (KillData) obj;
|
||||||
return this.date == other.date
|
return this.time == other.time
|
||||||
&& Objects.equals(this.weapon, other.weapon)
|
&& Objects.equals(this.weapon, other.weapon)
|
||||||
&& Objects.equals(this.victim, other.victim);
|
&& Objects.equals(this.victim, other.victim);
|
||||||
}
|
}
|
||||||
@ -82,8 +84,12 @@ public class KillData {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
int hash = 3;
|
||||||
hash = 89 * hash + Objects.hashCode(this.victim);
|
hash = 89 * hash + Objects.hashCode(this.victim);
|
||||||
hash = 89 * hash + (int) (this.date ^ (this.date >>> 32));
|
hash = 89 * hash + (int) (this.time ^ (this.time >>> 32));
|
||||||
hash = 89 * hash + Objects.hashCode(this.weapon);
|
hash = 89 * hash + Objects.hashCode(this.weapon);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action convertToAction() {
|
||||||
|
return new Action(time, Actions.KILLED, "name with " + weapon); // TODO Name Cache.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Licence is provided in the jar as license.yml also here:
|
||||||
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||||
|
*/
|
||||||
|
package main.java.com.djrapitops.plan.database.tables;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDs of various actions
|
||||||
|
*
|
||||||
|
* @author Rsl1122
|
||||||
|
*/
|
||||||
|
public enum Actions {
|
||||||
|
UNKNOWN(-1),
|
||||||
|
REGISTERED(1),
|
||||||
|
FIRST_LOGOUT(2),
|
||||||
|
CHANGED_NAME(3),
|
||||||
|
KILLED(-2), // Not stored in ActionsTable.
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int id;
|
||||||
|
|
||||||
|
Actions(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Actions getById(int id) {
|
||||||
|
for (Actions a : values()) {
|
||||||
|
if (a.getId() == id) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return WordUtils.capitalizeFully(name(), '_').replace('_', ' ');
|
||||||
|
}
|
||||||
|
}
|
@ -4,12 +4,120 @@
|
|||||||
*/
|
*/
|
||||||
package main.java.com.djrapitops.plan.database.tables;
|
package main.java.com.djrapitops.plan.database.tables;
|
||||||
|
|
||||||
|
import main.java.com.djrapitops.plan.Log;
|
||||||
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
|
import main.java.com.djrapitops.plan.data.Action;
|
||||||
|
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||||
|
import main.java.com.djrapitops.plan.database.sql.Select;
|
||||||
|
import main.java.com.djrapitops.plan.database.sql.Sql;
|
||||||
|
import main.java.com.djrapitops.plan.database.sql.TableSqlParser;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* //TODO Class Javadoc Comment
|
* Table that is in charge of storing actions.
|
||||||
|
* <p>
|
||||||
|
* plan_actions contains columns:
|
||||||
|
* <ul>
|
||||||
|
* <li>user_id (plan_users: id)</li>
|
||||||
|
* <li>server_id (plan_servers: id)</li>
|
||||||
|
* <li>action_id</li>
|
||||||
|
* <li>date</li>
|
||||||
|
* <li>additional_info</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
public class ActionsTable {
|
public class ActionsTable extends UserIDTable {
|
||||||
// TODO Actions table
|
|
||||||
// time, action, additional info
|
private final String columnServerID = "server_id";
|
||||||
|
private final String columnDate = "date";
|
||||||
|
private final String columnActionID = "action_id";
|
||||||
|
private final String columnAdditionalInfo = "additional_info";
|
||||||
|
|
||||||
|
public ActionsTable(String name, SQLDB db, boolean usingMySQL) {
|
||||||
|
super(name, db, usingMySQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createTable() {
|
||||||
|
|
||||||
|
ServerTable serverTable = db.getServerTable();
|
||||||
|
try {
|
||||||
|
execute(TableSqlParser.createTable(tableName)
|
||||||
|
.column(columnUserID, Sql.INT).notNull()
|
||||||
|
.column(columnServerID, Sql.INT).notNull()
|
||||||
|
.column(columnDate, Sql.LONG).notNull()
|
||||||
|
.column(columnActionID, Sql.INT).notNull()
|
||||||
|
.column(columnAdditionalInfo, Sql.varchar(100))
|
||||||
|
.foreignKey(columnUserID, usersTable.toString(), usersTable.getColumnID())
|
||||||
|
.foreignKey(columnServerID, serverTable.toString(), serverTable.getColumnID())
|
||||||
|
.toString());
|
||||||
|
return true;
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
Log.toLog(this.getClass().getName(), ex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertAction(UUID uuid, Action action) throws SQLException {
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
try {
|
||||||
|
ServerTable serverTable = db.getServerTable();
|
||||||
|
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||||
|
+ columnUserID + ", "
|
||||||
|
+ columnServerID + ", "
|
||||||
|
+ columnActionID + ", "
|
||||||
|
+ columnDate + ", "
|
||||||
|
+ columnAdditionalInfo
|
||||||
|
+ ") VALUES ("
|
||||||
|
+ usersTable.statementSelectID + ", "
|
||||||
|
+ serverTable.statementSelectServerID + ", "
|
||||||
|
+ "?, ?, ?)"
|
||||||
|
);
|
||||||
|
statement.setString(1, uuid.toString());
|
||||||
|
statement.setString(2, Plan.getInstance().getServerInfoManager().getServerUUID().toString());
|
||||||
|
statement.setInt(3, action.getDoneAction().getId());
|
||||||
|
statement.setLong(4, action.getDate());
|
||||||
|
statement.setString(5, action.getAdditionalInfo());
|
||||||
|
statement.execute();
|
||||||
|
} finally {
|
||||||
|
close(statement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to get all Actions done by a user on this server.
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
public List<Action> getActions(UUID uuid) throws SQLException {
|
||||||
|
List<Action> actions = new ArrayList<>();
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
ResultSet set = null;
|
||||||
|
try {
|
||||||
|
ServerTable serverTable = db.getServerTable();
|
||||||
|
statement = prepareStatement(Select.from(tableName, "*")
|
||||||
|
.where(columnUserID + "=" + usersTable.statementSelectID)
|
||||||
|
.toString());
|
||||||
|
set = statement.executeQuery();
|
||||||
|
while (set.next()) {
|
||||||
|
int serverID = set.getInt(columnServerID);
|
||||||
|
long date = set.getLong(columnDate);
|
||||||
|
Actions doneAction = Actions.getById(set.getInt(columnActionID));
|
||||||
|
String additionalInfo = set.getString(columnAdditionalInfo);
|
||||||
|
actions.add(new Action(date, doneAction, additionalInfo, serverID));
|
||||||
|
}
|
||||||
|
return actions;
|
||||||
|
} finally {
|
||||||
|
close(set, statement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -19,8 +19,8 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class IPsTable extends UserIDTable {
|
public class IPsTable extends UserIDTable {
|
||||||
|
|
||||||
private final String columnIP;
|
private final String columnIP = "ip";
|
||||||
private final String columnGeolocation; // TODO
|
private final String columnGeolocation = "geolocation"; // TODO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param db The database
|
* @param db The database
|
||||||
@ -28,9 +28,6 @@ public class IPsTable extends UserIDTable {
|
|||||||
*/
|
*/
|
||||||
public IPsTable(SQLDB db, boolean usingMySQL) {
|
public IPsTable(SQLDB db, boolean usingMySQL) {
|
||||||
super("plan_ips", db, usingMySQL);
|
super("plan_ips", db, usingMySQL);
|
||||||
columnUserID = "user_id";
|
|
||||||
columnIP = "ip";
|
|
||||||
columnGeolocation = "geolocation";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +136,7 @@ public class KillsTable extends Table {
|
|||||||
statement.setInt(1, userId);
|
statement.setInt(1, userId);
|
||||||
statement.setInt(2, -1); // TODO Victim ID Retrieval
|
statement.setInt(2, -1); // TODO Victim ID Retrieval
|
||||||
statement.setString(3, kill.getWeapon());
|
statement.setString(3, kill.getWeapon());
|
||||||
statement.setLong(4, kill.getDate());
|
statement.setLong(4, kill.getTime());
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
commitRequired = true;
|
commitRequired = true;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ public class KillsTable extends Table {
|
|||||||
statement.setInt(1, id);
|
statement.setInt(1, id);
|
||||||
statement.setInt(2, -1); // TODO Victim ID Retrieval
|
statement.setInt(2, -1); // TODO Victim ID Retrieval
|
||||||
statement.setString(3, kill.getWeapon());
|
statement.setString(3, kill.getWeapon());
|
||||||
statement.setLong(4, kill.getDate());
|
statement.setLong(4, kill.getTime());
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
commitRequired = true;
|
commitRequired = true;
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,9 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class NicknamesTable extends UserIDTable {
|
public class NicknamesTable extends UserIDTable {
|
||||||
|
|
||||||
private final String columnNick;
|
private final String columnNick = "nickname";
|
||||||
private final String columnCurrent;
|
private final String columnCurrent = "current_nick";
|
||||||
private final String columnServerID; //TODO
|
private final String columnServerID = "server_id"; //TODO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param db The database
|
* @param db The database
|
||||||
@ -27,10 +27,6 @@ public class NicknamesTable extends UserIDTable {
|
|||||||
*/
|
*/
|
||||||
public NicknamesTable(SQLDB db, boolean usingMySQL) {
|
public NicknamesTable(SQLDB db, boolean usingMySQL) {
|
||||||
super("plan_nicknames", db, usingMySQL);
|
super("plan_nicknames", db, usingMySQL);
|
||||||
columnUserID = "user_id";
|
|
||||||
columnNick = "nickname";
|
|
||||||
columnCurrent = "current_nick";
|
|
||||||
columnServerID = "server_id";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,19 +27,17 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class ServerTable extends Table {
|
public class ServerTable extends Table {
|
||||||
|
|
||||||
private final String columnServerID;
|
private final String columnServerID = "id";
|
||||||
private final String columnServerUUID;
|
private final String columnServerUUID = "uuid";
|
||||||
private final String columnServerName;
|
private final String columnServerName = "name";
|
||||||
private final String columnWebserverAddress;
|
private final String columnWebserverAddress = "web_address";
|
||||||
private final String columnInstalled;
|
private final String columnInstalled = "is_installed";
|
||||||
|
|
||||||
|
public final String statementSelectServerID;
|
||||||
|
|
||||||
public ServerTable(SQLDB db, boolean usingMySQL) {
|
public ServerTable(SQLDB db, boolean usingMySQL) {
|
||||||
super("plan_servers", db, usingMySQL);
|
super("plan_servers", db, usingMySQL);
|
||||||
columnServerID = "id";
|
statementSelectServerID = "(" + Select.from(tableName, tableName + "." + columnServerID).where(columnServerUUID + "=?").toString() + ")";
|
||||||
columnServerUUID = "uuid";
|
|
||||||
columnServerName = "name";
|
|
||||||
columnWebserverAddress = "web_address";
|
|
||||||
columnInstalled = "is_installed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -226,4 +224,8 @@ public class ServerTable extends Table {
|
|||||||
close(set, statement);
|
close(set, statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getColumnID() {
|
||||||
|
return columnServerID;
|
||||||
|
}
|
||||||
}
|
}
|
@ -18,12 +18,12 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class SessionsTable extends UserIDTable {
|
public class SessionsTable extends UserIDTable {
|
||||||
|
|
||||||
private final String columnSessionID; //TODO
|
private final String columnSessionID = "id"; //TODO
|
||||||
private final String columnSessionStart;
|
private final String columnSessionStart = "session_start";
|
||||||
private final String columnSessionEnd;
|
private final String columnSessionEnd = "session_end";
|
||||||
private final String columnServerID; //TODO
|
private final String columnServerID = "server_id"; //TODO
|
||||||
private final String columnMobKills; //TODO
|
private final String columnMobKills = "mob_kills"; //TODO
|
||||||
private final String columnDeaths; //TODO
|
private final String columnDeaths = "deaths"; //TODO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param db
|
* @param db
|
||||||
@ -31,13 +31,6 @@ public class SessionsTable extends UserIDTable {
|
|||||||
*/
|
*/
|
||||||
public SessionsTable(SQLDB db, boolean usingMySQL) {
|
public SessionsTable(SQLDB db, boolean usingMySQL) {
|
||||||
super("plan_sessions", db, usingMySQL);
|
super("plan_sessions", db, usingMySQL);
|
||||||
columnUserID = "user_id";
|
|
||||||
columnSessionStart = "session_start";
|
|
||||||
columnSessionEnd = "session_end";
|
|
||||||
columnServerID = "server_id";
|
|
||||||
columnSessionID = "id";
|
|
||||||
columnMobKills = "mob_kills";
|
|
||||||
columnDeaths = "deaths";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,10 +14,12 @@ import java.sql.SQLException;
|
|||||||
*/
|
*/
|
||||||
public abstract class UserIDTable extends Table {
|
public abstract class UserIDTable extends Table {
|
||||||
|
|
||||||
protected String columnUserID;
|
protected final String columnUserID = "user_id";
|
||||||
|
protected final UsersTable usersTable;
|
||||||
|
|
||||||
public UserIDTable(String name, SQLDB db, boolean usingMySQL) {
|
public UserIDTable(String name, SQLDB db, boolean usingMySQL) {
|
||||||
super(name, db, usingMySQL);
|
super(name, db, usingMySQL);
|
||||||
|
usersTable = db.getUsersTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean removeDataOf(int userID) {
|
protected boolean removeDataOf(int userID) {
|
||||||
|
@ -3,6 +3,7 @@ package main.java.com.djrapitops.plan.database.tables;
|
|||||||
import main.java.com.djrapitops.plan.Log;
|
import main.java.com.djrapitops.plan.Log;
|
||||||
import main.java.com.djrapitops.plan.data.UserData;
|
import main.java.com.djrapitops.plan.data.UserData;
|
||||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||||
|
import main.java.com.djrapitops.plan.database.sql.Select;
|
||||||
import main.java.com.djrapitops.plan.database.sql.Sql;
|
import main.java.com.djrapitops.plan.database.sql.Sql;
|
||||||
import main.java.com.djrapitops.plan.database.sql.TableSqlParser;
|
import main.java.com.djrapitops.plan.database.sql.TableSqlParser;
|
||||||
import main.java.com.djrapitops.plan.utilities.Benchmark;
|
import main.java.com.djrapitops.plan.utilities.Benchmark;
|
||||||
@ -17,8 +18,8 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class UsersTable extends Table {
|
public class UsersTable extends Table {
|
||||||
|
|
||||||
private final String columnID;
|
private final String columnID = "id";
|
||||||
private final String columnUUID;
|
private final String columnUUID = "uuid";
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private final String columnGeolocation;
|
private final String columnGeolocation;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -50,14 +51,16 @@ public class UsersTable extends Table {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
private final String columnLastWorld;
|
private final String columnLastWorld;
|
||||||
|
|
||||||
|
public final String statementSelectID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param db
|
* @param db
|
||||||
* @param usingMySQL
|
* @param usingMySQL
|
||||||
*/
|
*/
|
||||||
public UsersTable(SQLDB db, boolean usingMySQL) {
|
public UsersTable(SQLDB db, boolean usingMySQL) {
|
||||||
super("plan_users", db, usingMySQL);
|
super("plan_users", db, usingMySQL);
|
||||||
columnID = "id";
|
statementSelectID = "(" + Select.from(tableName, tableName + "." + columnID).where(columnUUID + "=?").toString() + ")";
|
||||||
columnUUID = "uuid";
|
|
||||||
columnGeolocation = "geolocation";
|
columnGeolocation = "geolocation";
|
||||||
columnLastGM = "last_gamemode";
|
columnLastGM = "last_gamemode";
|
||||||
columnLastGMSwapTime = "last_gamemode_swap";
|
columnLastGMSwapTime = "last_gamemode_swap";
|
||||||
|
@ -21,13 +21,14 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class WorldTimesTable extends UserIDTable {
|
public class WorldTimesTable extends UserIDTable {
|
||||||
|
|
||||||
private final String columnServerID; //TODO
|
private final String columnServerID = "server_id"; //TODO
|
||||||
private final WorldTable worldTable;
|
private final WorldTable worldTable;
|
||||||
private final String worldIDColumn;
|
private final String worldIDColumn;
|
||||||
private final String worldNameColumn;
|
private final String worldNameColumn;
|
||||||
|
|
||||||
private final String columnWorldId;
|
private final String columnWorldId = "world_id";
|
||||||
@Deprecated private final String columnPlaytime;
|
@Deprecated
|
||||||
|
private final String columnPlaytime = "playtime";
|
||||||
//TODO GM Times to World table
|
//TODO GM Times to World table
|
||||||
|
|
||||||
private final String selectWorldIDsql;
|
private final String selectWorldIDsql;
|
||||||
@ -43,10 +44,6 @@ public class WorldTimesTable extends UserIDTable {
|
|||||||
worldTable = db.getWorldTable();
|
worldTable = db.getWorldTable();
|
||||||
worldIDColumn = worldTable + "." + worldTable.getColumnID();
|
worldIDColumn = worldTable + "." + worldTable.getColumnID();
|
||||||
worldNameColumn = worldTable.getColumnWorldName();
|
worldNameColumn = worldTable.getColumnWorldName();
|
||||||
columnWorldId = "world_id";
|
|
||||||
columnUserID = "user_id";
|
|
||||||
columnPlaytime = "playtime";
|
|
||||||
columnServerID = "server_id";
|
|
||||||
|
|
||||||
selectWorldIDsql = "(SELECT " + worldIDColumn + " FROM " + worldTable + " WHERE (" + worldNameColumn + "=?))";
|
selectWorldIDsql = "(SELECT " + worldIDColumn + " FROM " + worldTable + " WHERE (" + worldNameColumn + "=?))";
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,8 @@ public enum Msg {
|
|||||||
HTML_OFFLINE("Html - Offline"),
|
HTML_OFFLINE("Html - Offline"),
|
||||||
HTML_ACTIVE("Html - Active"),
|
HTML_ACTIVE("Html - Active"),
|
||||||
HTML_INACTIVE("Html - Inactive"),
|
HTML_INACTIVE("Html - Inactive"),
|
||||||
HTML_TABLE_NO_KILLS("Html - Table No Kills"),;
|
HTML_TABLE_NO_KILLS("Html - Table No Kills"),
|
||||||
|
;
|
||||||
|
|
||||||
private final String identifier;
|
private final String identifier;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class KillsTableCreator {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
long date = kill.getDate();
|
long date = kill.getTime();
|
||||||
|
|
||||||
IOfflinePlayer victim = Fetch.getIOfflinePlayer(kill.getVictim());
|
IOfflinePlayer victim = Fetch.getIOfflinePlayer(kill.getVictim());
|
||||||
String name = victim.getName();
|
String name = victim.getName();
|
||||||
|
@ -34,7 +34,7 @@ public class PlaceholderUtils {
|
|||||||
replaceMap.put("tabContentPlugins", data.replacePluginsTabLayout());
|
replaceMap.put("tabContentPlugins", data.replacePluginsTabLayout());
|
||||||
|
|
||||||
// TODO Refresh time for Network pages
|
// TODO Refresh time for Network pages
|
||||||
// replaceMap.put("refresh", FormatUtils.formatTimeAmountDifference(data.getRefreshDate(), MiscUtils.getTime()));
|
// replaceMap.put("refresh", FormatUtils.formatTimeAmountDifference(data.getRefreshDate(), MiscUtils.getDate()));
|
||||||
// replaceMap.put("refreshlong", String.valueOf(data.getRefreshDate()));
|
// replaceMap.put("refreshlong", String.valueOf(data.getRefreshDate()));
|
||||||
|
|
||||||
replaceMap.put("serverName", Settings.SERVER_NAME.toString());
|
replaceMap.put("serverName", Settings.SERVER_NAME.toString());
|
||||||
|
@ -11,7 +11,7 @@ public class KillDataComparator implements Comparator<KillData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(KillData o1, KillData o2) {
|
public int compare(KillData o1, KillData o2) {
|
||||||
return Long.compare(o1.getDate(), o2.getDate());
|
return Long.compare(o1.getTime(), o2.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class KillDataTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetDate() {
|
public void testGetDate() {
|
||||||
assertEquals(test.getDate(), 100L);
|
assertEquals(test.getTime(), 100L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user