mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-15 20:51:21 +01:00
Merge pull request #466 from Rsl1122/RefactoringBranch
Pull Request for 4.1.3.1
This commit is contained in:
commit
f9c46e4cc5
@ -34,20 +34,19 @@ import com.djrapitops.plugin.settings.ColorScheme;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.ITask;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.api.API;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.PlanEnableException;
|
||||
import main.java.com.djrapitops.plan.command.PlanCommand;
|
||||
import main.java.com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.MySQLDB;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import main.java.com.djrapitops.plan.settings.Settings;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Locale;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Msg;
|
||||
import main.java.com.djrapitops.plan.settings.theme.Theme;
|
||||
import main.java.com.djrapitops.plan.systems.DatabaseSystem;
|
||||
import main.java.com.djrapitops.plan.systems.FileSystem;
|
||||
import main.java.com.djrapitops.plan.systems.Systems;
|
||||
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
||||
import main.java.com.djrapitops.plan.systems.cache.GeolocationCache;
|
||||
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
|
||||
@ -67,12 +66,9 @@ import main.java.com.djrapitops.plan.utilities.metrics.BStats;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -91,12 +87,11 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
private Config config;
|
||||
private Theme theme;
|
||||
|
||||
private Systems systems;
|
||||
|
||||
private ProcessingQueue processingQueue;
|
||||
private HookHandler hookHandler; // Manages 3rd party data sources
|
||||
|
||||
private Database db;
|
||||
private Set<Database> databases;
|
||||
|
||||
private WebServer webServer;
|
||||
|
||||
private BukkitInformationManager infoManager;
|
||||
@ -148,10 +143,10 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
try {
|
||||
File dataFolder = getDataFolder();
|
||||
dataFolder.mkdirs();
|
||||
File configFile = new File(dataFolder, "config.yml");
|
||||
config = new Config(configFile);
|
||||
systems = new Systems(this);
|
||||
FileSystem.getInstance().init();
|
||||
|
||||
config = new Config(FileSystem.getConfigFile());
|
||||
config.copyDefaults(FileUtil.lines(this, "config.yml"));
|
||||
config.save();
|
||||
|
||||
@ -191,10 +186,7 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
serverVariableHolder = new ServerVariableHolder(getServer());
|
||||
Benchmark.stop("Enable", "Reading server variables");
|
||||
|
||||
Benchmark.start("Init Database");
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INIT).toString());
|
||||
initDatabase();
|
||||
Benchmark.stop("Enable", "Init Database");
|
||||
DatabaseSystem.getInstance().init();
|
||||
|
||||
Benchmark.start("WebServer Initialization");
|
||||
webServer = new WebServer(this);
|
||||
@ -351,6 +343,9 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
}).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 5L);
|
||||
}
|
||||
}
|
||||
|
||||
systems.close();
|
||||
|
||||
Log.info(Locale.get(Msg.DISABLED).toString());
|
||||
Benchmark.pluginDisabled(Plan.class);
|
||||
DebugLog.pluginDisabled(Plan.class);
|
||||
@ -382,34 +377,6 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
Benchmark.stop("Enable", "Register Listeners");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the database according to settings in the config.
|
||||
* <p>
|
||||
* If database connection can not be established plugin is disabled.
|
||||
*/
|
||||
private void initDatabase() throws DatabaseInitException {
|
||||
databases = new HashSet<>();
|
||||
databases.add(new MySQLDB(this));
|
||||
databases.add(new SQLiteDB(this));
|
||||
|
||||
String dbType = Settings.DB_TYPE.toString().toLowerCase().trim();
|
||||
|
||||
for (Database database : databases) {
|
||||
String databaseType = database.getConfigName().toLowerCase().trim();
|
||||
if (Verify.equalsIgnoreCase(dbType, databaseType)) {
|
||||
this.db = database;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (db == null) {
|
||||
throw new DatabaseInitException(Locale.get(Msg.ENABLE_FAIL_WRONG_DB).toString() + " " + dbType);
|
||||
}
|
||||
|
||||
db.init();
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INFO).parse(db.getConfigName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to access Cache.
|
||||
*
|
||||
@ -424,8 +391,9 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
*
|
||||
* @return the Current Database
|
||||
*/
|
||||
@Deprecated
|
||||
public Database getDB() {
|
||||
return db;
|
||||
return DatabaseSystem.getInstance().getActiveDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -446,17 +414,6 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
return hookHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get all possible database objects.
|
||||
* <p>
|
||||
* #init() might need to be called in order for the object to function.
|
||||
*
|
||||
* @return Set containing the SqLite and MySQL objects.
|
||||
*/
|
||||
public Set<Database> getDatabases() {
|
||||
return databases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the ID of the BootAnalysisTask, so that it can be disabled.
|
||||
*
|
||||
@ -581,4 +538,8 @@ public class Plan extends BukkitPlugin implements IPlan {
|
||||
public Theme getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
public Systems getSystems() {
|
||||
return systems;
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,15 @@ import com.djrapitops.plugin.settings.ColorScheme;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.command.PlanBungeeCommand;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.MySQLDB;
|
||||
import main.java.com.djrapitops.plan.settings.Settings;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Locale;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Msg;
|
||||
import main.java.com.djrapitops.plan.settings.theme.Theme;
|
||||
import main.java.com.djrapitops.plan.systems.DatabaseSystem;
|
||||
import main.java.com.djrapitops.plan.systems.FileSystem;
|
||||
import main.java.com.djrapitops.plan.systems.Systems;
|
||||
import main.java.com.djrapitops.plan.systems.info.BungeeInformationManager;
|
||||
import main.java.com.djrapitops.plan.systems.info.InformationManager;
|
||||
import main.java.com.djrapitops.plan.systems.info.server.BungeeServerInfoManager;
|
||||
@ -37,10 +38,8 @@ import main.java.com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import main.java.com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -53,8 +52,9 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
private Config config;
|
||||
private Theme theme;
|
||||
|
||||
private Systems systems;
|
||||
|
||||
private WebServer webServer;
|
||||
private Database db;
|
||||
private BungeeServerInfoManager serverInfoManager;
|
||||
private BungeeInformationManager infoManager;
|
||||
private ServerVariableHolder variableHolder;
|
||||
@ -65,8 +65,10 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
try {
|
||||
File configFile = new File(getDataFolder(), "config.yml");
|
||||
config = new Config(configFile);
|
||||
systems = new Systems(this);
|
||||
FileSystem.getInstance().init();
|
||||
|
||||
config = new Config(FileSystem.getConfigFile());
|
||||
config.copyDefaults(FileUtil.lines(this, "bungeeconfig.yml"));
|
||||
config.save();
|
||||
|
||||
@ -93,8 +95,7 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
|
||||
theme = new Theme();
|
||||
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INIT).toString());
|
||||
initDatabase();
|
||||
DatabaseSystem.getInstance().init();
|
||||
|
||||
registerCommand("planbungee", new PlanBungeeCommand(this));
|
||||
|
||||
@ -168,13 +169,7 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
if (webServer != null) {
|
||||
webServer.stop();
|
||||
}
|
||||
if (db != null) {
|
||||
try {
|
||||
db.close();
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
systems.close();
|
||||
Log.info(Locale.get(Msg.DISABLED).toString());
|
||||
super.onDisable();
|
||||
}
|
||||
@ -193,14 +188,10 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
}
|
||||
}
|
||||
|
||||
private void initDatabase() throws DatabaseInitException {
|
||||
db = new MySQLDB(this);
|
||||
db.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public Database getDB() {
|
||||
return db;
|
||||
return DatabaseSystem.getInstance().getActiveDatabase();
|
||||
}
|
||||
|
||||
public BungeeServerInfoManager getServerInfoManager() {
|
||||
@ -270,4 +261,9 @@ public class PlanBungee extends BungeePlugin implements IPlan {
|
||||
public Theme getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Systems getSystems() {
|
||||
return systems;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import com.djrapitops.plugin.settings.ColorScheme;
|
||||
import main.java.com.djrapitops.plan.ServerVariableHolder;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.settings.theme.Theme;
|
||||
import main.java.com.djrapitops.plan.systems.Systems;
|
||||
import main.java.com.djrapitops.plan.systems.info.InformationManager;
|
||||
import main.java.com.djrapitops.plan.systems.processing.Processor;
|
||||
import main.java.com.djrapitops.plan.systems.queue.ProcessingQueue;
|
||||
@ -48,4 +49,6 @@ public interface IPlan extends IPlugin {
|
||||
ColorScheme getColorScheme();
|
||||
|
||||
Theme getTheme();
|
||||
|
||||
Systems getSystems();
|
||||
}
|
@ -54,7 +54,7 @@ public class ManageBackupCommand extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Database database = ManageUtils.getDB(plugin, dbName);
|
||||
final Database database = ManageUtils.getDB(dbName);
|
||||
|
||||
// If DB is null return
|
||||
if (!Condition.isTrue(Verify.notNull(database), Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString(), sender)) {
|
||||
|
@ -71,7 +71,7 @@ public class ManageClearCommand extends SubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
Database database = ManageUtils.getDB(plugin, dbName);
|
||||
Database database = ManageUtils.getDB(dbName);
|
||||
runClearTask(sender, database);
|
||||
} catch (DatabaseInitException e) {
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString());
|
||||
|
@ -66,7 +66,7 @@ public class ManageHotswapCommand extends SubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
final Database database = ManageUtils.getDB(plugin, dbName);
|
||||
final Database database = ManageUtils.getDB(dbName);
|
||||
|
||||
// If DB is null return
|
||||
if (!Condition.isTrue(Verify.notNull(database), Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString(), sender)) {
|
||||
|
@ -71,8 +71,8 @@ public class ManageMoveCommand extends SubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
final Database fromDatabase = ManageUtils.getDB(plugin, fromDB);
|
||||
final Database toDatabase = ManageUtils.getDB(plugin, toDB);
|
||||
final Database fromDatabase = ManageUtils.getDB(fromDB);
|
||||
final Database toDatabase = ManageUtils.getDB(toDB);
|
||||
|
||||
runMoveTask(fromDatabase, toDatabase, sender);
|
||||
} catch (Exception e) {
|
||||
|
@ -61,7 +61,7 @@ public class ManageRestoreCommand extends SubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
final Database database = ManageUtils.getDB(plugin, db);
|
||||
final Database database = ManageUtils.getDB(db);
|
||||
|
||||
runRestoreTask(args, sender, database);
|
||||
} catch (Exception e) {
|
||||
@ -87,7 +87,7 @@ public class ManageRestoreCommand extends SubCommand {
|
||||
backupDBName = backupDBName.substring(0, backupDBName.length() - 3);
|
||||
}
|
||||
|
||||
SQLiteDB backupDB = new SQLiteDB(plugin, backupDBName);
|
||||
SQLiteDB backupDB = new SQLiteDB(backupDBName);
|
||||
backupDB.init();
|
||||
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse());
|
||||
|
@ -18,12 +18,12 @@ import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.ActivityStackGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.WorldMapCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.ActivityStackGraph;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.WorldMap;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.*;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPie;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
import main.java.com.djrapitops.plan.utilities.html.structure.AnalysisPluginsTabContentCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.CommandUseTableCreator;
|
||||
@ -143,8 +143,8 @@ public class AnalysisData extends RawData {
|
||||
|
||||
Map<String, Set<UUID>> activityNow = activityData.getOrDefault(now, new HashMap<>());
|
||||
|
||||
String[] activityStackSeries = ActivityStackGraphCreator.createSeries(activityData);
|
||||
String activityPieSeries = ActivityPieCreator.createSeriesData(activityNow);
|
||||
String[] activityStackSeries = ActivityStackGraph.createSeries(activityData);
|
||||
String activityPieSeries = ActivityPie.createSeries(activityNow);
|
||||
|
||||
addValue("activityStackCategories", activityStackSeries[0]);
|
||||
addValue("activityStackSeries", activityStackSeries[1]);
|
||||
@ -170,7 +170,7 @@ public class AnalysisData extends RawData {
|
||||
}
|
||||
|
||||
private void geolocationsTab(List<String> geoLocations) {
|
||||
addValue("geoMapSeries", WorldMapCreator.createDataSeries(geoLocations));
|
||||
addValue("geoMapSeries", WorldMap.createSeries(geoLocations));
|
||||
}
|
||||
|
||||
private void onlineActivityNumbers(ServerProfile profile, Map<UUID, List<Session>> sessions, List<PlayerProfile> players) {
|
||||
@ -285,7 +285,7 @@ public class AnalysisData extends RawData {
|
||||
addValue("tableBodySessions", tables[0]);
|
||||
addValue("listRecentLogins", tables[1]);
|
||||
addValue("sessionAverage", FormatUtils.formatTimeAmount(MathUtils.averageLong(allSessions.stream().map(Session::getLength))));
|
||||
addValue("punchCardSeries", PunchCardGraphCreator.createDataSeries(sessionsMonth));
|
||||
addValue("punchCardSeries", PunchCardGraph.createSeries(sessionsMonth));
|
||||
|
||||
addValue("deaths", ServerProfile.getDeathCount(allSessions));
|
||||
addValue("mobKillCount", ServerProfile.getMobKillCount(allSessions));
|
||||
@ -302,7 +302,7 @@ public class AnalysisData extends RawData {
|
||||
Html.TABLE_PLAYERS_FOOTER.parse(playersTableBody)
|
||||
: Html.TABLE_PLAYERS.parse(playersTableBody));
|
||||
addValue("worldTotal", FormatUtils.formatTimeAmount(worldTimes.getTotal()));
|
||||
String[] seriesData = WorldPieCreator.createSeriesData(worldTimes);
|
||||
String[] seriesData = WorldPie.createSeries(worldTimes);
|
||||
addValue("worldSeries", seriesData[0]);
|
||||
addValue("gmSeries", seriesData[1]);
|
||||
addValue("lastPeakTime", lastPeak != -1 ? FormatUtils.formatTimeStampYear(lastPeak) : "No Data");
|
||||
@ -319,12 +319,12 @@ public class AnalysisData extends RawData {
|
||||
addValue("tpsSpikeWeek", value("tpsSpikeWeek"));
|
||||
addValue("tpsSpikeDay", value("tpsSpikeDay"));
|
||||
|
||||
addValue("playersOnlineSeries", PlayerActivityGraphCreator.buildSeriesDataString(tpsData));
|
||||
addValue("tpsSeries", TPSGraphCreator.buildSeriesDataString(tpsData));
|
||||
addValue("cpuSeries", CPUGraphCreator.buildSeriesDataString(tpsData));
|
||||
addValue("ramSeries", RamGraphCreator.buildSeriesDataString(tpsData));
|
||||
addValue("entitySeries", WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsData));
|
||||
addValue("chunkSeries", WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsData));
|
||||
addValue("playersOnlineSeries", PlayerActivityGraph.createSeries(tpsData));
|
||||
addValue("tpsSeries", TPSGraph.createSeries(tpsData));
|
||||
addValue("cpuSeries", CPUGraph.createSeries(tpsData));
|
||||
addValue("ramSeries", RamGraph.createSeries(tpsData));
|
||||
addValue("entitySeries", WorldLoadGraph.createSeriesEntities(tpsData));
|
||||
addValue("chunkSeries", WorldLoadGraph.createSeriesChunks(tpsData));
|
||||
|
||||
double averageCPUMonth = MathUtils.averageDouble(tpsDataMonth.stream().map(TPS::getCPUUsage).filter(i -> i != 0));
|
||||
double averageCPUWeek = MathUtils.averageDouble(tpsDataWeek.stream().map(TPS::getCPUUsage).filter(i -> i != 0));
|
||||
|
@ -1,6 +1,5 @@
|
||||
package main.java.com.djrapitops.plan.database;
|
||||
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.data.PlayerProfile;
|
||||
import main.java.com.djrapitops.plan.data.ServerProfile;
|
||||
@ -23,7 +22,6 @@ import java.util.UUID;
|
||||
*/
|
||||
public abstract class Database {
|
||||
|
||||
protected final IPlan plugin;
|
||||
protected UsersTable usersTable;
|
||||
protected UserInfoTable userInfoTable;
|
||||
protected ActionsTable actionsTable;
|
||||
@ -43,11 +41,8 @@ public abstract class Database {
|
||||
|
||||
/**
|
||||
* Super constructor.
|
||||
*
|
||||
* @param plugin current instance of Plan.
|
||||
*/
|
||||
public Database(IPlan plugin) {
|
||||
this.plugin = plugin;
|
||||
public Database() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
package main.java.com.djrapitops.plan.database.databases;
|
||||
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.settings.Settings;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
@ -16,15 +15,6 @@ public class MySQLDB extends SQLDB {
|
||||
|
||||
private BasicDataSource dataSource;
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public MySQLDB(IPlan plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups the {@link BasicDataSource}
|
||||
*/
|
||||
|
@ -6,7 +6,6 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.ITask;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.data.PlayerProfile;
|
||||
import main.java.com.djrapitops.plan.data.ServerProfile;
|
||||
@ -33,8 +32,7 @@ public abstract class SQLDB extends Database {
|
||||
private boolean open = false;
|
||||
private ITask dbCleanTask;
|
||||
|
||||
public SQLDB(IPlan plugin) {
|
||||
super(plugin);
|
||||
public SQLDB() {
|
||||
usingMySQL = getName().equals("MySQL");
|
||||
|
||||
versionTable = new VersionTable(this, usingMySQL);
|
||||
|
@ -4,7 +4,6 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.ITask;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
@ -26,15 +25,12 @@ public class SQLiteDB extends SQLDB {
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public SQLiteDB(Plan plugin) {
|
||||
this(plugin, "database");
|
||||
public SQLiteDB() {
|
||||
this("database");
|
||||
}
|
||||
|
||||
public SQLiteDB(Plan plugin, String dbName) {
|
||||
super(plugin);
|
||||
public SQLiteDB(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
@ -59,7 +55,7 @@ public class SQLiteDB extends SQLDB {
|
||||
return null; // Should never happen.
|
||||
}
|
||||
|
||||
String dbFilePath = new File(plugin.getDataFolder(), dbName + ".db").getAbsolutePath();
|
||||
String dbFilePath = new File(MiscUtils.getIPlan().getDataFolder(), dbName + ".db").getAbsolutePath();
|
||||
Connection connection;
|
||||
|
||||
try {
|
||||
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems;
|
||||
|
||||
import com.djrapitops.plugin.api.Benchmark;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.PlanEnableException;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.MySQLDB;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import main.java.com.djrapitops.plan.settings.Settings;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Locale;
|
||||
import main.java.com.djrapitops.plan.settings.locale.Msg;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class DatabaseSystem implements SubSystem {
|
||||
|
||||
private Database db;
|
||||
private Set<Database> databases;
|
||||
|
||||
@Override
|
||||
public void init() throws PlanEnableException {
|
||||
try {
|
||||
Benchmark.start("Init Database");
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INIT).toString());
|
||||
initDatabase();
|
||||
Log.info(Locale.get(Msg.ENABLE_DB_INFO).parse(db.getConfigName()));
|
||||
Benchmark.stop("Systems", "Init Database");
|
||||
} catch (DatabaseInitException e) {
|
||||
throw new PlanEnableException(db.getConfigName() + "-Database failed to initialize", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initDatabase() throws DatabaseInitException {
|
||||
if (Check.isBungeeAvailable()) {
|
||||
db = new MySQLDB();
|
||||
} else {
|
||||
// Enables database on Bukkit
|
||||
// Bukkit supports SQLite.
|
||||
initPlanDatabase();
|
||||
}
|
||||
db.init();
|
||||
}
|
||||
|
||||
private void initPlanDatabase() throws DatabaseInitException {
|
||||
databases = new HashSet<>();
|
||||
databases.add(new MySQLDB());
|
||||
databases.add(new SQLiteDB());
|
||||
|
||||
String dbType = Settings.DB_TYPE.toString().toLowerCase().trim();
|
||||
db = getActiveDatabase(dbType);
|
||||
}
|
||||
|
||||
public Set<Database> getDatabases() {
|
||||
return databases;
|
||||
}
|
||||
|
||||
public void setDatabases(Set<Database> databases) {
|
||||
this.databases = databases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
if (db != null) {
|
||||
db.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static DatabaseSystem getInstance() {
|
||||
return Systems.getInstance().databaseSystem;
|
||||
}
|
||||
|
||||
public Database getActiveDatabase() {
|
||||
return db;
|
||||
}
|
||||
|
||||
public static Database getActiveDatabase(String dbName) throws DatabaseInitException {
|
||||
for (Database database : DatabaseSystem.getInstance().getDatabases()) {
|
||||
String dbConfigName = database.getConfigName();
|
||||
if (Verify.equalsIgnoreCase(dbName, dbConfigName)) {
|
||||
database.init();
|
||||
return database;
|
||||
}
|
||||
}
|
||||
throw new DatabaseInitException(Locale.get(Msg.ENABLE_FAIL_WRONG_DB) + " " + dbName);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems;
|
||||
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.PlanEnableException;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class FileSystem implements SubSystem {
|
||||
|
||||
private final File dataFolder;
|
||||
private File configFile;
|
||||
|
||||
public FileSystem(IPlan plugin) {
|
||||
dataFolder = plugin.getDataFolder();
|
||||
}
|
||||
|
||||
public static FileSystem getInstance() {
|
||||
return Systems.getInstance().fileSystem;
|
||||
}
|
||||
|
||||
public static File getDataFolder() {
|
||||
return getInstance().dataFolder;
|
||||
}
|
||||
|
||||
public static File getConfigFile() {
|
||||
return getInstance().configFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws PlanEnableException {
|
||||
dataFolder.mkdirs();
|
||||
configFile = new File(dataFolder, "config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems;
|
||||
|
||||
import main.java.com.djrapitops.plan.api.exceptions.PlanEnableException;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public interface SubSystem {
|
||||
|
||||
void init() throws PlanEnableException;
|
||||
|
||||
void close();
|
||||
|
||||
}
|
44
Plan/src/main/java/com/djrapitops/plan/systems/Systems.java
Normal file
44
Plan/src/main/java/com/djrapitops/plan/systems/Systems.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems;
|
||||
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
/**
|
||||
* Layer for reducing
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class Systems {
|
||||
|
||||
FileSystem fileSystem;
|
||||
DatabaseSystem databaseSystem;
|
||||
|
||||
public Systems(IPlan plugin) {
|
||||
databaseSystem = new DatabaseSystem();
|
||||
fileSystem = new FileSystem(plugin);
|
||||
}
|
||||
|
||||
private SubSystem[] getSubSystems() {
|
||||
return new SubSystem[]{
|
||||
databaseSystem,
|
||||
fileSystem
|
||||
};
|
||||
}
|
||||
|
||||
public void close() {
|
||||
SubSystem[] subSystems = getSubSystems();
|
||||
ArrayUtils.reverse(subSystems);
|
||||
for (SubSystem subSystem : subSystems) {
|
||||
subSystem.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static Systems getInstance() {
|
||||
return MiscUtils.getIPlan().getSystems();
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package main.java.com.djrapitops.plan.systems.cache;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.container.Session;
|
||||
import main.java.com.djrapitops.plan.systems.processing.Processor;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -31,7 +32,12 @@ public class SessionCache {
|
||||
|
||||
public void cacheSession(UUID uuid, Session session) {
|
||||
activeSessions.put(uuid, session);
|
||||
plugin.getInfoManager().cachePlayer(uuid);
|
||||
plugin.addToProcessQueue(new Processor<Plan>(plugin) {
|
||||
@Override
|
||||
public void process() {
|
||||
plugin.getInfoManager().cachePlayer(uuid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void endSession(UUID uuid, long time) {
|
||||
|
@ -26,9 +26,9 @@ import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparato
|
||||
import main.java.com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.ServerPreferencePieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.ServerPreferencePie;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
import main.java.com.djrapitops.plan.utilities.html.structure.ServerAccordionCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.ActionsTableCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.IpTableCreator;
|
||||
@ -72,7 +72,6 @@ public class InspectPageParser extends PageParser {
|
||||
|
||||
return parse(profile, serverUUID, serverNames);
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
throw new ParseException(e);
|
||||
}
|
||||
}
|
||||
@ -108,7 +107,7 @@ public class InspectPageParser extends PageParser {
|
||||
}
|
||||
|
||||
Map<UUID, WorldTimes> worldTimesPerServer = profile.getWorldTimesPerServer();
|
||||
addValue("serverPieSeries", ServerPreferencePieCreator.createSeriesData(serverNames, worldTimesPerServer));
|
||||
addValue("serverPieSeries", ServerPreferencePie.createSeries(serverNames, worldTimesPerServer));
|
||||
addValue("worldPieColors", Theme.getValue(ThemeVal.GRAPH_WORLD_PIE));
|
||||
addValue("gmPieColors", Theme.getValue(ThemeVal.GRAPH_GM_PIE));
|
||||
addValue("serverPieColors", Theme.getValue(ThemeVal.GRAPH_SERVER_PREF_PIE));
|
||||
@ -195,11 +194,11 @@ public class InspectPageParser extends PageParser {
|
||||
List<Action> actions = profile.getAllActions();
|
||||
addValue("tableBodyActions", ActionsTableCreator.createTable(actions));
|
||||
|
||||
String punchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
|
||||
String punchCardData = PunchCardGraph.createSeries(allSessions);
|
||||
WorldTimes worldTimes = profile.getWorldTimes();
|
||||
AnalysisUtils.addMissingWorlds(worldTimes);
|
||||
|
||||
String[] worldPieData = WorldPieCreator.createSeriesData(worldTimes);
|
||||
String[] worldPieData = WorldPie.createSeries(worldTimes);
|
||||
|
||||
addValue("worldPieSeries", worldPieData[0]);
|
||||
addValue("gmSeries", worldPieData[1]);
|
||||
|
@ -20,7 +20,7 @@ import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraph;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@ -56,7 +56,7 @@ public class NetworkPageParser extends PageParser {
|
||||
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
|
||||
addValue("networkName", Settings.BUNGEE_NETWORK_NAME.toString());
|
||||
addValue("version", plugin.getVersion());
|
||||
addValue("playersOnlineSeries", PlayerActivityGraphCreator.buildSeriesDataString(networkOnlineData));
|
||||
addValue("playersOnlineSeries", PlayerActivityGraph.createSeries(networkOnlineData));
|
||||
addValue("playersGraphColor", Theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE));
|
||||
addValue("playersOnline", plugin.getProxy().getOnlineCount());
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class DebugPageResponse extends ErrorResponse {
|
||||
String javaVMVersion = properties.getProperty("java.vm.version");
|
||||
List<String> javaVMFlags = runtimeMxBean.getInputArguments();
|
||||
|
||||
content.append("**Operating System:** ").append(osName).append(" (").append(osArch)
|
||||
content.append("**Operating SubSystem:** ").append(osName).append(" (").append(osArch)
|
||||
.append(") version ").append(osVersion).append("<br>");
|
||||
|
||||
content.append("**Java Version:** ").append(javaVersion).append(", ").append(javaVendor).append("<br>");
|
||||
@ -159,8 +159,8 @@ public class DebugPageResponse extends ErrorResponse {
|
||||
for (String line : Benchmark.getAverages().asStringArray()) {
|
||||
content.append(line).append("<br>");
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
content.append("ArrayIndexOutOfBoundsException on Benchmark.getAverages().asStringArray()");
|
||||
} catch (Exception e) {
|
||||
content.append("Exception on Benchmark.getAverages().asStringArray()");
|
||||
}
|
||||
content.append("```</pre>");
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package main.java.com.djrapitops.plan.utilities;
|
||||
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import main.java.com.djrapitops.plan.database.tables.move.BatchOperationTable;
|
||||
import main.java.com.djrapitops.plan.systems.DatabaseSystem;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
@ -33,7 +33,7 @@ public class ManageUtils {
|
||||
Plan plugin = Plan.getInstance();
|
||||
String timeStamp = new Date().toString().substring(4, 10).replace(" ", "-");
|
||||
String fileName = dbName + "-backup-" + timeStamp;
|
||||
SQLiteDB backupDB = new SQLiteDB(plugin, fileName);
|
||||
SQLiteDB backupDB = new SQLiteDB(fileName);
|
||||
Collection<UUID> uuids = ManageUtils.getUUIDS(copyFromDB);
|
||||
if (uuids.isEmpty()) {
|
||||
return;
|
||||
@ -74,16 +74,8 @@ public class ManageUtils {
|
||||
fromDB.copyEverything(toDB);
|
||||
}
|
||||
|
||||
public static Database getDB(Plan plugin, String dbName) throws DatabaseInitException {
|
||||
Database database = null;
|
||||
for (Database sqldb : plugin.getDatabases()) {
|
||||
String dbConfigName = sqldb.getConfigName();
|
||||
if (Verify.equalsIgnoreCase(dbName, dbConfigName)) {
|
||||
database = sqldb;
|
||||
database.init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return database;
|
||||
@Deprecated
|
||||
public static Database getDB(String dbName) throws DatabaseInitException {
|
||||
return DatabaseSystem.getActiveDatabase(dbName);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.settings.Settings;
|
||||
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraph;
|
||||
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
|
||||
|
||||
@ -125,7 +125,7 @@ public class HtmlStructure {
|
||||
int playerCount = db.getUserInfoTable().getServerUserCount(serverUUID);
|
||||
String playerData = "[]";
|
||||
try {
|
||||
playerData = PlayerActivityGraphCreator.buildSeriesDataString(db.getTpsTable().getTPSData(serverUUID));
|
||||
playerData = PlayerActivityGraph.createSeries(db.getTpsTable().getTPSData(serverUUID));
|
||||
} catch (SQLException e) {
|
||||
Log.toLog(HtmlStructure.class.getClass().getName(), e);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package main.java.com.djrapitops.plan.utilities.html.graphs;
|
||||
import main.java.com.djrapitops.plan.settings.theme.ThemeVal;
|
||||
import main.java.com.djrapitops.plan.settings.theme.Theme;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPie;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -19,14 +19,14 @@ import java.util.UUID;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ActivityStackGraphCreator {
|
||||
public class ActivityStackGraph {
|
||||
|
||||
private ActivityStackGraphCreator() {
|
||||
private ActivityStackGraph() {
|
||||
throw new IllegalStateException("Utility Class");
|
||||
}
|
||||
|
||||
public static String[] createSeries(TreeMap<Long, Map<String, Set<UUID>>> activityData) {
|
||||
String[] sliceNames = ActivityPieCreator.getSliceNames();
|
||||
String[] sliceNames = ActivityPie.getSliceNames();
|
||||
String[] colors = Theme.getValue(ThemeVal.GRAPH_ACTIVITY_PIE).split(", ");
|
||||
int maxCol = colors.length;
|
||||
|
@ -19,12 +19,12 @@ import java.util.stream.Collectors;
|
||||
* @author Rsl1122
|
||||
* @since 3.6.0
|
||||
*/
|
||||
public class PunchCardGraphCreator {
|
||||
public class PunchCardGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private PunchCardGraphCreator() {
|
||||
private PunchCardGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ public class PunchCardGraphCreator {
|
||||
* @param sessions Sessions (Unique/Player) to be placed into the PunchCard.
|
||||
* @return Data array as a string.
|
||||
*/
|
||||
public static String createDataSeries(Collection<Session> sessions) {
|
||||
public static String createSeries(Collection<Session> sessions) {
|
||||
List<Long> sessionStarts = getSessionStarts(sessions);
|
||||
List<int[]> daysAndHours = AnalysisUtils.getDaysAndHours(sessionStarts);
|
||||
int[][] dataArray = createDataArray(daysAndHours);
|
||||
int[][] dataArray = turnIntoArray(daysAndHours);
|
||||
int big = findBiggestValue(dataArray);
|
||||
int[][] scaled = scale(dataArray, big);
|
||||
StringBuilder arrayBuilder = new StringBuilder("[");
|
||||
@ -62,7 +62,7 @@ public class PunchCardGraphCreator {
|
||||
return arrayBuilder.toString();
|
||||
}
|
||||
|
||||
private static int[][] createDataArray(List<int[]> daysAndHours) {
|
||||
private static int[][] turnIntoArray(List<int[]> daysAndHours) {
|
||||
int[][] dataArray = createEmptyArray();
|
||||
for (int[] dAndH : daysAndHours) {
|
||||
int d = dAndH[0];
|
@ -4,12 +4,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorldMapCreator {
|
||||
public class WorldMap {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private WorldMapCreator() {
|
||||
private WorldMap() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ public class WorldMapCreator {
|
||||
* @param geoLocations The country names of players
|
||||
* @return The created data series
|
||||
*/
|
||||
public static String createDataSeries(List<String> geoLocations) {
|
||||
public static String createSeries(List<String> geoLocations) {
|
||||
|
||||
Map<String, Integer> geoCodeCounts = new HashMap<>();
|
||||
Map<String, String> geoCodes = getGeoCodes(geoCodeCounts);
|
@ -6,19 +6,19 @@ import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CPUGraphCreator {
|
||||
public class CPUGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private CPUGraphCreator() {
|
||||
private CPUGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
public static String createSeries(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getCPUUsage()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
}
|
||||
}
|
@ -5,7 +5,9 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.utilities.html.graphs.line;
|
||||
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.DouglasPeuckerAlgorithm;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.ReduceGapTriangles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -15,26 +17,26 @@ import java.util.List;
|
||||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class SeriesCreator {
|
||||
public class LineSeries {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private SeriesCreator() {
|
||||
private LineSeries() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String seriesGraph(List<Point> points, boolean reduceGapTriangles) {
|
||||
return seriesGraph(points, reduceGapTriangles, true);
|
||||
public static String createSeries(List<Point> points, boolean reduceGapTriangles) {
|
||||
return createSeries(points, reduceGapTriangles, true);
|
||||
}
|
||||
|
||||
public static String seriesGraph(List<Point> points, boolean reduceGapTriangles, boolean reducePoints) {
|
||||
public static String createSeries(List<Point> points, boolean reduceGapTriangles, boolean reducePoints) {
|
||||
StringBuilder arrayBuilder = new StringBuilder("[");
|
||||
|
||||
// if (reducePoints) {
|
||||
// points = DouglasPeuckerAlgorithm.reducePoints(points, 0);
|
||||
// }
|
||||
|
||||
//
|
||||
// if (reduceGapTriangles) {
|
||||
// points = ReduceGapTriangles.reduce(points);
|
||||
// }
|
@ -9,19 +9,19 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class PlayerActivityGraphCreator {
|
||||
public class PlayerActivityGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private PlayerActivityGraphCreator() {
|
||||
private PlayerActivityGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
public static String createSeries(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getPlayers()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
}
|
||||
}
|
@ -14,12 +14,12 @@ import java.util.stream.Collectors;
|
||||
* @see TPSCountTimer
|
||||
* @since 3.6.0
|
||||
*/
|
||||
public class RamGraphCreator {
|
||||
public class RamGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private RamGraphCreator() {
|
||||
private RamGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@ -29,10 +29,10 @@ public class RamGraphCreator {
|
||||
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
|
||||
* @return Series data for HighCharts
|
||||
*/
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
public static String createSeries(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getUsedMemory()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
}
|
||||
}
|
@ -5,13 +5,13 @@ import main.java.com.djrapitops.plan.data.time.WorldTimes;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ServerPreferencePieCreator {
|
||||
public class ServerPreferencePie {
|
||||
|
||||
private ServerPreferencePieCreator() {
|
||||
private ServerPreferencePie() {
|
||||
throw new IllegalStateException("Utility Class");
|
||||
}
|
||||
|
||||
public static String createSeriesData(Map<UUID, String> serverNames, Map<UUID, WorldTimes> serverWorldTimes) {
|
||||
public static String createSeries(Map<UUID, String> serverNames, Map<UUID, WorldTimes> serverWorldTimes) {
|
||||
StringBuilder seriesBuilder = new StringBuilder("[");
|
||||
int i = 0;
|
||||
int size = serverWorldTimes.size();
|
@ -11,27 +11,20 @@ import java.util.stream.Collectors;
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class TPSGraphCreator {
|
||||
public class TPSGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private TPSGraphCreator() {
|
||||
private TPSGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
public static String createSeries(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getTicksPerSecond()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
|
||||
}
|
||||
|
||||
public static List<TPS> filterTPS(List<TPS> tpsData, long nowMinusScale) {
|
||||
return tpsData.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(t -> t.getDate() >= nowMinusScale)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -14,12 +14,12 @@ import java.util.stream.Collectors;
|
||||
* @see TPSCountTimer
|
||||
* @since 3.6.0
|
||||
*/
|
||||
public class WorldLoadGraphCreator {
|
||||
public class WorldLoadGraph {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private WorldLoadGraphCreator() {
|
||||
private WorldLoadGraph() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@ public class WorldLoadGraphCreator {
|
||||
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
|
||||
* @return Series data for HighCharts
|
||||
*/
|
||||
public static String buildSeriesDataStringEntities(List<TPS> tpsData) {
|
||||
public static String createSeriesEntities(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getEntityCount()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,10 +42,10 @@ public class WorldLoadGraphCreator {
|
||||
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
|
||||
* @return Series data for HighCharts
|
||||
*/
|
||||
public static String buildSeriesDataStringChunks(List<TPS> tpsData) {
|
||||
public static String createSeriesChunks(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getChunksLoaded()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
return LineSeries.createSeries(points, true);
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@ import java.util.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ActivityPieCreator {
|
||||
public class ActivityPie {
|
||||
|
||||
private ActivityPieCreator() {
|
||||
private ActivityPie() {
|
||||
throw new IllegalStateException("Utility Class");
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class ActivityPieCreator {
|
||||
return new String[]{"Very Active", "Active", "Regular", "Irregular", "Inactive"};
|
||||
}
|
||||
|
||||
public static String createSeriesData(Map<String, Set<UUID>> activityData) {
|
||||
public static String createSeries(Map<String, Set<UUID>> activityData) {
|
||||
String[] colors = Theme.getValue(ThemeVal.GRAPH_ACTIVITY_PIE).split(", ");
|
||||
int maxCol = colors.length;
|
||||
|
||||
@ -38,6 +38,6 @@ public class ActivityPieCreator {
|
||||
i++;
|
||||
}
|
||||
|
||||
return PieSeriesCreator.createSeriesData(slices);
|
||||
return PieSeries.createSeries(slices);
|
||||
}
|
||||
}
|
@ -11,12 +11,12 @@ import java.util.List;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class PieSeriesCreator {
|
||||
private PieSeriesCreator() {
|
||||
public class PieSeries {
|
||||
private PieSeries() {
|
||||
throw new IllegalStateException("Utility Class");
|
||||
}
|
||||
|
||||
public static String createSeriesData(List<PieSlice> slices) {
|
||||
public static String createSeries(List<PieSlice> slices) {
|
||||
StringBuilder seriesBuilder = new StringBuilder("[");
|
||||
int i = 0;
|
||||
int size = slices.size();
|
@ -12,9 +12,9 @@ import main.java.com.djrapitops.plan.utilities.comparators.PieSliceComparator;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WorldPieCreator {
|
||||
public class WorldPie {
|
||||
|
||||
private WorldPieCreator() {
|
||||
private WorldPie() {
|
||||
throw new IllegalStateException("Utility Class");
|
||||
}
|
||||
|
||||
@ -24,21 +24,21 @@ public class WorldPieCreator {
|
||||
* @param worldTimes WorldTimes object.
|
||||
* @return String array, index 0: Series data, 1: drilldown data
|
||||
*/
|
||||
public static String[] createSeriesData(WorldTimes worldTimes) {
|
||||
List<PieSlice> slices = turnToSlices(worldTimes);
|
||||
public static String[] createSeries(WorldTimes worldTimes) {
|
||||
List<PieSlice> slices = turnIntoSlices(worldTimes);
|
||||
|
||||
if (Settings.ORDER_WORLD_PIE_BY_PERC.isTrue()) {
|
||||
slices.sort(new PieSliceComparator());
|
||||
}
|
||||
|
||||
String seriesData = PieSeriesCreator.createSeriesData(slices);
|
||||
String seriesData = PieSeries.createSeries(slices);
|
||||
|
||||
String drilldownData = createDrilldownData(worldTimes);
|
||||
String drilldownData = createDrilldown(worldTimes);
|
||||
|
||||
return new String[]{seriesData, drilldownData};
|
||||
}
|
||||
|
||||
private static List<PieSlice> turnToSlices(WorldTimes worldTimes) {
|
||||
private static List<PieSlice> turnIntoSlices(WorldTimes worldTimes) {
|
||||
String[] colors = Theme.getValue(ThemeVal.GRAPH_WORLD_PIE).split(", ");
|
||||
int colLenght = colors.length;
|
||||
|
||||
@ -90,7 +90,7 @@ public class WorldPieCreator {
|
||||
return playtimePerAlias;
|
||||
}
|
||||
|
||||
private static String createDrilldownData(WorldTimes worldTimes) {
|
||||
private static String createDrilldown(WorldTimes worldTimes) {
|
||||
StringBuilder drilldownBuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
|
@ -13,7 +13,7 @@ import main.java.com.djrapitops.plan.settings.theme.ThemeVal;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -66,7 +66,7 @@ public class ServerAccordionCreator {
|
||||
String worldId = "worldPieServer" + sanitizedServerName;
|
||||
AnalysisUtils.addMissingWorlds(worldTimes);
|
||||
|
||||
String[] worldData = WorldPieCreator.createSeriesData(worldTimes);
|
||||
String[] worldData = WorldPie.createSeries(worldTimes);
|
||||
|
||||
// Accordion panel header
|
||||
html.append("<div class=\"panel panel-col-").append(Theme.getValue(ThemeVal.PARSED_SERVER_ACCORDION)).append("\">")
|
||||
|
@ -15,7 +15,7 @@ import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.KillsTableCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
|
||||
|
||||
@ -86,7 +86,7 @@ public class SessionTabStructureCreator {
|
||||
WorldTimes worldTimes = session.getWorldTimes();
|
||||
AnalysisUtils.addMissingWorlds(worldTimes);
|
||||
|
||||
String[] worldData = WorldPieCreator.createSeriesData(worldTimes);
|
||||
String[] worldData = WorldPie.createSeries(worldTimes);
|
||||
|
||||
String killTable = KillsTableCreator.createTable(session.getPlayerKills());
|
||||
|
||||
|
@ -14,7 +14,7 @@ import main.java.com.djrapitops.plan.systems.cache.SessionCache;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -113,7 +113,7 @@ public class SessionsTableCreator {
|
||||
|
||||
Map<String, Long> playtimePerWorld = session.getWorldTimes().getWorldTimes().entrySet().stream()
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getTotal()));
|
||||
Map<String, Long> playtimePerAlias = WorldPieCreator.transformToAliases(playtimePerWorld, aliases);
|
||||
Map<String, Long> playtimePerAlias = WorldPie.transformToAliases(playtimePerWorld, aliases);
|
||||
|
||||
WorldTimes worldTimes = session.getWorldTimes();
|
||||
long total = worldTimes.getTotal();
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: main.java.com.djrapitops.plan.PlanBungee
|
||||
version: 4.1.3
|
||||
version: 4.1.3.1
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: main.java.com.djrapitops.plan.Plan
|
||||
version: 4.1.3
|
||||
version: 4.1.3.1
|
||||
softdepend:
|
||||
- EssentialsX
|
||||
- Towny
|
||||
|
@ -69,7 +69,7 @@ public class DatabaseTest {
|
||||
TestInit t = TestInit.init();
|
||||
plan = t.getPlanMock();
|
||||
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime());
|
||||
db = new SQLiteDB("debug" + MiscUtils.getTime());
|
||||
db.init();
|
||||
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
@ -132,12 +132,12 @@ public class DatabaseTest {
|
||||
|
||||
@Test
|
||||
public void testMySQLGetConfigName() {
|
||||
assertEquals("mysql", new MySQLDB(plan).getConfigName());
|
||||
assertEquals("mysql", new MySQLDB().getConfigName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMySQLGetName() {
|
||||
assertEquals("MySQL", new MySQLDB(plan).getName());
|
||||
assertEquals("MySQL", new MySQLDB().getName());
|
||||
}
|
||||
|
||||
@Test(timeout = 3000)
|
||||
@ -776,7 +776,7 @@ public class DatabaseTest {
|
||||
|
||||
@Test
|
||||
public void testBackupAndRestore() throws SQLException, DatabaseInitException {
|
||||
SQLiteDB backup = new SQLiteDB(plan, "debug-backup" + MiscUtils.getTime());
|
||||
SQLiteDB backup = new SQLiteDB("debug-backup" + MiscUtils.getTime());
|
||||
backup.init();
|
||||
|
||||
saveAllData(db);
|
||||
|
@ -8,7 +8,7 @@ import main.java.com.djrapitops.plan.data.container.Session;
|
||||
import main.java.com.djrapitops.plan.data.container.TPS;
|
||||
import main.java.com.djrapitops.plan.data.time.WorldTimes;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
|
||||
import main.java.com.djrapitops.plan.utilities.html.graphs.line.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -54,34 +54,34 @@ public class GraphTest {
|
||||
@Test
|
||||
public void testGraphCreators() {
|
||||
String expected = "[[0,0.0],[1,1.0],[2,2.0],[3,3.0],[4,4.0],[5,5.0],[6,6.0],[7,7.0],[8,8.0],[9,9.0]]";
|
||||
assertEquals(expected, CPUGraphCreator.buildSeriesDataString(tpsList));
|
||||
assertEquals(expected, PlayerActivityGraphCreator.buildSeriesDataString(tpsList));
|
||||
assertEquals(expected, CPUGraph.createSeries(tpsList));
|
||||
assertEquals(expected, PlayerActivityGraph.createSeries(tpsList));
|
||||
// TODO Fix TimeZone Dependency of this test
|
||||
// assertEquals("[{x:3600000, y:3, z:14, marker: { radius:14}},]", PunchCardGraphCreator.createDataSeries(sessionList));
|
||||
// assertEquals("[{x:3600000, y:3, z:14, marker: { radius:14}},]", PunchCardGraph.createSeries(sessionList));
|
||||
|
||||
assertEquals(expected, RamGraphCreator.buildSeriesDataString(tpsList));
|
||||
assertEquals(expected, TPSGraphCreator.buildSeriesDataString(tpsList));
|
||||
assertEquals(expected, WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsList));
|
||||
assertEquals(expected, WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsList));
|
||||
// assertEquals("[{'code':'1','value':1},{'code':'2','value':2},{'code':'3','value':3},{'code':'4','value':4},{'code':'5','value':5},{'code':'6','value':6},{'code':'7','value':7},{'code':'8','value':8},{'code':'9','value':9}]", WorldMapCreator.createDataSeries(geoList));
|
||||
assertEquals(expected, RamGraph.createSeries(tpsList));
|
||||
assertEquals(expected, TPSGraph.createSeries(tpsList));
|
||||
assertEquals(expected, WorldLoadGraph.createSeriesChunks(tpsList));
|
||||
assertEquals(expected, WorldLoadGraph.createSeriesEntities(tpsList));
|
||||
// assertEquals("[{'code':'1','value':1},{'code':'2','value':2},{'code':'3','value':3},{'code':'4','value':4},{'code':'5','value':5},{'code':'6','value':6},{'code':'7','value':7},{'code':'8','value':8},{'code':'9','value':9}]", WorldMap.createSeries(geoList));
|
||||
// TODO fix config mock dependency
|
||||
// assertEquals("[[{name:'WORLD',y:0,drilldown: 'WORLD'}], [{name:'WORLD', id:'WORLD',colors: gmPieColors,data: [['SURVIVAL',0],['SPECTATOR',0],['CREATIVE',0],['ADVENTURE',0]]}]]",
|
||||
// Arrays.toString(WorldPieCreator.createSeriesData(worldTimes)));
|
||||
// Arrays.toString(WorldPie.createSeries(worldTimes)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGraphCreatorsForBracketMistakes() {
|
||||
String[] series = new String[]{
|
||||
CPUGraphCreator.buildSeriesDataString(tpsList),
|
||||
PlayerActivityGraphCreator.buildSeriesDataString(tpsList),
|
||||
PunchCardGraphCreator.createDataSeries(sessionList),
|
||||
RamGraphCreator.buildSeriesDataString(tpsList),
|
||||
TPSGraphCreator.buildSeriesDataString(tpsList),
|
||||
WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsList),
|
||||
WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsList),
|
||||
// WorldMapCreator.createDataSeries(geoList),
|
||||
CPUGraph.createSeries(tpsList),
|
||||
PlayerActivityGraph.createSeries(tpsList),
|
||||
PunchCardGraph.createSeries(sessionList),
|
||||
RamGraph.createSeries(tpsList),
|
||||
TPSGraph.createSeries(tpsList),
|
||||
WorldLoadGraph.createSeriesChunks(tpsList),
|
||||
WorldLoadGraph.createSeriesEntities(tpsList),
|
||||
// WorldMap.createSeries(geoList),
|
||||
// TODO fix config mock dependency
|
||||
// Arrays.toString(WorldPieCreator.createSeriesData(worldTimes))
|
||||
// Arrays.toString(WorldPie.createSeries(worldTimes))
|
||||
};
|
||||
for (String test : series) {
|
||||
int opened = StringUtils.countMatches(test, "{");
|
||||
@ -95,7 +95,7 @@ public class GraphTest {
|
||||
|
||||
@Test
|
||||
public void testSeriesCreator() {
|
||||
String result = StringUtils.removeAll(SeriesCreator.seriesGraph(points, false, false), "[\\[\\]]");
|
||||
String result = StringUtils.removeAll(LineSeries.createSeries(points, false, false), "[\\[\\]]");
|
||||
String[] splittedResult = result.split(",");
|
||||
|
||||
Map<String, String> expected = new LinkedHashMap<>();
|
||||
|
@ -163,7 +163,7 @@ public class MiscUtilsTest {
|
||||
TestInit t = TestInit.init();
|
||||
Plan plan = t.getPlanMock();
|
||||
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime());
|
||||
db = new SQLiteDB("debug" + MiscUtils.getTime());
|
||||
db.init();
|
||||
|
||||
db.getServerTable().saveCurrentServerInfo(new ServerInfo(-1, TestInit.getServerUUID(), "ServerName", "", 20));
|
||||
|
Loading…
Reference in New Issue
Block a user