Merge remote-tracking branch 'origin/4.2.0-refactoring' into 4.2.0-refactoring

# Conflicts:
#	Plan/src/main/java/com/djrapitops/plan/Plan.java
#	Plan/src/main/java/com/djrapitops/plan/PlanBungee.java
#	Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java
#	Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/PlayersPageResponse.java
#	Plan/src/main/java/com/djrapitops/plan/systems/Systems.java
#	Plan/src/main/java/com/djrapitops/plan/systems/info/server/BungeeServerInfoManager.java
#	Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java
This commit is contained in:
Rsl1122 2018-01-13 13:20:25 +02:00
commit c01094d2c3
87 changed files with 436 additions and 585 deletions

View File

@ -28,6 +28,13 @@ import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.settings.theme.PlanColorScheme;
import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.settings.Settings;
@ -48,6 +55,9 @@ import com.djrapitops.plan.systems.listeners.*;
import com.djrapitops.plan.systems.processing.Processor;
import com.djrapitops.plan.systems.processing.importing.importers.OfflinePlayerImporter;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.systems.webserver.WebServer;
import com.djrapitops.plan.systems.webserver.WebServerSystem;
import com.djrapitops.plan.systems.webserver.pagecache.PageCache;
import com.djrapitops.plan.utilities.file.export.HtmlExport;
import com.djrapitops.plan.utilities.metrics.BStats;
import com.djrapitops.plugin.BukkitPlugin;

View File

@ -10,6 +10,8 @@ import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.settings.theme.PlanColorScheme;
import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.settings.Settings;
@ -19,12 +21,16 @@ 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.file.database.DBSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
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;
import com.djrapitops.plan.systems.listeners.BungeePlayerListener;
import com.djrapitops.plan.systems.processing.Processor;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.systems.webserver.WebServer;
import com.djrapitops.plan.systems.webserver.WebServerSystem;
import com.djrapitops.plan.utilities.file.export.HtmlExport;
import com.djrapitops.plugin.BungeePlugin;
import com.djrapitops.plugin.StaticHolder;

View File

@ -4,7 +4,7 @@
*/
package com.djrapitops.plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.webserver.WebServer;
import com.djrapitops.plan.systems.Systems;

View File

@ -7,9 +7,9 @@ package com.djrapitops.plan;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.database.tables.SessionsTable;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.SessionsTable;
import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.cache.SessionCache;
import com.djrapitops.plan.utilities.MiscUtils;

View File

@ -2,9 +2,10 @@ package com.djrapitops.plan.command.commands;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.data.element.ActivityIndex;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.MiscUtils;
@ -100,9 +101,9 @@ public class QInspectCommand extends SubCommand {
sender.sendMessage(Locale.get(Msg.CMD_HEADER_INSPECT).toString() + ": " + colT + profile.getName());
double activityIndex = profile.getActivityIndex(now);
ActivityIndex activityIndex = profile.getActivityIndex(now);
sender.sendMessage(colT + ball + " " + colM + " Activity Index: " + colS + FormatUtils.cutDecimals(activityIndex) + " | " + FormatUtils.readableActivityIndex(activityIndex)[1]);
sender.sendMessage(colT + ball + " " + colM + " Activity Index: " + colS + activityIndex.getFormattedValue() + " | " + activityIndex.getColor());
sender.sendMessage(colT + ball + " " + colM + " Registered: " + colS + FormatUtils.formatTimeStampYear(profile.getRegistered()));
sender.sendMessage(colT + ball + " " + colM + " Last Seen: " + colS + FormatUtils.formatTimeStampYear(profile.getLastSeen()));
sender.sendMessage(colT + ball + " " + colM + " Logged in from: " + colS + profile.getMostRecentGeoInfo().getGeolocation());

View File

@ -2,10 +2,10 @@ package com.djrapitops.plan.command.commands;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.WebUser;
import com.djrapitops.plan.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.PassEncryptUtil;
import com.djrapitops.plugin.api.Check;

View File

@ -2,10 +2,10 @@ package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.ManageUtils;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -3,10 +3,10 @@ package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.cache.SessionCache;
import com.djrapitops.plan.utilities.Condition;

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.ManageUtils;
import com.djrapitops.plugin.api.config.Config;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.ManageUtils;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLiteDB;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.SQLiteDB;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.ManageUtils;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -2,10 +2,10 @@ package com.djrapitops.plan.command.commands.webuser;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.WebUser;
import com.djrapitops.plan.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.command.CommandType;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.command.commands.webuser;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.tables.SecurityTable;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.command.CommandType;

View File

@ -4,16 +4,16 @@
*/
package com.djrapitops.plan.data;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.data.container.GeoInfo;
import com.djrapitops.plan.data.container.PlayerKill;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.data.element.ActivityIndex;
import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.comparators.ActionComparator;
import com.djrapitops.plan.utilities.comparators.GeoInfoComparator;
import com.djrapitops.plugin.api.TimeAmount;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@ -57,7 +57,7 @@ public class PlayerProfile implements OfflinePlayer {
private Map<String, String> pluginReplaceMap;
// Value that requires lot of processing
private Map<Long, Double> activityIndex;
private Map<Long, ActivityIndex> activityIndexCache;
public PlayerProfile(UUID uuid, String name, long registered) {
this.uuid = uuid;
@ -76,88 +76,17 @@ public class PlayerProfile implements OfflinePlayer {
geoInformation = new ArrayList<>();
pluginReplaceMap = new HashMap<>();
activityIndex = new HashMap<>();
activityIndexCache = new HashMap<>();
}
// Calculating Getters
public double getActivityIndex(long date) {
Double activityIndx = activityIndex.get(date);
if (activityIndx != null) {
return activityIndx;
public ActivityIndex getActivityIndex(long date) {
ActivityIndex index = activityIndexCache.get(date);
if (index == null) {
index = new ActivityIndex(this, date);
activityIndexCache.put(date, index);
}
long week = TimeAmount.WEEK.ms();
long weekAgo = date - week;
long twoWeeksAgo = date - 2L * week;
long threeWeeksAgo = date - 3L * week;
long activePlayThreshold = Settings.ACTIVE_PLAY_THRESHOLD.getNumber() * TimeAmount.MINUTE.ms();
if (activePlayThreshold <= 0) {
activePlayThreshold = 1;
}
int activeLoginThreshold = Settings.ACTIVE_LOGIN_THRESHOLD.getNumber();
if (activeLoginThreshold <= 0) {
activeLoginThreshold = 1;
}
List<Session> sessionsWeek = getSessions(weekAgo, date).collect(Collectors.toList());
List<Session> sessionsWeek2 = getSessions(twoWeeksAgo, weekAgo).collect(Collectors.toList());
List<Session> sessionsWeek3 = getSessions(threeWeeksAgo, twoWeeksAgo).collect(Collectors.toList());
// Playtime per week multipliers, max out to avoid too high values.
double max = 4.0;
long playtimeWeek = PlayerProfile.getPlaytime(sessionsWeek.stream());
double weekPlay = (playtimeWeek * 1.0 / activePlayThreshold);
if (weekPlay > max) {
weekPlay = max;
}
long playtimeWeek2 = PlayerProfile.getPlaytime(sessionsWeek2.stream());
double week2Play = (playtimeWeek2 * 1.0 / activePlayThreshold);
if (week2Play > max) {
week2Play = max;
}
long playtimeWeek3 = PlayerProfile.getPlaytime(sessionsWeek3.stream());
double week3Play = (playtimeWeek3 * 1.0 / activePlayThreshold);
if (week3Play > max) {
week3Play = max;
}
double playtimeMultiplier = 1.0;
if (playtimeWeek + playtimeWeek2 + playtimeWeek3 > activeLoginThreshold * 3.0) {
playtimeMultiplier = 1.25;
}
// Reduce the harshness for new players and players who have had a vacation
if (weekPlay > 1 && week3Play > 1 && week2Play == 0.0) {
week2Play = 0.5;
}
if (weekPlay > 1 && week2Play == 0.0) {
week2Play = 0.6;
}
if (weekPlay > 1 && week3Play == 0.0) {
week3Play = 0.75;
}
double playAvg = (weekPlay + week2Play + week3Play) / 3.0;
double weekLogin = sessionsWeek.size() >= activeLoginThreshold ? 1.0 : 0.5;
double week2Login = sessionsWeek2.size() >= activeLoginThreshold ? 1.0 : 0.5;
double week3Login = sessionsWeek3.size() >= activeLoginThreshold ? 1.0 : 0.5;
double loginMultiplier = 1.0;
double loginTotal = weekLogin + week2Login + week3Login;
double loginAvg = loginTotal / 3.0;
if (loginTotal <= 2.0) {
// Reduce index for players that have not logged in the threshold amount for 2 weeks
loginMultiplier = 0.75;
}
activityIndx = playAvg * loginAvg * loginMultiplier * playtimeMultiplier;
activityIndex.put(date, activityIndx);
return activityIndx;
return index;
}
/**

View File

@ -5,7 +5,7 @@
package com.djrapitops.plan.data.container;
import com.djrapitops.plan.data.HasDate;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.html.Html;

View File

@ -2,7 +2,7 @@ package com.djrapitops.plan.data.container;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.HasDate;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.Actions;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.Objects;

View File

@ -5,7 +5,7 @@
package com.djrapitops.plan.data.container;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plugin.api.TimeAmount;
import com.google.common.base.Objects;
@ -15,7 +15,7 @@ public class StickyData {
private Integer onlineOnJoin;
public StickyData(PlayerProfile player) {
activityIndex = player.getActivityIndex(player.getRegistered() + TimeAmount.DAY.ms());
activityIndex = player.getActivityIndex(player.getRegistered() + TimeAmount.DAY.ms()).getValue();
for (Action action : player.getActions()) {
if (messagesSent == null && action.getDoneAction() == Actions.FIRST_LOGOUT) {
String additionalInfo = action.getAdditionalInfo();

View File

@ -0,0 +1,131 @@
package com.djrapitops.plan.data.element;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plugin.api.TimeAmount;
import java.util.List;
import java.util.stream.Collectors;
public class ActivityIndex {
private static long loadSetting(long value) {
return value < 0 ? 1 : value;
}
private final double value;
public ActivityIndex(PlayerProfile player, long date) {
value = calculate(player, date);
}
private double calculate(PlayerProfile player, long date) {
long week = TimeAmount.WEEK.ms();
long weekAgo = date - week;
long twoWeeksAgo = date - 2L * week;
long threeWeeksAgo = date - 3L * week;
long activePlayThreshold = Settings.ACTIVE_PLAY_THRESHOLD.getNumber() * TimeAmount.MINUTE.ms();
if (activePlayThreshold <= 0) {
activePlayThreshold = 1;
}
int activeLoginThreshold = Settings.ACTIVE_LOGIN_THRESHOLD.getNumber();
if (activeLoginThreshold <= 0) {
activeLoginThreshold = 1;
}
List<Session> sessionsWeek = player.getSessions(weekAgo, date).collect(Collectors.toList());
List<Session> sessionsWeek2 = player.getSessions(twoWeeksAgo, weekAgo).collect(Collectors.toList());
List<Session> sessionsWeek3 = player.getSessions(threeWeeksAgo, twoWeeksAgo).collect(Collectors.toList());
// Playtime per week multipliers, max out to avoid too high values.
double max = 4.0;
long playtimeWeek = PlayerProfile.getPlaytime(sessionsWeek.stream());
double weekPlay = (playtimeWeek * 1.0 / activePlayThreshold);
if (weekPlay > max) {
weekPlay = max;
}
long playtimeWeek2 = PlayerProfile.getPlaytime(sessionsWeek2.stream());
double week2Play = (playtimeWeek2 * 1.0 / activePlayThreshold);
if (week2Play > max) {
week2Play = max;
}
long playtimeWeek3 = PlayerProfile.getPlaytime(sessionsWeek3.stream());
double week3Play = (playtimeWeek3 * 1.0 / activePlayThreshold);
if (week3Play > max) {
week3Play = max;
}
double playtimeMultiplier = 1.0;
if (playtimeWeek + playtimeWeek2 + playtimeWeek3 > activePlayThreshold * 3.0) {
playtimeMultiplier = 1.25;
}
// Reduce the harshness for new players and players who have had a vacation
if (weekPlay > 1 && week3Play > 1 && week2Play == 0.0) {
week2Play = 0.5;
}
if (weekPlay > 1 && week2Play == 0.0) {
week2Play = 0.6;
}
if (weekPlay > 1 && week3Play == 0.0) {
week3Play = 0.75;
}
double playAvg = (weekPlay + week2Play + week3Play) / 3.0;
double weekLogin = sessionsWeek.size() >= activeLoginThreshold ? 1.0 : 0.5;
double week2Login = sessionsWeek2.size() >= activeLoginThreshold ? 1.0 : 0.5;
double week3Login = sessionsWeek3.size() >= activeLoginThreshold ? 1.0 : 0.5;
double loginMultiplier = 1.0;
double loginTotal = weekLogin + week2Login + week3Login;
double loginAvg = loginTotal / 3.0;
if (loginTotal <= 2.0) {
// Reduce index for players that have not logged in the threshold amount for 2 weeks
loginMultiplier = 0.75;
}
return playAvg * loginAvg * loginMultiplier * playtimeMultiplier;
}
public double getValue() {
return value;
}
public String getFormattedValue() {
return FormatUtils.cutDecimals(value);
}
public String getGroup() {
if (value >= 3.5) {
return "Very Active";
} else if (value >= 1.75) {
return "Active";
} else if (value >= 1.0) {
return "Regular";
} else if (value >= 0.5) {
return "Irregular";
} else {
return "Inactive";
}
}
public String getColor() {
if (value >= 3.5) {
return "green";
} else if (value >= 1.75) {
return "green";
} else if (value >= 1.0) {
return "lime";
} else if (value >= 0.5) {
return "amber";
} else {
return "blue-gray";
}
}
}

View File

@ -155,7 +155,7 @@ public class HealthNotes {
private void activePlayerPlaytimeChange() {
List<PlayerProfile> currentActivePlayers = analysisData.getPlayers().stream()
.filter(player -> player.getActivityIndex(now) >= 1.75)
.filter(player -> player.getActivityIndex(now).getValue() >= 1.75)
.collect(Collectors.toList());
long twoWeeksAgo = now - TimeAmount.WEEK.ms() * 2L;

View File

@ -1,43 +0,0 @@
package com.djrapitops.plan.database;
/**
* Class to contain objects in the batches.
*
* @param <T> Object stored.
* @author Rsl1122
* @since 3.4.3
*/
public class Container<T> {
private final T object;
private final int id;
/**
* Constructor for the object.
*
* @param object Object to place inside the container.
* @param id UserID related to the object.
*/
public Container(T object, int id) {
this.object = object;
this.id = id;
}
/**
* Get the object in the container.
*
* @return object.
*/
public T getObject() {
return object;
}
/**
* Get the UserID related to the object.
*
* @return userID
*/
public int getId() {
return id;
}
}

View File

@ -1,110 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.djrapitops.plan.database;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* Class containing static utility methods used by the Database classes.
*
* @author Rsl1122
* @since 3.4.3
*/
public class DBUtils {
private static final int BATCH_SIZE = 10192;
/**
* Constructor used to hide the public constructor
*/
private DBUtils() {
throw new IllegalStateException("Utility class");
}
/**
* Splits a collection of objects into lists with the size defined by
* BATCH_SIZE.
*
* @param <T> Object type
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<T>> splitIntoBatches(Collection<T> objects) {
List<List<T>> batches = new ArrayList<>();
int i = 0;
int j = 0;
for (T obj : objects) {
if (batches.size() <= j) {
batches.add(new ArrayList<>());
}
batches.get(j).add(obj);
i++;
if (i % BATCH_SIZE == 0) {
j++;
}
}
return batches;
}
/**
* @param <T> Object type
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<Container<T>>> splitIntoBatchesId(Map<Integer, List<T>> objects) {
List<List<Container<T>>> wrappedBatches = new ArrayList<>();
int i = 0;
int j = 0;
for (Entry<Integer, List<T>> entry : objects.entrySet()) {
for (T object : entry.getValue()) {
if (wrappedBatches.size() <= j) {
wrappedBatches.add(new ArrayList<>());
}
wrappedBatches.get(j).add(new Container<>(object, entry.getKey()));
i++;
if (i % BATCH_SIZE == 0) {
j++;
}
}
}
return wrappedBatches;
}
/**
* @param <T> Object type
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<Container<T>>> splitIntoBatchesWithID(Map<Integer, T> objects) {
List<List<Container<T>>> wrappedBatches = new ArrayList<>();
int i = 0;
int j = 0;
for (Entry<Integer, T> entry : objects.entrySet()) {
T object = entry.getValue();
if (wrappedBatches.size() <= j) {
wrappedBatches.add(new ArrayList<>());
}
wrappedBatches.get(j).add(new Container<>(object, entry.getKey()));
i++;
if (i % BATCH_SIZE == 0) {
j++;
}
}
return wrappedBatches;
}
}

View File

@ -5,10 +5,11 @@
package com.djrapitops.plan.system;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.utilities.NullCheck;
import com.djrapitops.plugin.api.Check;
@ -28,6 +29,7 @@ public abstract class PlanSystem implements SubSystem {
protected VersionCheckSystem versionCheckSystem;
protected FileSystem fileSystem;
protected ConfigSystem configSystem;
protected DBSystem databaseSystem;
public PlanSystem() {
processingQueue = new ProcessingQueue();
@ -59,6 +61,7 @@ public abstract class PlanSystem implements SubSystem {
NullCheck.check(versionCheckSystem, new IllegalStateException("Version Check system was not initialized."));
NullCheck.check(fileSystem, new IllegalStateException("File system was not initialized."));
NullCheck.check(configSystem, new IllegalStateException("Config system was not initialized."));
NullCheck.check(databaseSystem, new IllegalStateException("Database system was not initialized."));
} catch (Exception e) {
throw new EnableException("One of the subsystems is not initialized on enable for " + this.getClass().getSimpleName() + ".", e);
}
@ -94,4 +97,8 @@ public abstract class PlanSystem implements SubSystem {
public FileSystem getFileSystem() {
return fileSystem;
}
public DBSystem getDatabaseSystem() {
return databaseSystem;
}
}

View File

@ -2,11 +2,11 @@
* 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.file.database;
package com.djrapitops.plan.system.database;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.database.databases.MySQLDB;
import com.djrapitops.plan.database.databases.SQLiteDB;
import com.djrapitops.plan.system.database.databases.MySQLDB;
import com.djrapitops.plan.system.database.databases.SQLiteDB;
import com.djrapitops.plan.system.settings.Settings;
/**
@ -14,7 +14,7 @@ import com.djrapitops.plan.system.settings.Settings;
*
* @author Rsl1122
*/
public class PlanDBSystem extends DBSystem {
public class BukkitDBSystem extends DBSystem {
@Override
protected void initDatabase() throws DatabaseInitException {

View File

@ -2,18 +2,17 @@
* 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.file.database;
package com.djrapitops.plan.system.database;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.database.databases.MySQLDB;
import com.djrapitops.plan.system.database.databases.MySQLDB;
/**
* //TODO Class Javadoc Comment
*
* @author Rsl1122
*/
public class PlanBungeeDBSystem extends DBSystem {
public class BungeeDBSystem extends DBSystem {
@Override
protected void initDatabase() throws DatabaseInitException {

View File

@ -2,16 +2,17 @@
* 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.file.database;
package com.djrapitops.plan.system.database;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLDB;
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.systems.Systems;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.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;
@ -35,7 +36,9 @@ public abstract class DBSystem implements SubSystem {
}
public static DBSystem getInstance() {
return Systems.getInstance().getDatabaseSystem();
DBSystem dbSystem = PlanSystem.getInstance().getDatabaseSystem();
NullCheck.check(dbSystem, new IllegalStateException("Database system was not initialized."));
return dbSystem;
}
@Override
@ -77,7 +80,7 @@ public abstract class DBSystem implements SubSystem {
return db;
}
public static SQLDB getActiveDatabase(String dbName) throws DatabaseInitException {
public SQLDB getActiveDatabase(String dbName) throws DatabaseInitException {
for (SQLDB database : DBSystem.getInstance().getDatabases()) {
String dbConfigName = database.getConfigName();
if (Verify.equalsIgnoreCase(dbName, dbConfigName)) {

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.database;
package com.djrapitops.plan.system.database.databases;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.data.ServerProfile;
import com.djrapitops.plan.database.tables.*;
import com.djrapitops.plan.system.database.tables.*;
import org.apache.commons.lang3.StringUtils;
import java.sql.Connection;
@ -38,7 +38,6 @@ public abstract class Database {
protected ServerTable serverTable;
/**
* Super constructor.
*/

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.databases;
package com.djrapitops.plan.system.database.databases;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -1,12 +1,11 @@
package com.djrapitops.plan.database.databases;
package com.djrapitops.plan.system.database.databases;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.data.ServerProfile;
import com.djrapitops.plan.data.container.*;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.tables.*;
import com.djrapitops.plan.database.tables.move.Version8TransferTable;
import com.djrapitops.plan.system.database.tables.*;
import com.djrapitops.plan.system.database.tables.move.Version8TransferTable;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.TimeAmount;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.databases;
package com.djrapitops.plan.system.database.databases;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.utilities.MiscUtils;

View File

@ -2,7 +2,7 @@
* 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.database.processing;
package com.djrapitops.plan.system.database.processing;
import java.sql.PreparedStatement;
import java.sql.SQLException;

View File

@ -2,7 +2,7 @@
* 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.database.processing;
package com.djrapitops.plan.system.database.processing;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -2,7 +2,7 @@
* 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.database.processing;
package com.djrapitops.plan.system.database.processing;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.sql;
package com.djrapitops.plan.system.database.sql;
public class Insert extends SqlParser {

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.sql;
package com.djrapitops.plan.system.database.sql;
public class Select extends WhereParser {

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.sql;
package com.djrapitops.plan.system.database.sql;
public class Sql {
public static final String INT = "integer";

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.sql;
package com.djrapitops.plan.system.database.sql;
/**
* Class for parsing different SQL strings.

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.sql;
package com.djrapitops.plan.system.database.sql;
/**
* SqlParser Class for parsing table creation, removal and modification statements.

View File

@ -2,7 +2,7 @@
* 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.database.sql;
package com.djrapitops.plan.system.database.sql;
/**
* @author Fuzzlemann

View File

@ -2,7 +2,7 @@
* 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.database.sql;
package com.djrapitops.plan.system.database.sql;
/**
* @author Fuzzlemann

View File

@ -2,7 +2,7 @@
* 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.database.tables;
package com.djrapitops.plan.system.database.tables;
import org.apache.commons.lang3.text.WordUtils;

View File

@ -2,18 +2,18 @@
* 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.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,14 +1,14 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -1,14 +1,14 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.GeoInfo;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,14 +1,14 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.PlayerKill;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,13 +1,13 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -3,18 +3,18 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.WebUser;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Insert;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Insert;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -2,14 +2,14 @@
* 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.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.*;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.*;
import com.djrapitops.plan.systems.info.server.ServerInfo;
import com.djrapitops.plugin.utilities.Verify;

View File

@ -1,15 +1,15 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,14 +1,14 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plan.systems.info.server.ServerInfo;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.utilities.Verify;
import com.google.common.base.Objects;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import java.sql.PreparedStatement;
import java.sql.SQLException;

View File

@ -2,20 +2,19 @@
* 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.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.UserInfo;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Select;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.database.sql.Update;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Select;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.sql.Update;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Verify;

View File

@ -1,12 +1,12 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.UserInfo;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.*;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.*;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,12 +1,12 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -1,13 +1,12 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -1,16 +1,16 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.data.time.GMTimes;
import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.processing.ExecStatement;
import com.djrapitops.plan.database.processing.QueryAllStatement;
import com.djrapitops.plan.database.processing.QueryStatement;
import com.djrapitops.plan.database.sql.Sql;
import com.djrapitops.plan.database.sql.TableSqlParser;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.processing.ExecStatement;
import com.djrapitops.plan.system.database.processing.QueryAllStatement;
import com.djrapitops.plan.system.database.processing.QueryStatement;
import com.djrapitops.plan.system.database.sql.Sql;
import com.djrapitops.plan.system.database.sql.TableSqlParser;
import com.djrapitops.plugin.utilities.Verify;
import java.sql.PreparedStatement;

View File

@ -2,14 +2,14 @@
* 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.database.tables.move;
package com.djrapitops.plan.system.database.tables.move;
import com.djrapitops.plan.data.container.UserInfo;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.tables.ServerTable;
import com.djrapitops.plan.database.tables.Table;
import com.djrapitops.plan.database.tables.UsersTable;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.tables.ServerTable;
import com.djrapitops.plan.system.database.tables.Table;
import com.djrapitops.plan.system.database.tables.UsersTable;
import com.djrapitops.plan.systems.info.server.ServerInfo;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -2,12 +2,12 @@
* 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.database.tables.move;
package com.djrapitops.plan.system.database.tables.move;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DBCreateTableException;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.tables.*;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.tables.*;
import com.djrapitops.plugin.api.Benchmark;
import java.sql.SQLException;

View File

@ -22,6 +22,10 @@ import com.djrapitops.plan.system.webserver.response.pages.AnalysisPageResponse;
import com.djrapitops.plan.system.webserver.response.pages.DebugPageResponse;
import com.djrapitops.plan.system.webserver.response.pages.InspectPageResponse;
import com.djrapitops.plan.system.webserver.response.pages.PlayersPageResponse;
import com.djrapitops.plan.system.database.tables.SecurityTable;
import com.djrapitops.plan.systems.webserver.pagecache.PageCache;
import com.djrapitops.plan.systems.webserver.pagecache.PageId;
import com.djrapitops.plan.systems.webserver.response.*;
import com.djrapitops.plan.utilities.PassEncryptUtil;
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -10,6 +10,8 @@ import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.webserver.response.errors.InternalErrorResponse;
import com.djrapitops.plan.system.webserver.response.Response;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import com.djrapitops.plan.utilities.comparators.GeoInfoComparator;

View File

@ -8,6 +8,9 @@ import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanBungee;
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;
@ -17,9 +20,12 @@ import com.djrapitops.plan.system.webserver.WebServerSystem;
import com.djrapitops.plan.systems.file.database.DBSystem;
import com.djrapitops.plan.systems.file.database.PlanBungeeDBSystem;
import com.djrapitops.plan.systems.file.database.PlanDBSystem;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.systems.tasks.PlanBungeeTaskSystem;
import com.djrapitops.plan.systems.tasks.PlanTaskSystem;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.systems.webserver.WebServerSystem;
import com.djrapitops.plugin.api.utility.log.Log;
import org.apache.commons.lang3.ArrayUtils;
@ -49,7 +55,7 @@ public class Systems {
public Systems(Plan plugin) {
fileSystem = new FileSystem(plugin);
configSystem = new BukkitConfigSystem();
databaseSystem = new PlanDBSystem();
databaseSystem = new BukkitDBSystem();
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
taskSystem = new PlanTaskSystem();
@ -66,7 +72,7 @@ public class Systems {
public Systems(PlanBungee plugin) {
fileSystem = new FileSystem(plugin);
configSystem = new BungeeConfigSystem();
databaseSystem = new PlanBungeeDBSystem();
databaseSystem = new BungeeDBSystem();
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
taskSystem = new PlanBungeeTaskSystem();

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.systems.cache;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plugin.api.utility.log.Log;
import java.sql.SQLException;

View File

@ -9,11 +9,12 @@ import com.djrapitops.plan.api.exceptions.ParseException;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.data.element.ActivityIndex;
import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Settings;
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.settings.Settings;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.analysis.AnalysisUtils;
@ -225,12 +226,11 @@ public class InspectPageParser extends PageParser {
addValue("mobKillCount", mobKillCount);
addValue("deathCount", deathCount);
double activityIndex = profile.getActivityIndex(now);
String[] activityIndexFormat = FormatUtils.readableActivityIndex(activityIndex);
ActivityIndex activityIndex = profile.getActivityIndex(now);
addValue("activityIndexNumber", FormatUtils.cutDecimals(activityIndex));
addValue("activityIndexColor", activityIndexFormat[0]);
addValue("activityIndex", activityIndexFormat[1]);
addValue("activityIndexNumber", activityIndex.getFormattedValue());
addValue("activityIndexColor", activityIndex.getColor());
addValue("activityIndex", activityIndex.getGroup());
addValue("playerStatus", HtmlStructure.playerStatus(online, profile.getBannedOnServers(), profile.isOp()));

View File

@ -8,10 +8,10 @@ import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.api.exceptions.ParseException;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Settings;
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.settings.Settings;
import com.djrapitops.plan.systems.info.BungeeInformationManager;
import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.MiscUtils;

View File

@ -8,8 +8,8 @@ package com.djrapitops.plan.systems.info.server;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.ServerVariableHolder;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.tables.ServerTable;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.tables.ServerTable;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -8,6 +8,10 @@ import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.ServerVariableHolder;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.api.exceptions.WebAPIException;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.tables.ServerTable;
import com.djrapitops.plan.systems.webserver.webapi.bukkit.ConfigurationWebAPI;
import com.djrapitops.plan.systems.webserver.webapi.universal.PingWebAPI;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.tables.ServerTable;
import com.djrapitops.plan.system.webserver.webapi.bukkit.ConfigurationWebAPI;

View File

@ -6,7 +6,7 @@ package com.djrapitops.plan.systems.processing;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plan.systems.processing.player.PlayerProcessor;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.html.HtmlUtils;

View File

@ -9,7 +9,7 @@ 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.time.WorldTimes;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.systems.cache.GeolocationCache;
import com.djrapitops.plan.systems.processing.importing.ServerImportData;
import com.djrapitops.plan.systems.processing.importing.UserImportData;

View File

@ -5,7 +5,7 @@
package com.djrapitops.plan.systems.processing.player;
import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.database.tables.UsersTable;
import com.djrapitops.plan.system.database.tables.UsersTable;
import com.djrapitops.plugin.api.utility.log.Log;
import java.sql.SQLException;

View File

@ -6,7 +6,7 @@ package com.djrapitops.plan.systems.processing.player;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plugin.api.utility.log.Log;
import java.sql.SQLException;

View File

@ -5,8 +5,8 @@
package com.djrapitops.plan.systems.processing.player;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.tables.NicknamesTable;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.tables.NicknamesTable;
import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.processing.NewNickActionProcessor;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -6,10 +6,10 @@ package com.djrapitops.plan.systems.processing.player;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.container.Action;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.tables.Actions;
import com.djrapitops.plan.database.tables.UserInfoTable;
import com.djrapitops.plan.database.tables.UsersTable;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.tables.Actions;
import com.djrapitops.plan.system.database.tables.UserInfoTable;
import com.djrapitops.plan.system.database.tables.UsersTable;
import com.djrapitops.plan.systems.processing.Processor;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -214,20 +214,6 @@ public class FormatUtils {
return df.format(d);
}
public static String[] readableActivityIndex(double activityIndex) {
if (activityIndex >= 3.5) {
return new String[]{"green", "Very Active"};
} else if (activityIndex >= 1.75) {
return new String[]{"green", "Active"};
} else if (activityIndex >= 1.0) {
return new String[]{"lime", "Regular"};
} else if (activityIndex >= 0.5) {
return new String[]{"amber", "Irregular"};
} else {
return new String[]{"blue-gray", "Inactive"};
}
}
public static String formatIP(String ip) {
StringBuilder b = new StringBuilder();
int i = 0;

View File

@ -2,10 +2,10 @@ package com.djrapitops.plan.utilities;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLiteDB;
import com.djrapitops.plan.database.tables.move.BatchOperationTable;
import com.djrapitops.plan.systems.file.database.DBSystem;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.SQLiteDB;
import com.djrapitops.plan.system.database.tables.move.BatchOperationTable;
import com.djrapitops.plugin.api.utility.log.Log;
import java.sql.SQLException;

View File

@ -3,11 +3,11 @@ package com.djrapitops.plan.utilities;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plugin.api.Check;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -7,7 +7,6 @@ import com.djrapitops.plan.data.ServerProfile;
import com.djrapitops.plan.data.element.AnalysisContainer;
import com.djrapitops.plan.data.plugin.BanData;
import com.djrapitops.plan.data.plugin.PluginData;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.Msg;
import com.djrapitops.plan.system.settings.Settings;

View File

@ -4,10 +4,9 @@ import com.djrapitops.plan.PlanPlugin;
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.utilities.FormatUtils;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log;
@ -219,13 +218,13 @@ public class AnalysisUtils {
if (!players.isEmpty()) {
for (PlayerProfile player : players) {
for (long date = time; date >= time - TimeAmount.MONTH.ms() * 2L; date -= TimeAmount.WEEK.ms()) {
double activityIndex = player.getActivityIndex(date);
String index = FormatUtils.readableActivityIndex(activityIndex)[1];
ActivityIndex activityIndex = player.getActivityIndex(date);
String activityGroup = activityIndex.getGroup();
Map<String, Set<UUID>> map = activityData.getOrDefault(date, new HashMap<>());
Set<UUID> uuids = map.getOrDefault(index, new HashSet<>());
Set<UUID> uuids = map.getOrDefault(activityGroup, new HashSet<>());
uuids.add(player.getUuid());
map.put(index, uuids);
map.put(activityGroup, uuids);
activityData.put(date, map);
}
}

View File

@ -7,7 +7,7 @@ package com.djrapitops.plan.utilities.html;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.ServerVariableHolder;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.systems.info.BukkitInformationManager;
import com.djrapitops.plan.utilities.FormatUtils;

View File

@ -1,7 +1,9 @@
package com.djrapitops.plan.utilities.html.tables;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.PlayerProfile;
import com.djrapitops.plan.data.element.ActivityIndex;
import com.djrapitops.plan.data.element.AnalysisContainer;
import com.djrapitops.plan.data.element.TableContainer;
import com.djrapitops.plan.data.plugin.PluginData;
@ -55,10 +57,10 @@ public class PlayersTableCreator {
long lastSeen = profile.getLastSeen();
double activityIndex = profile.getActivityIndex(now);
String readableIndex = FormatUtils.readableActivityIndex(activityIndex)[1];
String activityString = FormatUtils.cutDecimals(activityIndex)
+ (isBanned ? " (<b>Banned</b>)" : " (" + readableIndex + ")");
ActivityIndex activityIndex = profile.getActivityIndex(now);
String activityGroup = activityIndex.getGroup();
String activityString = activityIndex.getFormattedValue()
+ (isBanned ? " (<b>Banned</b>)" : " (" + activityGroup + ")");
String geoLocation = profile.getMostRecentGeoInfo().getGeolocation();
html.append(Html.TABLELINE_PLAYERS.parse(

View File

@ -6,8 +6,7 @@
package com.djrapitops.plan.utilities.uuid;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plugin.api.Check;
import com.djrapitops.plugin.api.utility.UUIDFetcher;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -53,7 +53,7 @@ public class PlayerProfileTest {
}
p.setSessions(null, sessions);
assertEquals(5.0, p.getActivityIndex(date));
assertEquals(5.0, p.getActivityIndex(date).getValue());
}
@Test
@ -77,7 +77,7 @@ public class PlayerProfileTest {
}
p.setSessions(null, sessions);
assertEquals(5.0, p.getActivityIndex(date));
assertEquals(5.0, p.getActivityIndex(date).getValue());
}
@Test
@ -101,7 +101,7 @@ public class PlayerProfileTest {
}
p.setSessions(null, sessions);
assertTrue(2.0 <= p.getActivityIndex(date));
assertTrue(2.0 <= p.getActivityIndex(date).getValue());
}
@Test(timeout = 500)

View File

@ -5,7 +5,7 @@
*/
package com.djrapitops.plan.data.cache;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.systems.cache.DataCache;
import org.bukkit.plugin.java.JavaPlugin;
import org.junit.After;

View File

@ -1,80 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.djrapitops.plan.database;
import org.junit.Test;
import test.utilities.RandomData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
/**
* @author ristolah
*/
public class DBUtilsTest {
@Test
public void testSplitIntoBatches() {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 21336; i++) {
list.add(i);
}
List<List<Integer>> result = DBUtils.splitIntoBatches(list);
assertEquals(3, result.size());
assertEquals(10192, result.get(0).size());
assertEquals(10192, result.get(1).size());
assertEquals(952, result.get(2).size());
}
@Test
public void testSplitIntoBatchesSingleBatch() {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 10192; i++) {
list.add(i);
}
List<List<Integer>> result = DBUtils.splitIntoBatches(list);
assertEquals(1, result.size());
assertEquals(10192, result.get(0).size());
}
@Test
public void testSplitIntoBatchesId() {
Map<Integer, List<Integer>> map = new HashMap<>();
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 2133; j++) {
map.computeIfAbsent(i, k -> new ArrayList<>());
map.get(i).add(j);
}
}
List<List<Container<Integer>>> result = DBUtils.splitIntoBatchesId(map);
assertEquals(3, result.size());
assertEquals(10192, result.get(0).size());
assertEquals(10192, result.get(1).size());
assertEquals(946, result.get(2).size());
}
@Test
public void testContainers() {
Object object = new Object();
int id = RandomData.randomInt(1, 100);
Container<Object> container = new Container<>(object, id);
assertEquals(id, container.getId());
assertEquals(object, container.getObject());
}
}

View File

@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.djrapitops.plan.database;
package com.djrapitops.plan.system.database;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.exceptions.DatabaseInitException;
@ -11,10 +11,11 @@ import com.djrapitops.plan.data.WebUser;
import com.djrapitops.plan.data.container.*;
import com.djrapitops.plan.data.time.GMTimes;
import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.database.databases.MySQLDB;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.databases.SQLiteDB;
import com.djrapitops.plan.database.tables.*;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.MySQLDB;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.databases.SQLiteDB;
import com.djrapitops.plan.system.database.tables.*;
import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.info.server.ServerInfo;
import com.djrapitops.plan.systems.processing.player.RegisterProcessor;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.database.tables;
package com.djrapitops.plan.system.database.tables;
import org.junit.Test;

View File

@ -6,9 +6,9 @@
package com.djrapitops.plan.utilities;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.databases.SQLDB;
import com.djrapitops.plan.database.databases.SQLiteDB;
import com.djrapitops.plan.database.tables.UsersTable;
import com.djrapitops.plan.system.database.databases.SQLDB;
import com.djrapitops.plan.system.database.databases.SQLiteDB;
import com.djrapitops.plan.system.database.tables.UsersTable;
import com.djrapitops.plan.systems.info.server.ServerInfo;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.command.ISender;

View File

@ -4,7 +4,7 @@
*/
package test.utilities;
import com.djrapitops.plan.database.DatabaseTest;
import com.djrapitops.plan.system.database.DatabaseTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;