mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-19 02:01:04 +02:00
Move ops to database
This commit is contained in:
parent
902c7c2470
commit
9bbe4b27b2
@ -37,8 +37,6 @@ import com.djrapitops.plan.system.tasks.TaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plan.system.webserver.WebServer;
|
||||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plan.system.webserver.pagecache.ResponseCache;
|
||||
import com.djrapitops.plan.systems.Systems;
|
||||
import com.djrapitops.plan.systems.cache.DataCache;
|
||||
import com.djrapitops.plan.systems.cache.GeolocationCache;
|
||||
import com.djrapitops.plan.systems.info.BukkitInformationManager;
|
||||
@ -74,8 +72,6 @@ import java.util.UUID;
|
||||
public class Plan extends BukkitPlugin implements PlanPlugin {
|
||||
|
||||
private BukkitSystem system;
|
||||
|
||||
private Systems systems;
|
||||
|
||||
private HookHandler hookHandler; // Manages 3rd party data sources
|
||||
|
||||
@ -110,7 +106,6 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
try {
|
||||
systems = new Systems(this);
|
||||
FileSystem.getInstance().enable();
|
||||
ConfigSystem.getInstance().enable();
|
||||
|
||||
@ -205,10 +200,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void onDisable() {
|
||||
//Clears the page cache
|
||||
ResponseCache.clearCache();
|
||||
|
||||
systems.close();
|
||||
system.disable();
|
||||
|
||||
Log.info(Locale.get(Msg.DISABLED).toString());
|
||||
Benchmark.pluginDisabled(Plan.class);
|
||||
@ -334,10 +326,6 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
||||
throw new IllegalStateException("This method should be used on this plugin.");
|
||||
}
|
||||
|
||||
public Systems getSystems() {
|
||||
return systems;
|
||||
}
|
||||
|
||||
public BukkitSystem getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import com.djrapitops.plan.system.tasks.TaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plan.system.webserver.WebServer;
|
||||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plan.systems.Systems;
|
||||
import com.djrapitops.plan.systems.info.BungeeInformationManager;
|
||||
import com.djrapitops.plan.systems.info.InformationManager;
|
||||
import com.djrapitops.plan.systems.info.server.BungeeServerInfoManager;
|
||||
@ -44,7 +43,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class PlanBungee extends BungeePlugin implements PlanPlugin {
|
||||
|
||||
private Systems systems;
|
||||
private BungeeSystem system;
|
||||
|
||||
private BungeeServerInfoManager serverInfoManager;
|
||||
private BungeeInformationManager infoManager;
|
||||
@ -52,13 +51,11 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin {
|
||||
|
||||
@Deprecated
|
||||
private boolean setupAllowed = false;
|
||||
private BungeeSystem system;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
try {
|
||||
systems = new Systems(this);
|
||||
FileSystem.getInstance().enable();
|
||||
ConfigSystem.getInstance().enable();
|
||||
|
||||
@ -108,7 +105,8 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
systems.close();
|
||||
system.disable();
|
||||
|
||||
Log.info(Locale.get(Msg.DISABLED).toString());
|
||||
Benchmark.pluginDisabled(PlanBungee.class);
|
||||
DebugLog.pluginDisabled(PlanBungee.class);
|
||||
@ -173,11 +171,6 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin {
|
||||
return serverInfoManager.getServerUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Systems getSystems() {
|
||||
return systems;
|
||||
}
|
||||
|
||||
public boolean isSetupAllowed() {
|
||||
return setupAllowed;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.processing.ProcessingQueue;
|
||||
import com.djrapitops.plan.system.processing.processors.Processor;
|
||||
import com.djrapitops.plan.system.webserver.WebServer;
|
||||
import com.djrapitops.plan.systems.Systems;
|
||||
import com.djrapitops.plan.systems.info.InformationManager;
|
||||
import com.djrapitops.plugin.IPlugin;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
@ -55,9 +54,6 @@ public interface PlanPlugin extends IPlugin {
|
||||
|
||||
ColorScheme getColorScheme();
|
||||
|
||||
@Deprecated
|
||||
Systems getSystems();
|
||||
|
||||
boolean isReloading();
|
||||
|
||||
static PlanPlugin getInstance() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
package com.djrapitops.plan.api.exceptions;
|
||||
|
||||
/**
|
||||
* Exception thrown when PageParser encounters an Exception.
|
||||
* Exception thrown when Page encounters an Exception.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.djrapitops.plan.command.commands;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.Msg;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
@ -48,12 +49,12 @@ public class AnalyzeCommand extends SubCommand {
|
||||
infoManager = plugin.getInfoManager();
|
||||
}
|
||||
|
||||
public static void sendAnalysisMessage(Collection<ISender> senders, UUID serverUUID) throws SQLException {
|
||||
public static void sendAnalysisMessage(Collection<ISender> senders, UUID serverUUID) throws DBException {
|
||||
if (Verify.isEmpty(senders)) {
|
||||
return;
|
||||
}
|
||||
Plan plugin = Plan.getInstance();
|
||||
Optional<String> serverName = plugin.getDB().getServerTable().getServerName(serverUUID);
|
||||
Optional<String> serverName = plugin.getDB().fetch().getServerName(serverUUID);
|
||||
serverName.ifPresent(name -> {
|
||||
String target = "/server/" + name;
|
||||
String url = plugin.getInfoManager().getLinkTo(target);
|
||||
|
@ -82,7 +82,7 @@ public class InspectCommand extends SubCommand {
|
||||
sender.sendMessage(ChatColor.YELLOW + "[Plan] You might not have a web user, use /plan register <password>");
|
||||
}
|
||||
}
|
||||
plugin.addToProcessQueue(new InspectCacheRequestProcessor(uuid, sender, playerName));
|
||||
new InspectCacheRequestProcessor(uuid, sender, playerName).queue();
|
||||
} catch (DBException ex) {
|
||||
if (ex instanceof FatalDBException) {
|
||||
Log.toLog(this.getClass().getName(), ex);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.djrapitops.plan.command.commands;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.Msg;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.djrapitops.plan.data;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.container.StickyData;
|
||||
import com.djrapitops.plan.data.container.TPS;
|
||||
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.data;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.data.container.GeoInfo;
|
||||
import com.djrapitops.plan.data.container.PlayerKill;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
|
@ -12,6 +12,8 @@ import com.djrapitops.plan.system.processing.ProcessingQueue;
|
||||
import com.djrapitops.plan.system.settings.config.ConfigSystem;
|
||||
import com.djrapitops.plan.system.tasks.TaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plan.systems.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.utilities.NullCheck;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
|
||||
@ -26,6 +28,7 @@ public abstract class PlanSystem implements SubSystem {
|
||||
|
||||
// Initialized in this class
|
||||
protected final ProcessingQueue processingQueue;
|
||||
protected final WebServerSystem webServerSystem;
|
||||
|
||||
// These need to be initialized in the sub class.
|
||||
protected VersionCheckSystem versionCheckSystem;
|
||||
@ -38,6 +41,7 @@ public abstract class PlanSystem implements SubSystem {
|
||||
|
||||
public PlanSystem() {
|
||||
processingQueue = new ProcessingQueue();
|
||||
webServerSystem = new WebServerSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,4 +135,12 @@ public abstract class PlanSystem implements SubSystem {
|
||||
public TaskSystem getTaskSystem() {
|
||||
return taskSystem;
|
||||
}
|
||||
|
||||
public WebServerSystem getWebServerSystem() {
|
||||
return webServerSystem;
|
||||
}
|
||||
|
||||
public ServerInfo getServerInfo() {
|
||||
return null; // TODO
|
||||
}
|
||||
}
|
@ -5,19 +5,18 @@
|
||||
package com.djrapitops.plan.system.database;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.Msg;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
import com.djrapitops.plan.utilities.NullCheck;
|
||||
import com.djrapitops.plugin.api.Benchmark;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ -28,8 +27,8 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class DBSystem implements SubSystem {
|
||||
|
||||
protected SQLDB db;
|
||||
protected Set<SQLDB> databases;
|
||||
protected Database db;
|
||||
protected Set<Database> databases;
|
||||
|
||||
public DBSystem() {
|
||||
databases = new HashSet<>();
|
||||
@ -49,7 +48,7 @@ public abstract class DBSystem implements SubSystem {
|
||||
initDatabase();
|
||||
db.scheduleClean(10L);
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INFO).parse(db.getConfigName()));
|
||||
Benchmark.stop("Systems", "Init Database");
|
||||
Benchmark.stop("Enable", "Init Database");
|
||||
} catch (DBInitException e) {
|
||||
throw new EnableException(db.getName() + "-Database failed to initialize", e);
|
||||
}
|
||||
@ -57,11 +56,11 @@ public abstract class DBSystem implements SubSystem {
|
||||
|
||||
protected abstract void initDatabase() throws DBInitException;
|
||||
|
||||
public Set<SQLDB> getDatabases() {
|
||||
public Set<Database> getDatabases() {
|
||||
return databases;
|
||||
}
|
||||
|
||||
public void setDatabases(Set<SQLDB> databases) {
|
||||
public void setDatabases(Set<Database> databases) {
|
||||
this.databases = databases;
|
||||
}
|
||||
|
||||
@ -71,7 +70,7 @@ public abstract class DBSystem implements SubSystem {
|
||||
if (db != null) {
|
||||
db.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
@ -80,8 +79,8 @@ public abstract class DBSystem implements SubSystem {
|
||||
return db;
|
||||
}
|
||||
|
||||
public SQLDB getActiveDatabase(String dbName) throws DBInitException {
|
||||
for (SQLDB database : getDatabases()) {
|
||||
public Database getActiveDatabase(String dbName) throws DBInitException {
|
||||
for (Database database : getDatabases()) {
|
||||
String dbConfigName = database.getConfigName();
|
||||
if (Verify.equalsIgnoreCase(dbName, dbConfigName)) {
|
||||
database.init();
|
||||
|
@ -34,6 +34,12 @@ public abstract class Database {
|
||||
|
||||
public abstract RemoveOperations remove();
|
||||
|
||||
public abstract SearchOperations search();
|
||||
|
||||
public abstract CountOperations count();
|
||||
|
||||
public abstract SaveOperations save();
|
||||
|
||||
/**
|
||||
* Used to get the name of the database type.
|
||||
* <p>
|
||||
@ -60,7 +66,5 @@ public abstract class Database {
|
||||
return open;
|
||||
}
|
||||
|
||||
public abstract SearchOperations search();
|
||||
|
||||
public abstract CountOperations count();
|
||||
public abstract void scheduleClean(long delay);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.djrapitops.plan.system.database.databases.operation;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -12,4 +13,7 @@ public interface CheckOperations {
|
||||
|
||||
boolean doesWebUserExists(String username) throws DBException;
|
||||
|
||||
default boolean isPlayerRegisteredOnThisServer(UUID player) throws DBException {
|
||||
return isPlayerRegistered(player, PlanSystem.getInstance().getServerInfo().getUuid());
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.UUID;
|
||||
|
||||
public interface CountOperations {
|
||||
|
||||
int serverPlayerCount(UUID server) throws DBException;
|
||||
int getServerPlayerCount(UUID server) throws DBException;
|
||||
|
||||
int getNetworkPlayerCount() throws DBException;
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.PlayerProfile;
|
||||
import com.djrapitops.plan.data.ServerProfile;
|
||||
import com.djrapitops.plan.data.WebUser;
|
||||
import com.djrapitops.plan.data.container.TPS;
|
||||
import com.djrapitops.plan.data.container.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public interface FetchOperations {
|
||||
|
||||
// Profiles
|
||||
|
||||
|
||||
ServerProfile getServerProfile(UUID serverUUID) throws DBException;
|
||||
|
||||
List<PlayerProfile> getPlayers(UUID serverUUID) throws DBException;
|
||||
@ -19,7 +19,7 @@ public interface FetchOperations {
|
||||
PlayerProfile getPlayerProfile(UUID uuid) throws DBException;
|
||||
|
||||
// UUIDs
|
||||
|
||||
|
||||
Set<UUID> getSavedUUIDs() throws DBException;
|
||||
|
||||
Set<UUID> getSavedUUIDs(UUID server) throws DBException;
|
||||
@ -37,4 +37,36 @@ public interface FetchOperations {
|
||||
// Raw Data
|
||||
|
||||
List<TPS> getTPSData(UUID serverUUID) throws DBException;
|
||||
|
||||
List<TPS> getNetworkOnlineData() throws DBException;
|
||||
|
||||
List<Long> getRegisterDates() throws DBException;
|
||||
|
||||
Optional<TPS> getAllTimePeak(UUID serverUUID) throws DBException;
|
||||
|
||||
Optional<TPS> getPeakPlayerCount(UUID serverUUID, long afterDate) throws DBException;
|
||||
|
||||
Map<UUID, Map<UUID, List<Session>>> getSessionsWithNoExtras() throws DBException;
|
||||
|
||||
Map<UUID, Map<UUID, List<Session>>> getSessionsAndExtras() throws DBException;
|
||||
|
||||
Set<String> getWorldNames(UUID serverUuid) throws DBException;
|
||||
|
||||
List<String> getNicknamesOfPlayerOnServer(UUID uuid, UUID serverUUID) throws DBException;
|
||||
|
||||
List<Action> getActions(UUID uuid) throws DBException;
|
||||
|
||||
Map<UUID, UserInfo> getUsers() throws DBException;
|
||||
|
||||
Map<UUID, Long> getLastSeenForAllPlayers() throws DBException;
|
||||
|
||||
Map<UUID, List<GeoInfo>> getAllGeoInfo() throws DBException;
|
||||
|
||||
Map<UUID, String> getPlayerNames() throws DBException;
|
||||
|
||||
String getPlayerName(UUID playerUUID) throws DBException;
|
||||
|
||||
Optional<String> getServerName(UUID serverUUID) throws DBException;
|
||||
|
||||
List<String> getNicknames(UUID uuid) throws DBException;
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 com.djrapitops.plan.system.database.databases.operation;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public interface SaveOperations {
|
||||
|
||||
// Bulk save
|
||||
|
||||
void insertTPS(Map<UUID, List<TPS>> ofServers) throws DBException;
|
||||
|
||||
void insertCommandUsage(Map<UUID, Map<String, Integer>> ofServers) throws DBException;
|
||||
|
||||
void insertUsers(Map<UUID, UserInfo> ofServers) throws DBException;
|
||||
|
||||
void insertSessions(Map<UUID, Map<UUID, List<Session>>> ofServers, boolean containsExtraData)
|
||||
throws DBException;
|
||||
|
||||
void kickAmount(Map<UUID, Integer> ofUsers) throws DBException;
|
||||
|
||||
void insertUserInfo(Map<UUID, List<UserInfo>> ofServers) throws DBException;
|
||||
|
||||
void insertNicknames(Map<UUID, Map<UUID, List<String>>> ofServers) throws DBException;
|
||||
|
||||
void insertAllGeoInfo(Map<UUID, List<GeoInfo>> ofUsers) throws DBException;
|
||||
|
||||
// Single data point
|
||||
|
||||
void banStatus(UUID uuid, boolean banned) throws DBException;
|
||||
|
||||
void opStatus(UUID uuid, boolean op) throws DBException;
|
||||
|
||||
void registerNewUser(UUID uuid, long registered, String name) throws DBException;
|
||||
|
||||
void action(UUID uuid, Action action) throws DBException;
|
||||
|
||||
void geoInfo(UUID uuid, GeoInfo geoInfo) throws DBException;
|
||||
|
||||
void playerWasKicked(UUID uuid) throws DBException;
|
||||
|
||||
void playerName(UUID uuid, String playerName) throws DBException;
|
||||
|
||||
void playerDisplayName(UUID uuid, String displayName) throws DBException;
|
||||
|
||||
void registerNewUserOnThisServer(UUID uuid, long registered) throws DBException;
|
||||
|
||||
void commandUsed(String commandName) throws DBException;
|
||||
|
||||
void insertTPSforThisServer(TPS tps) throws DBException;
|
||||
|
||||
void session(UUID uuid, Session session) throws DBException;
|
||||
}
|
@ -6,6 +6,6 @@ import java.util.List;
|
||||
|
||||
public interface SearchOperations {
|
||||
|
||||
List<String> matchingNames(String search) throws DBException;
|
||||
List<String> matchingPlayers(String search) throws DBException;
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public abstract class SQLDB extends Database {
|
||||
private final KillsTable killsTable;
|
||||
private final NicknamesTable nicknamesTable;
|
||||
private final SessionsTable sessionsTable;
|
||||
private final IPsTable ipsTable;
|
||||
private final GeoInfoTable geoInfoTable;
|
||||
private final CommandUseTable commandUseTable;
|
||||
private final TPSTable tpsTable;
|
||||
private final VersionTable versionTable;
|
||||
@ -46,6 +46,7 @@ public abstract class SQLDB extends Database {
|
||||
private final SQLRemoveOps removeOps;
|
||||
private final SQLSearchOps searchOps;
|
||||
private final SQLCountOps countOps;
|
||||
private final SQLSaveOps saveOps;
|
||||
|
||||
private final boolean usingMySQL;
|
||||
private boolean open = false;
|
||||
@ -64,7 +65,7 @@ public abstract class SQLDB extends Database {
|
||||
usersTable = new UsersTable(this);
|
||||
userInfoTable = new UserInfoTable(this);
|
||||
actionsTable = new ActionsTable(this);
|
||||
ipsTable = new IPsTable(this);
|
||||
geoInfoTable = new GeoInfoTable(this);
|
||||
nicknamesTable = new NicknamesTable(this);
|
||||
sessionsTable = new SessionsTable(this);
|
||||
killsTable = new KillsTable(this);
|
||||
@ -77,6 +78,7 @@ public abstract class SQLDB extends Database {
|
||||
removeOps = new SQLRemoveOps(this);
|
||||
countOps = new SQLCountOps(this);
|
||||
searchOps = new SQLSearchOps(this);
|
||||
saveOps = new SQLSaveOps(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,11 +164,11 @@ public abstract class SQLDB extends Database {
|
||||
}
|
||||
if (version < 12) {
|
||||
actionsTable.alterTableV12();
|
||||
ipsTable.alterTableV12();
|
||||
geoInfoTable.alterTableV12();
|
||||
versionTable.setVersion(12);
|
||||
}
|
||||
if (version < 13) {
|
||||
ipsTable.alterTableV13();
|
||||
geoInfoTable.alterTableV13();
|
||||
versionTable.setVersion(13);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@ -194,7 +196,7 @@ public abstract class SQLDB extends Database {
|
||||
*/
|
||||
public Table[] getAllTables() {
|
||||
return new Table[]{
|
||||
serverTable, usersTable, userInfoTable, ipsTable,
|
||||
serverTable, usersTable, userInfoTable, geoInfoTable,
|
||||
nicknamesTable, sessionsTable, killsTable,
|
||||
commandUseTable, actionsTable, tpsTable,
|
||||
worldTable, worldTimesTable, securityTable
|
||||
@ -208,7 +210,7 @@ public abstract class SQLDB extends Database {
|
||||
*/
|
||||
public Table[] getAllTablesInRemoveOrder() {
|
||||
return new Table[]{
|
||||
ipsTable, nicknamesTable, killsTable,
|
||||
geoInfoTable, nicknamesTable, killsTable,
|
||||
worldTimesTable, sessionsTable, actionsTable,
|
||||
worldTable, userInfoTable, usersTable,
|
||||
commandUseTable, tpsTable, securityTable,
|
||||
@ -303,8 +305,8 @@ public abstract class SQLDB extends Database {
|
||||
return killsTable;
|
||||
}
|
||||
|
||||
public IPsTable getIpsTable() {
|
||||
return ipsTable;
|
||||
public GeoInfoTable getGeoInfoTable() {
|
||||
return geoInfoTable;
|
||||
}
|
||||
|
||||
public NicknamesTable getNicknamesTable() {
|
||||
@ -376,4 +378,9 @@ public abstract class SQLDB extends Database {
|
||||
public CountOperations count() {
|
||||
return countOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveOperations save() {
|
||||
return saveOps;
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,20 @@ public class SQLCountOps extends SQLOps implements CountOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int serverPlayerCount(UUID server) throws DBException {
|
||||
public int getServerPlayerCount(UUID server) throws DBException {
|
||||
try {
|
||||
return userInfoTable.getServerUserCount(server);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNetworkPlayerCount() throws DBException {
|
||||
try {
|
||||
return usersTable.getPlayerCount();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
||||
List<UserInfo> serverUserInfo = userInfoTable.getServerUserInfo(serverUUID);
|
||||
Map<UUID, Integer> timesKicked = usersTable.getAllTimesKicked();
|
||||
Map<UUID, List<Action>> actions = actionsTable.getServerActions(serverUUID);
|
||||
Map<UUID, List<GeoInfo>> geoInfo = ipsTable.getAllGeoInfo();
|
||||
Map<UUID, List<GeoInfo>> geoInfo = geoInfoTable.getAllGeoInfo();
|
||||
|
||||
Map<UUID, List<Session>> sessions = sessionsTable.getSessionInfoOfServer(serverUUID);
|
||||
Map<UUID, Map<UUID, List<Session>>> map = new HashMap<>();
|
||||
@ -109,7 +109,7 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
||||
|
||||
profile.setActions(actionsTable.getActions(uuid));
|
||||
profile.setNicknames(nicknamesTable.getAllNicknames(uuid));
|
||||
profile.setGeoInformation(ipsTable.getGeoInfo(uuid));
|
||||
profile.setGeoInformation(geoInfoTable.getGeoInfo(uuid));
|
||||
|
||||
Map<UUID, List<Session>> sessions = sessionsTable.getSessions(uuid);
|
||||
profile.setSessions(sessions);
|
||||
@ -201,4 +201,121 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TPS> getNetworkOnlineData() throws DBException {
|
||||
try {
|
||||
return tpsTable.getNetworkOnlineData();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getRegisterDates() throws DBException {
|
||||
try {
|
||||
return usersTable.getRegisterDates();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TPS> getAllTimePeak(UUID serverUUID) throws DBException {
|
||||
try {
|
||||
return tpsTable.getAllTimePeak(serverUUID);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TPS> getPeakPlayerCount(UUID serverUUID, long afterDate) throws DBException {
|
||||
try {
|
||||
return tpsTable.getPeakPlayerCount(serverUUID, afterDate);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, Map<UUID, List<Session>>> getSessionsWithNoExtras() throws DBException {
|
||||
try {
|
||||
return sessionsTable.getAllSessions(false);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, Map<UUID, List<Session>>> getSessionsAndExtras() throws DBException {
|
||||
try {
|
||||
return sessionsTable.getAllSessions(true);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getWorldNames(UUID serverUuid) throws DBException {
|
||||
try {
|
||||
return worldTable.getWorldNames(serverUuid);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNicknamesOfPlayerOnServer(UUID uuid, UUID serverUUID) throws DBException {
|
||||
try {
|
||||
return nicknamesTable.getNicknames(uuid, serverUUID);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Action> getActions(UUID uuid) throws DBException {
|
||||
try {
|
||||
return actionsTable.getActions(uuid);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, UserInfo> getUsers() throws DBException {
|
||||
try {
|
||||
return usersTable.getUsers();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, Long> getLastSeenForAllPlayers() throws DBException {
|
||||
try {
|
||||
return sessionsTable.getLastSeenForAllPlayers();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, List<GeoInfo>> getAllGeoInfo() throws DBException {
|
||||
try {
|
||||
return geoInfoTable.getAllGeoInfo();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, String> getPlayerNames() throws DBException {
|
||||
try {
|
||||
return usersTable.getPlayerNames();
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class SQLOps {
|
||||
protected final KillsTable killsTable;
|
||||
protected final NicknamesTable nicknamesTable;
|
||||
protected final SessionsTable sessionsTable;
|
||||
protected final IPsTable ipsTable;
|
||||
protected final GeoInfoTable geoInfoTable;
|
||||
protected final CommandUseTable commandUseTable;
|
||||
protected final TPSTable tpsTable;
|
||||
protected final SecurityTable securityTable;
|
||||
@ -30,7 +30,7 @@ public class SQLOps {
|
||||
killsTable = db.getKillsTable();
|
||||
nicknamesTable = db.getNicknamesTable();
|
||||
sessionsTable = db.getSessionsTable();
|
||||
ipsTable = db.getIpsTable();
|
||||
geoInfoTable = db.getGeoInfoTable();
|
||||
commandUseTable = db.getCommandUseTable();
|
||||
tpsTable = db.getTpsTable();
|
||||
securityTable = db.getSecurityTable();
|
||||
|
@ -0,0 +1,199 @@
|
||||
/*
|
||||
* 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 com.djrapitops.plan.system.database.databases.sql.operation;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.*;
|
||||
import com.djrapitops.plan.system.database.databases.operation.SaveOperations;
|
||||
import com.djrapitops.plan.system.database.databases.sql.ErrorUtil;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SQLSaveOps extends SQLOps implements SaveOperations {
|
||||
|
||||
public SQLSaveOps(SQLDB db) {
|
||||
super(db);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertTPS(Map<UUID, List<TPS>> ofServers) throws DBException {
|
||||
try {
|
||||
tpsTable.insertAllTPS(ofServers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertCommandUsage(Map<UUID, Map<String, Integer>> ofServers) throws DBException {
|
||||
try {
|
||||
commandUseTable.insertCommandUsage(ofServers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUsers(Map<UUID, UserInfo> ofServers) throws DBException {
|
||||
try {
|
||||
usersTable.insertUsers(ofServers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertSessions(Map<UUID, Map<UUID, List<Session>>> ofServers, boolean containsExtraData) throws DBException {
|
||||
try {
|
||||
sessionsTable.insertSessions(ofServers, containsExtraData);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickAmount(Map<UUID, Integer> ofUsers) throws DBException {
|
||||
try {
|
||||
usersTable.updateKicked(ofUsers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUserInfo(Map<UUID, List<UserInfo>> ofServers) throws DBException {
|
||||
try {
|
||||
userInfoTable.insertUserInfo(ofServers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertNicknames(Map<UUID, Map<UUID, List<String>>> ofServers) throws DBException {
|
||||
try {
|
||||
nicknamesTable.insertNicknames(ofServers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAllGeoInfo(Map<UUID, List<GeoInfo>> ofUsers) throws DBException {
|
||||
try {
|
||||
geoInfoTable.insertAllGeoInfo(ofUsers);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void banStatus(UUID uuid, boolean banned) throws DBException {
|
||||
try {
|
||||
userInfoTable.updateBanStatus(uuid, banned);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void opStatus(UUID uuid, boolean op) throws DBException {
|
||||
try {
|
||||
userInfoTable.updateOpStatus(uuid, op);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerNewUser(UUID uuid, long registered, String name) throws DBException {
|
||||
try {
|
||||
usersTable.registerUser(uuid, registered, name);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(UUID uuid, Action action) throws DBException {
|
||||
try {
|
||||
actionsTable.insertAction(uuid, action);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void geoInfo(UUID uuid, GeoInfo geoInfo) throws DBException {
|
||||
try {
|
||||
geoInfoTable.saveGeoInfo(uuid, geoInfo);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerWasKicked(UUID uuid) throws DBException {
|
||||
try {
|
||||
usersTable.kicked(uuid);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerName(UUID uuid, String playerName) throws DBException {
|
||||
try {
|
||||
usersTable.updateName(uuid, playerName);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerDisplayName(UUID uuid, String displayName) throws DBException {
|
||||
try {
|
||||
nicknamesTable.saveUserName(uuid, displayName);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerNewUserOnThisServer(UUID uuid, long registered) throws DBException {
|
||||
try {
|
||||
userInfoTable.registerUserInfo(uuid, registered);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commandUsed(String commandName) throws DBException {
|
||||
try {
|
||||
commandUseTable.commandUsed(commandName);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertTPSforThisServer(TPS tps) throws DBException {
|
||||
try {
|
||||
tpsTable.insertTPS(tps);
|
||||
} catch (SQLException e) {
|
||||
throw ErrorUtil.getExceptionFor(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class SQLSearchOps extends SQLOps implements SearchOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> matchingNames(String search) throws DBException {
|
||||
public List<String> matchingPlayers(String search) throws DBException {
|
||||
try {
|
||||
return usersTable.getMatchingNames(search);
|
||||
} catch (SQLException e) {
|
||||
|
@ -19,14 +19,14 @@ import java.util.*;
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class IPsTable extends UserIDTable {
|
||||
public class GeoInfoTable extends UserIDTable {
|
||||
|
||||
private final String columnIP = "ip";
|
||||
private final String columnGeolocation = "geolocation";
|
||||
private final String columnLastUsed = "last_used";
|
||||
private String insertStatement;
|
||||
|
||||
public IPsTable(SQLDB db) {
|
||||
public GeoInfoTable(SQLDB db) {
|
||||
super("plan_ips", db);
|
||||
insertStatement = "INSERT INTO " + tableName + " ("
|
||||
+ columnUserID + ", "
|
@ -105,17 +105,30 @@ public class UserInfoTable extends UserIDTable {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateOpAndBanStatus(UUID uuid, boolean opped, boolean banned) throws SQLException {
|
||||
String sql = Update.values(tableName, columnOP, columnBanned)
|
||||
public void updateOpStatus(UUID uuid, boolean op) throws SQLException {
|
||||
String sql = Update.values(tableName, columnOP)
|
||||
.where(columnUserID + "=" + usersTable.statementSelectID)
|
||||
.toString();
|
||||
|
||||
execute(new ExecStatement(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setBoolean(1, opped);
|
||||
statement.setBoolean(2, banned);
|
||||
statement.setString(3, uuid.toString());
|
||||
statement.setBoolean(1, op);
|
||||
statement.setString(2, uuid.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateBanStatus(UUID uuid, boolean banned) throws SQLException {
|
||||
String sql = Update.values(tableName, columnBanned)
|
||||
.where(columnUserID + "=" + usersTable.statementSelectID)
|
||||
.toString();
|
||||
|
||||
execute(new ExecStatement(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setBoolean(1, banned);
|
||||
statement.setString(2, uuid.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class BatchOperationTable extends Table {
|
||||
return;
|
||||
}
|
||||
Log.debug("Batch Copy IPs, Geolocations & Last used dates");
|
||||
toDB.getDb().getIpsTable().insertAllGeoInfo(db.getIpsTable().getAllGeoInfo());
|
||||
toDB.getDb().getGeoInfoTable().insertAllGeoInfo(db.getGeoInfoTable().getAllGeoInfo());
|
||||
}
|
||||
|
||||
public void copyNicknames(BatchOperationTable toDB) throws SQLException {
|
||||
|
@ -58,7 +58,7 @@ public class Version8TransferTable extends Table {
|
||||
copyUsers();
|
||||
|
||||
execute(dropTableSql("plan_ips"));
|
||||
db.getIpsTable().createTable();
|
||||
db.getGeoInfoTable().createTable();
|
||||
execute(dropTableSql("plan_world_times"));
|
||||
execute(dropTableSql("plan_worlds"));
|
||||
db.getWorldTable().createTable();
|
||||
|
@ -53,7 +53,7 @@ public class ChatListener implements Listener {
|
||||
dataCache.firstSessionMessageSent(uuid);
|
||||
}
|
||||
|
||||
plugin.addToProcessQueue(new NameProcessor(uuid, name, displayName));
|
||||
new NameProcessor(uuid, name, displayName).queue();
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class CommandPreprocessListener implements Listener {
|
||||
commandName = command.getName();
|
||||
}
|
||||
}
|
||||
plugin.addToProcessQueue(new CommandProcessor(commandName));
|
||||
new CommandProcessor(commandName).queue();
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
|
@ -58,19 +58,27 @@ public class DeathEventListener implements Listener {
|
||||
EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) entityDamageEvent;
|
||||
Entity killerEntity = entityDamageByEntityEvent.getDamager();
|
||||
|
||||
if (killerEntity instanceof Player) {
|
||||
handlePlayerKill(time, dead, (Player) killerEntity);
|
||||
} else if (killerEntity instanceof Wolf) {
|
||||
handleWolfKill(time, dead, (Wolf) killerEntity);
|
||||
} else if (killerEntity instanceof Arrow) {
|
||||
handleArrowKill(time, dead, (Arrow) killerEntity);
|
||||
}
|
||||
handleKill(time, dead, killerEntity);
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePlayerKill(long time, LivingEntity dead, Player killer) {
|
||||
private void handleKill(long time, LivingEntity dead, Entity killerEntity) {
|
||||
KillProcessor processor = null;
|
||||
if (killerEntity instanceof Player) {
|
||||
processor = handlePlayerKill(time, dead, (Player) killerEntity);
|
||||
} else if (killerEntity instanceof Wolf) {
|
||||
processor = handleWolfKill(time, dead, (Wolf) killerEntity);
|
||||
} else if (killerEntity instanceof Arrow) {
|
||||
processor = handleArrowKill(time, dead, (Arrow) killerEntity);
|
||||
}
|
||||
if (processor != null) {
|
||||
processor.queue();
|
||||
}
|
||||
}
|
||||
|
||||
private KillProcessor handlePlayerKill(long time, LivingEntity dead, Player killer) {
|
||||
Material itemInHand;
|
||||
try {
|
||||
itemInHand = killer.getInventory().getItemInMainHand().getType();
|
||||
@ -82,31 +90,31 @@ public class DeathEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
plugin.addToProcessQueue(new KillProcessor(killer.getUniqueId(), time, dead, normalizeMaterialName(itemInHand)));
|
||||
return new KillProcessor(killer.getUniqueId(), time, dead, normalizeMaterialName(itemInHand));
|
||||
}
|
||||
|
||||
private void handleWolfKill(long time, LivingEntity dead, Wolf wolf) {
|
||||
private KillProcessor handleWolfKill(long time, LivingEntity dead, Wolf wolf) {
|
||||
if (!wolf.isTamed()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
AnimalTamer owner = wolf.getOwner();
|
||||
if (!(owner instanceof Player)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
plugin.addToProcessQueue(new KillProcessor(owner.getUniqueId(), time, dead, "Wolf"));
|
||||
return new KillProcessor(owner.getUniqueId(), time, dead, "Wolf");
|
||||
}
|
||||
|
||||
private void handleArrowKill(long time, LivingEntity dead, Arrow arrow) {
|
||||
private KillProcessor handleArrowKill(long time, LivingEntity dead, Arrow arrow) {
|
||||
ProjectileSource source = arrow.getShooter();
|
||||
if (!(source instanceof Player)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
Player player = (Player) source;
|
||||
|
||||
plugin.addToProcessQueue(new KillProcessor(player.getUniqueId(), time, dead, "Bow"));
|
||||
return new KillProcessor(player.getUniqueId(), time, dead, "Bow");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
String name = player.getName();
|
||||
long now = MiscUtils.getTime();
|
||||
|
||||
plugin.getSystem().getProcessingQueue().addToQueue(new BungeePlayerRegisterProcessor(uuid, name, now));
|
||||
plugin.getSystem().getProcessingQueue().queue(new BungeePlayerRegisterProcessor(uuid, name, now));
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class ProcessingQueue extends Queue<Processor> implements SubSystem {
|
||||
public void run() {
|
||||
ProcessingQueue que = ProcessingQueue.getInstance();
|
||||
for (Processor processor : processors) {
|
||||
que.addToQueue(processor);
|
||||
que.queue(processor);
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class ProcessingQueue extends Queue<Processor> implements SubSystem {
|
||||
*
|
||||
* @param processor processing object.
|
||||
*/
|
||||
public void addToQueue(Processor processor) {
|
||||
public void queue(Processor processor) {
|
||||
if (!queue.offer(processor)) {
|
||||
Log.toLog("ProcessingQueue.addToQueue", new IllegalStateException("Processor was not added to Queue"));
|
||||
Log.toLog("ProcessingQueue.queue", new IllegalStateException("Processor was not added to Queue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,10 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Updates Command usage amount in the database.
|
||||
*
|
||||
@ -23,8 +22,8 @@ public class CommandProcessor extends Processor<String> {
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Plan.getInstance().getDB().getCommandUseTable().commandUsed(object);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().commandUsed(object);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,15 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.Actions;
|
||||
import com.djrapitops.plan.data.container.Action;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.processing.processors.player.PlayerProcessor;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -39,8 +39,8 @@ public class NewNickActionProcessor extends PlayerProcessor {
|
||||
Action action = new Action(MiscUtils.getTime(), Actions.NEW_NICKNAME, info);
|
||||
|
||||
try {
|
||||
Plan.getInstance().getDB().getActionsTable().insertAction(uuid, action);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().action(uuid, action);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,14 @@ public abstract class Processor<T> {
|
||||
return object;
|
||||
}
|
||||
|
||||
public void que() {
|
||||
que(this);
|
||||
public void queue() {
|
||||
queue(this);
|
||||
}
|
||||
|
||||
public static void que(Processor processor) {
|
||||
ProcessingQueue.getInstance().addToQueue(processor);
|
||||
public static void queue(Processor... processors) {
|
||||
ProcessingQueue processingQueue = ProcessingQueue.getInstance();
|
||||
for (Processor processor : processors) {
|
||||
processingQueue.queue(processor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.TPS;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.utilities.analysis.MathUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -36,8 +36,8 @@ public class TPSInsertProcessor extends Processor<List<TPS>> {
|
||||
|
||||
TPS tps = new TPS(lastDate, averageTPS, averagePlayersOnline, averageCPUUsage, averageUsedMemory, averageEntityCount, averageChunksLoaded);
|
||||
try {
|
||||
PlanPlugin.getInstance().getDB().getTpsTable().insertTPS(tps);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().insertTPSforThisServer(tps);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
package com.djrapitops.plan.system.processing.processors.importing.importers;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.GeoInfo;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.container.UserInfo;
|
||||
@ -20,7 +21,6 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -59,7 +59,7 @@ public abstract class Importer {
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() throws SQLException {
|
||||
void execute() throws DBException {
|
||||
Benchmark.start(userDataBenchmarkName);
|
||||
processUserData();
|
||||
Benchmark.stop(userDataBenchmarkName);
|
||||
@ -104,15 +104,15 @@ public abstract class Importer {
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getTpsTable().insertAllTPS(ImmutableMap.of(uuid, serverImportData.getTpsData()));
|
||||
void execute() throws DBException {
|
||||
db.save().insertTPS(ImmutableMap.of(uuid, serverImportData.getTpsData()));
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getCommandUseTable().insertCommandUsage(ImmutableMap.of(uuid, serverImportData.getCommandUsages()));
|
||||
void execute() throws DBException {
|
||||
db.save().insertCommandUsage(ImmutableMap.of(uuid, serverImportData.getCommandUsages()));
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
@ -129,7 +129,7 @@ public abstract class Importer {
|
||||
Benchmark.stop(benchmarkName);
|
||||
}
|
||||
|
||||
private void processUserData() {
|
||||
private void processUserData() throws DBException {
|
||||
String benchmarkName = "Processing User Data";
|
||||
String getDataBenchmarkName = "Getting User Data";
|
||||
String insertDataIntoCollectionsBenchmarkName = "Insert User Data into Collections";
|
||||
@ -190,40 +190,40 @@ public abstract class Importer {
|
||||
|
||||
Benchmark.start(insertDataIntoDatabaseBenchmarkName);
|
||||
|
||||
db.getUsersTable().insertUsers(users);
|
||||
db.save().insertUsers(users);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getSessionsTable().insertSessions(ImmutableMap.of(serverUUID, sessions), true);
|
||||
void execute() throws DBException {
|
||||
db.save().insertSessions(ImmutableMap.of(serverUUID, sessions), true);
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getUsersTable().updateKicked(timesKicked);
|
||||
void execute() throws DBException {
|
||||
db.save().kickAmount(timesKicked);
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getUserInfoTable().insertUserInfo(ImmutableMap.of(serverUUID, userInfo));
|
||||
void execute() throws DBException {
|
||||
db.save().insertUserInfo(ImmutableMap.of(serverUUID, userInfo));
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getNicknamesTable().insertNicknames(ImmutableMap.of(serverUUID, nickNames));
|
||||
void execute() throws DBException {
|
||||
db.save().insertNicknames(ImmutableMap.of(serverUUID, nickNames));
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
new ImportExecutorHelper() {
|
||||
@Override
|
||||
void execute() {
|
||||
db.getIpsTable().insertAllGeoInfo(geoInfo);
|
||||
void execute() throws DBException {
|
||||
db.save().insertAllGeoInfo(geoInfo);
|
||||
}
|
||||
}.submit(service);
|
||||
|
||||
@ -273,7 +273,7 @@ public abstract class Importer {
|
||||
}
|
||||
|
||||
private abstract class ImportExecutorHelper {
|
||||
abstract void execute() throws SQLException;
|
||||
abstract void execute() throws DBException;
|
||||
|
||||
void submit(ExecutorService service) {
|
||||
service.submit(new Runnable() {
|
||||
@ -281,7 +281,7 @@ public abstract class Importer {
|
||||
public void run() {
|
||||
try {
|
||||
execute();
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.operation.SaveOperations;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -30,8 +31,10 @@ public class BanAndOpProcessor extends PlayerProcessor {
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
try {
|
||||
Plan.getInstance().getDB().getUserInfoTable().updateOpAndBanStatus(uuid, opped, banned);
|
||||
} catch (SQLException e) {
|
||||
SaveOperations save = Database.getActive().save();
|
||||
save.banStatus(uuid, banned);
|
||||
save.opStatus(uuid, opped);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,10 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.UsersTable;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -30,13 +29,13 @@ public class BungeePlayerRegisterProcessor extends PlayerProcessor {
|
||||
@Override
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
UsersTable usersTable = PlanBungee.getInstance().getDB().getUsersTable();
|
||||
Database database = Database.getActive();
|
||||
try {
|
||||
if (usersTable.isRegistered(uuid)) {
|
||||
if (database.check().isPlayerRegistered(uuid)) {
|
||||
return;
|
||||
}
|
||||
usersTable.registerUser(uuid, registered, name);
|
||||
} catch (SQLException e) {
|
||||
database.save().registerNewUser(uuid, registered, name);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -5,11 +5,12 @@
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.Actions;
|
||||
import com.djrapitops.plan.data.container.Action;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -32,8 +33,8 @@ public class FirstLeaveProcessor extends PlayerProcessor {
|
||||
Plan plugin = Plan.getInstance();
|
||||
UUID uuid = getUUID();
|
||||
try {
|
||||
plugin.getDB().getActionsTable().insertAction(uuid, leaveAction);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().action(uuid, leaveAction);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
} finally {
|
||||
plugin.getDataCache().endFirstSessionActionTracking(uuid);
|
||||
|
@ -4,12 +4,12 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.GeoInfo;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.systems.cache.GeolocationCache;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -33,8 +33,8 @@ public class IPUpdateProcessor extends PlayerProcessor {
|
||||
UUID uuid = getUUID();
|
||||
String country = GeolocationCache.getCountry(ip);
|
||||
try {
|
||||
Plan.getInstance().getDB().getIpsTable().saveGeoInfo(uuid, new GeoInfo(ip, country, time));
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().geoInfo(uuid, new GeoInfo(ip, country, time));
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -24,8 +24,8 @@ public class KickProcessor extends PlayerProcessor {
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
try {
|
||||
Plan.getInstance().getDB().getUsersTable().kicked(uuid);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().playerWasKicked(uuid);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,13 @@
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.NicknamesTable;
|
||||
import com.djrapitops.plan.system.processing.ProcessingQueue;
|
||||
import com.djrapitops.plan.system.processing.processors.NewNickActionProcessor;
|
||||
import com.djrapitops.plan.systems.cache.DataCache;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -45,30 +45,24 @@ public class NameProcessor extends PlayerProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
Database db = plugin.getDB();
|
||||
NicknamesTable nicknamesTable = db.getNicknamesTable();
|
||||
cueNameChangeActionProcessor(uuid, plugin, nicknamesTable);
|
||||
|
||||
Database database = Database.getActive();
|
||||
try {
|
||||
db.getUsersTable().updateName(uuid, playerName);
|
||||
cueNameChangeActionProcessor(uuid, database);
|
||||
database.save().playerName(uuid, playerName);
|
||||
|
||||
nicknamesTable.saveUserName(uuid, displayName);
|
||||
} catch (SQLException e) {
|
||||
database.save().playerDisplayName(uuid, displayName);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
|
||||
dataCache.updateNames(uuid, playerName, displayName);
|
||||
}
|
||||
|
||||
private void cueNameChangeActionProcessor(UUID uuid, Plan plugin, NicknamesTable nicknamesTable) {
|
||||
try {
|
||||
List<String> nicknames = nicknamesTable.getNicknames(uuid, Plan.getServerUUID());
|
||||
if (nicknames.contains(displayName)) {
|
||||
return;
|
||||
}
|
||||
plugin.addToProcessQueue(new NewNickActionProcessor(uuid, displayName));
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
private void cueNameChangeActionProcessor(UUID uuid, Database db) throws DBException {
|
||||
List<String> nicknames = db.fetch().getNicknamesOfPlayerOnServer(uuid, Plan.getServerUUID());
|
||||
if (nicknames.contains(displayName)) {
|
||||
return;
|
||||
}
|
||||
ProcessingQueue.getInstance().queue(new NewNickActionProcessor(uuid, displayName));
|
||||
}
|
||||
}
|
@ -5,15 +5,13 @@
|
||||
package com.djrapitops.plan.system.processing.processors.player;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.Actions;
|
||||
import com.djrapitops.plan.data.container.Action;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.UserInfoTable;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.UsersTable;
|
||||
import com.djrapitops.plan.system.processing.processors.Processor;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -42,25 +40,23 @@ public class RegisterProcessor extends PlayerProcessor {
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
Plan plugin = Plan.getInstance();
|
||||
Database db = plugin.getDB();
|
||||
UsersTable usersTable = db.getUsersTable();
|
||||
UserInfoTable userInfoTable = db.getUserInfoTable();
|
||||
Database db = Database.getActive();
|
||||
try {
|
||||
if (!usersTable.isRegistered(uuid)) {
|
||||
usersTable.registerUser(uuid, registered, name);
|
||||
if (!db.check().isPlayerRegistered(uuid)) {
|
||||
db.save().registerNewUser(uuid, registered, name);
|
||||
}
|
||||
if (!userInfoTable.isRegistered(uuid)) {
|
||||
userInfoTable.registerUserInfo(uuid, registered);
|
||||
if (!db.check().isPlayerRegisteredOnThisServer(uuid)) {
|
||||
db.save().registerNewUserOnThisServer(uuid, registered);
|
||||
}
|
||||
if (db.getActionsTable().getActions(uuid).size() > 0) {
|
||||
if (db.fetch().getActions(uuid).size() > 0) {
|
||||
return;
|
||||
}
|
||||
plugin.getDataCache().markFirstSession(uuid);
|
||||
db.getActionsTable().insertAction(uuid, new Action(time, Actions.FIRST_SESSION, "Online: " + playersOnline + " Players"));
|
||||
} catch (SQLException e) {
|
||||
db.save().action(uuid, new Action(time, Actions.FIRST_SESSION, "Online: " + playersOnline + " Players"));
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
} finally {
|
||||
plugin.addToProcessQueue(afterProcess);
|
||||
Processor.queue(afterProcess);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,12 +5,13 @@
|
||||
package com.djrapitops.plan.system.webserver;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.systems.Systems;
|
||||
import com.djrapitops.plan.system.webserver.pagecache.ResponseCache;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* WebServer subsystem for managing WebServer initialization.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -19,16 +20,15 @@ public class WebServerSystem implements SubSystem {
|
||||
private WebServer webServer;
|
||||
|
||||
public WebServerSystem() {
|
||||
|
||||
webServer = new WebServer();
|
||||
}
|
||||
|
||||
public static WebServerSystem getInstance() {
|
||||
return Systems.getInstance().getWebServerSystem();
|
||||
return PlanSystem.getInstance().getWebServerSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
webServer = new WebServer();
|
||||
webServer.initServer();
|
||||
if (Check.isBungeeAvailable() && !webServer.isEnabled()) {
|
||||
throw new EnableException("WebServer did not initialize!");
|
||||
@ -40,10 +40,8 @@ public class WebServerSystem implements SubSystem {
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
// TODO Remove after WebServer setting requirement is gone.
|
||||
if (webServer != null) {
|
||||
webServer.stop();
|
||||
}
|
||||
ResponseCache.clearCache();
|
||||
webServer.stop();
|
||||
}
|
||||
|
||||
public static boolean isWebServerEnabled() {
|
||||
|
@ -7,6 +7,8 @@ package com.djrapitops.plan.system.webserver.response.pages;
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.ServerVariableHolder;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||
import com.djrapitops.plan.systems.info.server.BungeeServerInfoManager;
|
||||
import com.djrapitops.plan.systems.info.server.ServerInfo;
|
||||
@ -75,12 +77,17 @@ public class DebugPageResponse extends ErrorResponse {
|
||||
.append(" ").append(variable.getVersion());
|
||||
content.append("<br>");
|
||||
|
||||
content.append("**Database:** ").append(plugin.getDB().getName());
|
||||
try {
|
||||
content.append(" schema v").append(plugin.getDB().getVersion());
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
Database database = plugin.getDB();
|
||||
content.append("**Database:** ").append(database.getName());
|
||||
|
||||
if (database instanceof SQLDB) {
|
||||
try {
|
||||
content.append(" schema v").append(((SQLDB) database).getVersion());
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
content.append("<br><br>");
|
||||
|
||||
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.djrapitops.plan.system.webserver.response.pages;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.GeoInfo;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.container.UserInfo;
|
||||
import com.djrapitops.plan.data.element.TableContainer;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
@ -21,7 +23,6 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -33,8 +34,11 @@ public class PlayersPageResponse extends Response {
|
||||
public PlayersPageResponse() {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
try {
|
||||
PlanSystem system = PlanSystem.getInstance();
|
||||
|
||||
PlanPlugin plugin = PlanPlugin.getInstance();
|
||||
List<String> names = new ArrayList<>(plugin.getDB().getUsersTable().getPlayerNames().values());
|
||||
Database db = system.getDatabaseSystem().getActiveDatabase();
|
||||
List<String> names = new ArrayList<>(db.fetch().getPlayerNames().values());
|
||||
Collections.sort(names);
|
||||
Map<String, String> replace = new HashMap<>();
|
||||
if (Check.isBukkitAvailable()) {
|
||||
@ -42,22 +46,22 @@ public class PlayersPageResponse extends Response {
|
||||
} else {
|
||||
replace.put("networkName", Settings.BUNGEE_NETWORK_NAME.toString());
|
||||
}
|
||||
replace.put("playersTable", buildPlayersTable(plugin.getDB()));
|
||||
replace.put("playersTable", buildPlayersTable(db));
|
||||
replace.put("version", plugin.getVersion());
|
||||
super.setContent(Theme.replaceColors(StrSubstitutor.replace(FileUtil.getStringFromResource("web/players.html"), replace)));
|
||||
} catch (SQLException | IOException e) {
|
||||
} catch (DBException | IOException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
setContent(new InternalErrorResponse(e, "/players").getContent());
|
||||
setContent(new InternalErrorResponse("/players", e).getContent());
|
||||
}
|
||||
}
|
||||
|
||||
public static String buildPlayersTable(Database db) {
|
||||
private String buildPlayersTable(Database db) {
|
||||
try {
|
||||
List<UserInfo> users = new ArrayList<>(db.getUsersTable().getUsers().values());
|
||||
List<UserInfo> users = new ArrayList<>(db.fetch().getUsers().values());
|
||||
users.sort(new UserInfoLastPlayedComparator());
|
||||
Map<UUID, Long> lastSeenForAllPlayers = db.getSessionsTable().getLastSeenForAllPlayers();
|
||||
Map<UUID, List<Session>> sessionsByUser = AnalysisUtils.sortSessionsByUser(db.getSessionsTable().getAllSessions(false));
|
||||
Map<UUID, List<GeoInfo>> geoInfos = db.getIpsTable().getAllGeoInfo();
|
||||
Map<UUID, Long> lastSeenForAllPlayers = db.fetch().getLastSeenForAllPlayers();
|
||||
Map<UUID, List<Session>> sessionsByUser = AnalysisUtils.sortSessionsByUser(db.fetch().getSessionsWithNoExtras());
|
||||
Map<UUID, List<GeoInfo>> geoInfos = db.fetch().getAllGeoInfo();
|
||||
|
||||
String userS = Html.FONT_AWESOME_ICON.parse("user") + " Player";
|
||||
String playtimeS = Html.FONT_AWESOME_ICON.parse("clock-o") + " Playtime";
|
||||
@ -120,7 +124,7 @@ public class PlayersPageResponse extends Response {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
return html.append("</tbody></table>").toString();
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(PlayersPageResponse.class.getClass().getName(), e);
|
||||
return new InternalErrorResponse(e, "/players").getContent();
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public abstract class WebAPI {
|
||||
this.variables = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public Response processRequest(PlanPlugin plugin, Map<String, String> variables) {
|
||||
String sender = variables.get("sender");
|
||||
if (sender == null) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.webapi;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.pages.TreePageHandler;
|
||||
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
|
||||
import java.util.*;
|
||||
@ -11,7 +12,8 @@ import java.util.*;
|
||||
/**
|
||||
* @author Fuzzlemann and Rsl1122
|
||||
*/
|
||||
public class WebAPIManager {
|
||||
@Deprecated
|
||||
public class WebAPIManager extends TreePageHandler {
|
||||
|
||||
private final Map<String, WebAPI> registry;
|
||||
private static final Set<String> accessKeys = new HashSet<>();
|
||||
|
@ -57,14 +57,14 @@ public class PostHtmlWebAPI extends WebAPI {
|
||||
|
||||
ResponseCache.cacheResponse(PageId.PLAYER.of(uuid), () -> new InspectPageResponse(infoManager, UUID.fromString(uuid), StrSubstitutor.replace(html, map)));
|
||||
if (Settings.ANALYSIS_EXPORT.isTrue()) {
|
||||
HtmlExport.exportPlayer(plugin, UUID.fromString(uuid));
|
||||
HtmlExport.exportPlayer(UUID.fromString(uuid));
|
||||
}
|
||||
break;
|
||||
case "analysisPage":
|
||||
String sender = variables.get("sender");
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(sender), () -> new AnalysisPageResponse(html));
|
||||
if (Settings.ANALYSIS_EXPORT.isTrue()) {
|
||||
HtmlExport.exportServer(plugin, UUID.fromString(sender));
|
||||
HtmlExport.exportServer(UUID.fromString(sender));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1,135 +0,0 @@
|
||||
/*
|
||||
* 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 com.djrapitops.plan.systems;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.database.BungeeDBSystem;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.settings.config.BukkitConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.config.BungeeConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.config.ConfigSystem;
|
||||
import com.djrapitops.plan.system.tasks.BukkitTaskSystem;
|
||||
import com.djrapitops.plan.system.tasks.BungeeTaskSystem;
|
||||
import com.djrapitops.plan.system.tasks.TaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
/**
|
||||
* Layer for reducing
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Deprecated
|
||||
public class Systems {
|
||||
|
||||
private FileSystem fileSystem;
|
||||
private ConfigSystem configSystem;
|
||||
private DBSystem databaseSystem;
|
||||
private Theme themeSystem;
|
||||
|
||||
private WebServerSystem webServerSystem;
|
||||
|
||||
private TaskSystem taskSystem;
|
||||
|
||||
private VersionCheckSystem versionCheckSystem;
|
||||
|
||||
/**
|
||||
* Constructor for Bukkit version.
|
||||
*
|
||||
* @param plugin Plan instance
|
||||
*/
|
||||
public Systems(Plan plugin) {
|
||||
fileSystem = new FileSystem(plugin);
|
||||
configSystem = new BukkitConfigSystem();
|
||||
databaseSystem = new BukkitDBSystem();
|
||||
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
|
||||
|
||||
taskSystem = new BukkitTaskSystem();
|
||||
|
||||
webServerSystem = new WebServerSystem();
|
||||
themeSystem = new Theme();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for Bungee version.
|
||||
*
|
||||
* @param plugin PlanBungee instance
|
||||
*/
|
||||
public Systems(PlanBungee plugin) {
|
||||
fileSystem = new FileSystem(plugin);
|
||||
configSystem = new BungeeConfigSystem();
|
||||
databaseSystem = new BungeeDBSystem();
|
||||
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
|
||||
|
||||
taskSystem = new BungeeTaskSystem();
|
||||
|
||||
webServerSystem = new WebServerSystem();
|
||||
themeSystem = new Theme();
|
||||
}
|
||||
|
||||
private SubSystem[] getSubSystems() {
|
||||
return new SubSystem[]{
|
||||
fileSystem,
|
||||
configSystem,
|
||||
versionCheckSystem,
|
||||
databaseSystem,
|
||||
taskSystem,
|
||||
webServerSystem,
|
||||
themeSystem
|
||||
};
|
||||
}
|
||||
|
||||
public void close() {
|
||||
SubSystem[] subSystems = getSubSystems();
|
||||
ArrayUtils.reverse(subSystems);
|
||||
for (SubSystem subSystem : subSystems) {
|
||||
try {
|
||||
subSystem.disable();
|
||||
} catch (Exception e) {
|
||||
Log.toLog(Systems.class, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Systems getInstance() {
|
||||
return PlanPlugin.getInstance().getSystems();
|
||||
}
|
||||
|
||||
public FileSystem getFileSystem() {
|
||||
return fileSystem;
|
||||
}
|
||||
|
||||
public DBSystem getDatabaseSystem() {
|
||||
return databaseSystem;
|
||||
}
|
||||
|
||||
public ConfigSystem getConfigSystem() {
|
||||
return configSystem;
|
||||
}
|
||||
|
||||
public WebServerSystem getWebServerSystem() {
|
||||
return webServerSystem;
|
||||
}
|
||||
|
||||
public VersionCheckSystem getVersionCheckSystem() {
|
||||
return versionCheckSystem;
|
||||
}
|
||||
|
||||
public Theme getThemeSystem() {
|
||||
return themeSystem;
|
||||
}
|
||||
|
||||
public TaskSystem getTaskSystem() {
|
||||
return taskSystem;
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package com.djrapitops.plan.systems.cache;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -61,12 +61,12 @@ public class DataCache extends SessionCache {
|
||||
|
||||
public void cacheSavedNames() {
|
||||
try {
|
||||
Map<UUID, String> playerNames = db.getUsersTable().getPlayerNames();
|
||||
Map<UUID, String> playerNames = db.fetch().getPlayerNames();
|
||||
this.playerNames.putAll(playerNames);
|
||||
for (Map.Entry<UUID, String> entry : playerNames.entrySet()) {
|
||||
uuids.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
@ -81,9 +81,9 @@ public class DataCache extends SessionCache {
|
||||
String name = playerNames.get(uuid);
|
||||
if (name == null) {
|
||||
try {
|
||||
name = db.getUsersTable().getPlayerName(uuid);
|
||||
name = db.fetch().getPlayerName(uuid);
|
||||
playerNames.put(uuid, name);
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
name = "Error occurred";
|
||||
}
|
||||
@ -104,11 +104,11 @@ public class DataCache extends SessionCache {
|
||||
if (cached == null) {
|
||||
List<String> nicknames;
|
||||
try {
|
||||
nicknames = db.getNicknamesTable().getNicknames(uuid);
|
||||
nicknames = db.fetch().getNicknames(uuid);
|
||||
if (!nicknames.isEmpty()) {
|
||||
return nicknames.get(nicknames.size() - 1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
package com.djrapitops.plan.systems.cache;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.processing.processors.Processor;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -47,8 +48,8 @@ public class SessionCache {
|
||||
return;
|
||||
}
|
||||
session.endSession(time);
|
||||
plugin.getDB().getSessionsTable().saveSession(uuid, session);
|
||||
} catch (SQLException e) {
|
||||
Database.getActive().save().session(uuid, session);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
} finally {
|
||||
activeSessions.remove(uuid);
|
||||
|
@ -35,8 +35,8 @@ import com.djrapitops.plan.system.webserver.webapi.bukkit.RequestInspectPluginsT
|
||||
import com.djrapitops.plan.system.webserver.webapi.bungee.*;
|
||||
import com.djrapitops.plan.system.webserver.webapi.universal.PingWebAPI;
|
||||
import com.djrapitops.plan.systems.cache.DataCache;
|
||||
import com.djrapitops.plan.systems.info.parsing.AnalysisPageParser;
|
||||
import com.djrapitops.plan.systems.info.parsing.InspectPageParser;
|
||||
import com.djrapitops.plan.systems.info.parsing.AnalysisPage;
|
||||
import com.djrapitops.plan.systems.info.parsing.InspectPage;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.analysis.Analysis;
|
||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
@ -139,15 +139,15 @@ public class BukkitInformationManager extends InformationManager {
|
||||
}
|
||||
});
|
||||
if (Settings.ANALYSIS_EXPORT.isTrue()) {
|
||||
HtmlExport.exportPlayer(plugin, uuid);
|
||||
HtmlExport.exportPlayer(uuid);
|
||||
}
|
||||
}
|
||||
plugin.addToProcessQueue(new Processor<UUID>(uuid) {
|
||||
new Processor<UUID>(uuid) {
|
||||
@Override
|
||||
public void process() {
|
||||
cacheInspectPluginsTab(object);
|
||||
}
|
||||
});
|
||||
}.queue();
|
||||
}
|
||||
|
||||
public void cacheInspectPluginsTab(UUID uuid) {
|
||||
@ -265,7 +265,7 @@ public class BukkitInformationManager extends InformationManager {
|
||||
return analysisRefreshPage.getContent();
|
||||
}
|
||||
try {
|
||||
return Theme.replaceColors(new AnalysisPageParser(analysisData, plugin).parse());
|
||||
return Theme.replaceColors(new AnalysisPage(analysisData, plugin).toHtml());
|
||||
} catch (ParseException e) {
|
||||
return new InternalErrorResponse(e, this.getClass().getSimpleName()).getContent();
|
||||
}
|
||||
@ -273,7 +273,7 @@ public class BukkitInformationManager extends InformationManager {
|
||||
|
||||
@Override
|
||||
public String getPlayerHtml(UUID uuid) throws ParseException {
|
||||
return Theme.replaceColors(new InspectPageParser(uuid, plugin).parse());
|
||||
return Theme.replaceColors(new InspectPage(uuid, plugin).toHtml());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -318,7 +318,7 @@ public class BukkitInformationManager extends InformationManager {
|
||||
UUID serverUUID = Plan.getServerUUID();
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new AnalysisPageResponse(html));
|
||||
if (Settings.ANALYSIS_EXPORT.isTrue()) {
|
||||
HtmlExport.exportServer(plugin, serverUUID);
|
||||
HtmlExport.exportServer(serverUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.djrapitops.plan.system.webserver.webapi.bukkit.InspectWebAPI;
|
||||
import com.djrapitops.plan.system.webserver.webapi.bukkit.IsOnlineWebAPI;
|
||||
import com.djrapitops.plan.system.webserver.webapi.bungee.RequestPluginsTabWebAPI;
|
||||
import com.djrapitops.plan.systems.cache.DataCache;
|
||||
import com.djrapitops.plan.systems.info.parsing.NetworkPageParser;
|
||||
import com.djrapitops.plan.systems.info.parsing.NetworkPage;
|
||||
import com.djrapitops.plan.systems.info.server.BungeeServerInfoManager;
|
||||
import com.djrapitops.plan.systems.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
@ -54,7 +54,7 @@ public class BungeeInformationManager extends InformationManager {
|
||||
private final Map<UUID, Map<UUID, String[]>> pluginsTabContent;
|
||||
private final BungeeServerInfoManager serverInfoManager;
|
||||
|
||||
public BungeeInformationManager(PlanBungee plugin) throws SQLException {
|
||||
public BungeeInformationManager(PlanBungee plugin) {
|
||||
usingAnotherWebServer = false;
|
||||
pluginsTabContent = new HashMap<>();
|
||||
networkPageContent = new HashMap<>();
|
||||
@ -268,7 +268,7 @@ public class BungeeInformationManager extends InformationManager {
|
||||
@Override
|
||||
public String getAnalysisHtml() {
|
||||
try {
|
||||
return new NetworkPageParser(plugin).parse();
|
||||
return new NetworkPage(plugin).toHtml();
|
||||
} catch (ParseException e) {
|
||||
return new InternalErrorResponse(e, this.getClass().getSimpleName()).getContent();
|
||||
}
|
||||
@ -376,7 +376,7 @@ public class BungeeInformationManager extends InformationManager {
|
||||
UUID serverUUID = PlanPlugin.getInstance().getServerUuid();
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new AnalysisPageResponse(this));
|
||||
if (Settings.ANALYSIS_EXPORT.isTrue()) {
|
||||
HtmlExport.exportServer(plugin, serverUUID);
|
||||
HtmlExport.exportServer(serverUUID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,18 +20,18 @@ import java.io.IOException;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class AnalysisPageParser extends PageParser {
|
||||
public class AnalysisPage extends Page {
|
||||
|
||||
private final AnalysisData data;
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public AnalysisPageParser(AnalysisData analysisData, PlanPlugin plugin) {
|
||||
public AnalysisPage(AnalysisData analysisData, PlanPlugin plugin) {
|
||||
this.data = analysisData;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parse() throws ParseException {
|
||||
public String toHtml() throws ParseException {
|
||||
addValues(data.getReplaceMap());
|
||||
|
||||
try {
|
@ -44,17 +44,17 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class InspectPageParser extends PageParser {
|
||||
public class InspectPage extends Page {
|
||||
|
||||
private final UUID uuid;
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public InspectPageParser(UUID uuid, PlanPlugin plugin) {
|
||||
public InspectPage(UUID uuid, PlanPlugin plugin) {
|
||||
this.uuid = uuid;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public String parse() throws ParseException {
|
||||
public String toHtml() throws ParseException {
|
||||
try {
|
||||
if (uuid == null) {
|
||||
throw new IllegalStateException("UUID was null!");
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.systems.info.parsing;
|
||||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.api.exceptions.ParseException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.container.TPS;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
@ -22,7 +23,6 @@ import com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraph;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -33,21 +33,21 @@ import java.util.UUID;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class NetworkPageParser extends PageParser {
|
||||
public class NetworkPage extends Page {
|
||||
|
||||
private final PlanBungee plugin;
|
||||
|
||||
public NetworkPageParser(PlanBungee plugin) {
|
||||
public NetworkPage(PlanBungee plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parse() throws ParseException {
|
||||
public String toHtml() throws ParseException {
|
||||
try {
|
||||
UUID serverUUID = plugin.getServerUuid();
|
||||
long now = MiscUtils.getTime();
|
||||
Database db = plugin.getDB();
|
||||
List<TPS> networkOnlineData = db.getTpsTable().getNetworkOnlineData();
|
||||
List<TPS> networkOnlineData = db.fetch().getNetworkOnlineData();
|
||||
|
||||
peakTimes(serverUUID, now, db);
|
||||
|
||||
@ -60,9 +60,9 @@ public class NetworkPageParser extends PageParser {
|
||||
addValue("playersGraphColor", Theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE));
|
||||
addValue("playersOnline", plugin.getProxy().getOnlineCount());
|
||||
|
||||
addValue("playersTotal", db.getUsersTable().getPlayerCount());
|
||||
addValue("playersTotal", db.count().getNetworkPlayerCount());
|
||||
|
||||
List<Long> registerDates = db.getUsersTable().getRegisterDates();
|
||||
List<Long> registerDates = db.fetch().getRegisterDates();
|
||||
addValue("playersNewDay", AnalysisUtils.getNewPlayers(registerDates, TimeAmount.DAY.ms(), now));
|
||||
addValue("playersNewWeek", AnalysisUtils.getNewPlayers(registerDates, TimeAmount.WEEK.ms(), now));
|
||||
addValue("playersNewMonth", AnalysisUtils.getNewPlayers(registerDates, TimeAmount.MONTH.ms(), now));
|
||||
@ -76,8 +76,8 @@ public class NetworkPageParser extends PageParser {
|
||||
}
|
||||
}
|
||||
|
||||
private void uniquePlayers(long now, Database db) throws SQLException {
|
||||
Map<UUID, Map<UUID, List<Session>>> allSessions = db.getSessionsTable().getAllSessions(false);
|
||||
private void uniquePlayers(long now, Database db) throws DBException {
|
||||
Map<UUID, Map<UUID, List<Session>>> allSessions = db.fetch().getSessionsWithNoExtras();
|
||||
Map<UUID, List<Session>> userSessions = AnalysisUtils.sortSessionsByUser(allSessions);
|
||||
|
||||
long dayAgo = now - TimeAmount.DAY.ms();
|
||||
@ -89,9 +89,9 @@ public class NetworkPageParser extends PageParser {
|
||||
addValue("playersUniqueMonth", AnalysisUtils.getUniqueJoinsPerDay(userSessions, monthAgo));
|
||||
}
|
||||
|
||||
private void peakTimes(UUID serverUUID, long now, Database db) throws SQLException {
|
||||
Optional<TPS> allTimePeak = db.getTpsTable().getAllTimePeak(serverUUID);
|
||||
Optional<TPS> lastPeak = db.getTpsTable().getPeakPlayerCount(serverUUID, now - TimeAmount.DAY.ms() * 2L);
|
||||
private void peakTimes(UUID serverUUID, long now, Database db) throws DBException {
|
||||
Optional<TPS> allTimePeak = db.fetch().getAllTimePeak(serverUUID);
|
||||
Optional<TPS> lastPeak = db.fetch().getPeakPlayerCount(serverUUID, now - TimeAmount.DAY.ms() * 2L);
|
||||
|
||||
if (allTimePeak.isPresent()) {
|
||||
TPS tps = allTimePeak.get();
|
@ -15,11 +15,11 @@ import java.util.Map;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public abstract class PageParser {
|
||||
public abstract class Page {
|
||||
|
||||
protected final Map<String, Serializable> placeHolders;
|
||||
|
||||
public PageParser() {
|
||||
public Page() {
|
||||
this.placeHolders = new HashMap<>();
|
||||
}
|
||||
|
||||
@ -31,5 +31,5 @@ public abstract class PageParser {
|
||||
placeHolders.putAll(values);
|
||||
}
|
||||
|
||||
public abstract String parse() throws ParseException;
|
||||
public abstract String toHtml() throws ParseException;
|
||||
}
|
@ -2,7 +2,6 @@ package com.djrapitops.plan.utilities;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.Msg;
|
||||
@ -96,10 +95,10 @@ public class MiscUtils {
|
||||
* @return Alphabetically sorted list of matching player names.
|
||||
*/
|
||||
public static List<String> getMatchingPlayerNames(String search) {
|
||||
Database db = PlanPlugin.getInstance().getDB();
|
||||
Database db = Database.getActive();
|
||||
List<String> matches;
|
||||
try {
|
||||
matches = db.search().matchingPlayerNames(search);
|
||||
matches = db.search().matchingPlayers(search);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(MiscUtils.class, e);
|
||||
return new ArrayList<>();
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.djrapitops.plan.utilities.analysis;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.PlayerProfile;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.container.StickyData;
|
||||
import com.djrapitops.plan.data.element.ActivityIndex;
|
||||
import com.djrapitops.plan.data.time.GMTimes;
|
||||
import com.djrapitops.plan.data.time.WorldTimes;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -141,14 +142,14 @@ public class AnalysisUtils {
|
||||
// Add 0 time for worlds not present.
|
||||
Set<String> nonZeroWorlds = worldTimes.getWorldTimes().keySet();
|
||||
PlanPlugin plugin = PlanPlugin.getInstance();
|
||||
for (String world : plugin.getDB().getWorldTable().getWorldNames(plugin.getServerUuid())) {
|
||||
for (String world : Database.getActive().fetch().getWorldNames(plugin.getServerUuid())) {
|
||||
if (nonZeroWorlds.contains(world)) {
|
||||
continue;
|
||||
}
|
||||
worldTimes.setGMTimesForWorld(world, new GMTimes());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Log.toLog("AnalysisUtils.addMissingWorlds", e);
|
||||
} catch (DBException e) {
|
||||
Log.toLog(AnalysisUtils.class, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,11 @@
|
||||
package com.djrapitops.plan.utilities.file.export;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.UserInfo;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
import com.djrapitops.plan.settings.theme.ThemeVal;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.webserver.response.pages.PlayersPageResponse;
|
||||
import com.djrapitops.plan.system.webserver.webapi.bungee.PostHtmlWebAPI;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
@ -16,7 +18,6 @@ import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -33,22 +34,22 @@ public class HtmlExport extends SpecificExport {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public static void exportServer(PlanPlugin plugin, UUID serverUUID) {
|
||||
public static void exportServer(UUID serverUUID) {
|
||||
try {
|
||||
Optional<String> serverName = plugin.getDB().getServerTable().getServerName(serverUUID);
|
||||
Optional<String> serverName = Database.getActive().fetch().getServerName(serverUUID);
|
||||
serverName.ifPresent(s -> RunnableFactory.createNew(new AnalysisExport(serverUUID, s)).runTaskAsynchronously());
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(PostHtmlWebAPI.class.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void exportPlayer(PlanPlugin plugin, UUID playerUUID) {
|
||||
public static void exportPlayer(UUID playerUUID) {
|
||||
try {
|
||||
String playerName = plugin.getDB().getUsersTable().getPlayerName(playerUUID);
|
||||
String playerName = Database.getActive().fetch().getPlayerName(playerUUID);
|
||||
if (playerName != null) {
|
||||
RunnableFactory.createNew(new PlayerExport(playerUUID, playerName)).runTaskAsynchronously();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
} catch (DBException e) {
|
||||
Log.toLog(PostHtmlWebAPI.class.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
@ -68,7 +69,7 @@ public class HtmlExport extends SpecificExport {
|
||||
exportAvailableServerPages();
|
||||
exportAvailablePlayers();
|
||||
exportPlayersPage();
|
||||
} catch (IOException | SQLException e) {
|
||||
} catch (IOException | DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
} finally {
|
||||
try {
|
||||
@ -94,14 +95,14 @@ public class HtmlExport extends SpecificExport {
|
||||
export(exportFile, lines);
|
||||
}
|
||||
|
||||
private void exportAvailablePlayers() throws SQLException, IOException {
|
||||
for (Map.Entry<UUID, UserInfo> entry : plugin.getDB().getUsersTable().getUsers().entrySet()) {
|
||||
private void exportAvailablePlayers() throws DBException, IOException {
|
||||
for (Map.Entry<UUID, UserInfo> entry : Database.getActive().fetch().getUsers().entrySet()) {
|
||||
exportAvailablePlayerPage(entry.getKey(), entry.getValue().getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void exportAvailableServerPages() throws SQLException, IOException {
|
||||
Map<UUID, String> serverNames = plugin.getDB().getServerTable().getServerNames();
|
||||
private void exportAvailableServerPages() throws IOException, DBException {
|
||||
Map<UUID, String> serverNames = Database.getActive().fetch().getServerNames();
|
||||
|
||||
for (Map.Entry<UUID, String> entry : serverNames.entrySet()) {
|
||||
exportAvailableServerPage(entry.getKey(), entry.getValue());
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.utilities.file.export;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.webserver.pagecache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.pagecache.ResponseCache;
|
||||
|
@ -125,7 +125,7 @@ public class HtmlStructure {
|
||||
int playerCount = 0;
|
||||
String playerData = "[]";
|
||||
try {
|
||||
playerCount = db.count().serverPlayerCount(serverUUID);
|
||||
playerCount = db.count().getServerPlayerCount(serverUUID);
|
||||
playerData = PlayerActivityGraph.createSeries(db.fetch().getTPSData(serverUUID));
|
||||
} catch (DBException e) {
|
||||
Log.toLog(HtmlStructure.class.getClass().getName(), e);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.djrapitops.plan.utilities.html;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
|
||||
@ -58,7 +60,7 @@ public class HtmlUtils {
|
||||
}
|
||||
|
||||
public static String getRelativeInspectUrl(UUID uuid) {
|
||||
return Plan.getPlanAPI().getPlayerInspectPageLink(Plan.getInstance().getDataCache().getName(uuid));
|
||||
return PlanAPI.getInstance().getPlayerInspectPageLink(Plan.getInstance().getDataCache().getName(uuid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,7 @@
|
||||
package com.djrapitops.plan.utilities.html.structure;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.time.WorldTimes;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
@ -70,7 +71,7 @@ public class SessionTabStructureCreator {
|
||||
int playerKillCount = session.getPlayerKills().size();
|
||||
|
||||
String name = Plan.getInstance().getDataCache().getName(uuid);
|
||||
String link = Plan.getPlanAPI().getPlayerInspectPageLink(name);
|
||||
String link = PlanAPI.getInstance().getPlayerInspectPageLink(name);
|
||||
|
||||
String dotSeparated2 = appendWorldPerc
|
||||
? HtmlStructure.separateWithDots(sessionStart, SessionsTableCreator.getLongestWorldPlayed(session))
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.djrapitops.plan.utilities.html.tables;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.data.container.PlayerKill;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.Msg;
|
||||
@ -47,7 +48,7 @@ public class KillsTableCreator {
|
||||
String name = Plan.getInstance().getDataCache().getName(kill.getVictim());
|
||||
html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse(
|
||||
String.valueOf(date), FormatUtils.formatTimeStamp(date),
|
||||
Html.LINK.parse(Plan.getPlanAPI().getPlayerInspectPageLink(name), name),
|
||||
Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name),
|
||||
kill.getWeapon()
|
||||
));
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.djrapitops.plan.utilities.html.tables;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.data.PlayerProfile;
|
||||
import com.djrapitops.plan.data.element.ActivityIndex;
|
||||
import com.djrapitops.plan.data.element.AnalysisContainer;
|
||||
@ -64,7 +64,7 @@ public class PlayersTableCreator {
|
||||
|
||||
String geoLocation = profile.getMostRecentGeoInfo().getGeolocation();
|
||||
html.append(Html.TABLELINE_PLAYERS.parse(
|
||||
Html.LINK_EXTERNAL.parse(Plan.getPlanAPI().getPlayerInspectPageLink(profile.getName()), profile.getName()),
|
||||
Html.LINK_EXTERNAL.parse(PlanAPI.getInstance().getPlayerInspectPageLink(profile.getName()), profile.getName()),
|
||||
activityString,
|
||||
String.valueOf(playtime), FormatUtils.formatTimeAmount(playtime),
|
||||
String.valueOf(loginTimes),
|
||||
@ -133,7 +133,7 @@ public class PlayersTableCreator {
|
||||
break;
|
||||
}
|
||||
UUID uuid = profile.getUuid();
|
||||
String link = Html.LINK_EXTERNAL.parse(Plan.getPlanAPI().getPlayerInspectPageLink(profile.getName()), profile.getName());
|
||||
String link = Html.LINK_EXTERNAL.parse(PlanAPI.getInstance().getPlayerInspectPageLink(profile.getName()), profile.getName());
|
||||
|
||||
String[] playerData = FormatUtils.mergeArrays(new String[]{link}, sortedData.getOrDefault(uuid, new String[]{}));
|
||||
tableContainer.addRow(ArrayUtils.addAll(playerData));
|
||||
|
@ -5,6 +5,7 @@
|
||||
package com.djrapitops.plan.utilities.html.tables;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.api.PlanAPI;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.time.WorldTimes;
|
||||
import com.djrapitops.plan.settings.WorldAliasSettings;
|
||||
@ -81,7 +82,7 @@ public class SessionsTableCreator {
|
||||
String length = session.getSessionEnd() != -1 ? FormatUtils.formatTimeAmount(session.getLength()) : "Online";
|
||||
String world = getLongestWorldPlayed(session);
|
||||
|
||||
String inspectUrl = Plan.getPlanAPI().getPlayerInspectPageLink(name);
|
||||
String inspectUrl = PlanAPI.getInstance().getPlayerInspectPageLink(name);
|
||||
String toolTip = "Session ID: " + (session.isFetchedFromDB() ? session.getSessionID() : "Not Saved.");
|
||||
sessionTableBuilder.append(Html.TABLELINE_4.parse(
|
||||
Html.LINK_TOOLTIP.parse(inspectUrl, name, toolTip),
|
||||
|
@ -244,7 +244,7 @@ public class DatabaseTest {
|
||||
assertEquals(expected, tpsTable.getTPSData());
|
||||
}
|
||||
|
||||
private void saveUserOne() throws SQLException {
|
||||
private void saveUserOne() {
|
||||
saveUserOne(db);
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ public class DatabaseTest {
|
||||
database.getUsersTable().registerUser(uuid, 123456789L, "Test");
|
||||
}
|
||||
|
||||
private void saveUserTwo() throws SQLException {
|
||||
private void saveUserTwo() {
|
||||
saveUserTwo(db);
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ public class DatabaseTest {
|
||||
@Test
|
||||
public void testIPTable() throws SQLException, DBInitException {
|
||||
saveUserOne();
|
||||
IPsTable ipsTable = db.getIpsTable();
|
||||
GeoInfoTable ipsTable = db.getIpsTable();
|
||||
|
||||
String expectedIP = "1.2.3.4";
|
||||
String expectedGeoLoc = "TestLocation";
|
||||
@ -353,7 +353,7 @@ public class DatabaseTest {
|
||||
assertEquals(new HashSet<>(worlds), new HashSet<>(saved));
|
||||
}
|
||||
|
||||
private void saveTwoWorlds() throws SQLException {
|
||||
private void saveTwoWorlds() {
|
||||
saveTwoWorlds(db);
|
||||
}
|
||||
|
||||
@ -508,14 +508,14 @@ public class DatabaseTest {
|
||||
userInfoTable.registerUserInfo(uuid, 223456789L);
|
||||
assertTrue(userInfoTable.isRegistered(uuid));
|
||||
|
||||
userInfoTable.updateOpAndBanStatus(uuid, true, true);
|
||||
userInfoTable.updateOpStatus(uuid, true, true);
|
||||
commitTest();
|
||||
|
||||
UserInfo userInfo = userInfoTable.getUserInfo(uuid);
|
||||
assertTrue(userInfo.isBanned());
|
||||
assertTrue(userInfo.isOpped());
|
||||
|
||||
userInfoTable.updateOpAndBanStatus(uuid, false, true);
|
||||
userInfoTable.updateOpStatus(uuid, false, true);
|
||||
commitTest();
|
||||
|
||||
userInfo = userInfoTable.getUserInfo(uuid);
|
||||
@ -523,7 +523,7 @@ public class DatabaseTest {
|
||||
assertTrue(userInfo.isBanned());
|
||||
assertFalse(userInfo.isOpped());
|
||||
|
||||
userInfoTable.updateOpAndBanStatus(uuid, false, false);
|
||||
userInfoTable.updateOpStatus(uuid, false, false);
|
||||
commitTest();
|
||||
|
||||
userInfo = userInfoTable.getUserInfo(uuid);
|
||||
@ -572,7 +572,7 @@ public class DatabaseTest {
|
||||
UsersTable usersTable = db.getUsersTable();
|
||||
SessionsTable sessionsTable = db.getSessionsTable();
|
||||
NicknamesTable nicknamesTable = db.getNicknamesTable();
|
||||
IPsTable ipsTable = db.getIpsTable();
|
||||
GeoInfoTable ipsTable = db.getIpsTable();
|
||||
ActionsTable actionsTable = db.getActionsTable();
|
||||
|
||||
userInfoTable.registerUserInfo(uuid, 223456789L);
|
||||
@ -606,7 +606,7 @@ public class DatabaseTest {
|
||||
UsersTable usersTable = db.getUsersTable();
|
||||
SessionsTable sessionsTable = db.getSessionsTable();
|
||||
NicknamesTable nicknamesTable = db.getNicknamesTable();
|
||||
IPsTable ipsTable = db.getIpsTable();
|
||||
GeoInfoTable ipsTable = db.getIpsTable();
|
||||
ActionsTable actionsTable = db.getActionsTable();
|
||||
TPSTable tpsTable = db.getTpsTable();
|
||||
SecurityTable securityTable = db.getSecurityTable();
|
||||
@ -636,7 +636,7 @@ public class DatabaseTest {
|
||||
UsersTable usersTable = database.getUsersTable();
|
||||
SessionsTable sessionsTable = database.getSessionsTable();
|
||||
NicknamesTable nicknamesTable = database.getNicknamesTable();
|
||||
IPsTable ipsTable = database.getIpsTable();
|
||||
GeoInfoTable ipsTable = database.getIpsTable();
|
||||
ActionsTable actionsTable = database.getActionsTable();
|
||||
TPSTable tpsTable = database.getTpsTable();
|
||||
SecurityTable securityTable = database.getSecurityTable();
|
||||
@ -790,7 +790,7 @@ public class DatabaseTest {
|
||||
UsersTable usersTable = backup.getUsersTable();
|
||||
SessionsTable sessionsTable = backup.getSessionsTable();
|
||||
NicknamesTable nicknamesTable = backup.getNicknamesTable();
|
||||
IPsTable ipsTable = backup.getIpsTable();
|
||||
GeoInfoTable ipsTable = backup.getGeoInfoTable();
|
||||
ActionsTable actionsTable = backup.getActionsTable();
|
||||
TPSTable tpsTable = backup.getTpsTable();
|
||||
SecurityTable securityTable = backup.getSecurityTable();
|
||||
|
Loading…
Reference in New Issue
Block a user