diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java index 29b72beff..5970aae7d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Plan.java +++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java index 23010b290..c3cbf28cf 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java b/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java index 902145f99..0932ced16 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java b/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java index f8757d6b1..4d5408865 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java +++ b/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java index adc69d734..ed249757e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java @@ -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()); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java index 60dd3f858..08f54df60 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java index 19543b7c4..bbbbca750 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java index ded89d2c6..18162f16c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java index 162b61ace..4a5112cb9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java index 9195b96a8..f3f93c5de 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java index 6e2219a37..4f3bab355 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java index 1c328ca84..18dcb5f9c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java index d24a2a8d2..b1190782e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java b/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java index 3ff1165f0..eda9fc2ab 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java @@ -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 pluginReplaceMap; // Value that requires lot of processing - private Map activityIndex; + private Map 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 sessionsWeek = getSessions(weekAgo, date).collect(Collectors.toList()); - List sessionsWeek2 = getSessions(twoWeeksAgo, weekAgo).collect(Collectors.toList()); - List 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; } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/Action.java b/Plan/src/main/java/com/djrapitops/plan/data/container/Action.java index b7c067b50..10ac92738 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/Action.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/Action.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java b/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java index 18f4aead3..92a88f610 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/StickyData.java b/Plan/src/main/java/com/djrapitops/plan/data/container/StickyData.java index d5cdaa928..582f9b2ad 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/StickyData.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/StickyData.java @@ -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(); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/element/ActivityIndex.java b/Plan/src/main/java/com/djrapitops/plan/data/element/ActivityIndex.java new file mode 100644 index 000000000..d79102c61 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/data/element/ActivityIndex.java @@ -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 sessionsWeek = player.getSessions(weekAgo, date).collect(Collectors.toList()); + List sessionsWeek2 = player.getSessions(twoWeeksAgo, weekAgo).collect(Collectors.toList()); + List 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"; + } + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java b/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java index 710942da5..795959640 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java @@ -155,7 +155,7 @@ public class HealthNotes { private void activePlayerPlaytimeChange() { List 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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/Container.java b/Plan/src/main/java/com/djrapitops/plan/database/Container.java deleted file mode 100644 index 8e1885f72..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/database/Container.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.djrapitops.plan.database; - -/** - * Class to contain objects in the batches. - * - * @param Object stored. - * @author Rsl1122 - * @since 3.4.3 - */ -public class Container { - - 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; - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/database/DBUtils.java b/Plan/src/main/java/com/djrapitops/plan/database/DBUtils.java deleted file mode 100644 index c01a9d36b..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/database/DBUtils.java +++ /dev/null @@ -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 Object type - * @param objects Collection of the objects - * @return Lists with max size of BATCH_SIZE - */ - public static List> splitIntoBatches(Collection objects) { - List> 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 Object type - * @param objects Collection of the objects - * @return Lists with max size of BATCH_SIZE - */ - public static List>> splitIntoBatchesId(Map> objects) { - List>> wrappedBatches = new ArrayList<>(); - - int i = 0; - int j = 0; - - for (Entry> 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 Object type - * @param objects Collection of the objects - * @return Lists with max size of BATCH_SIZE - */ - public static List>> splitIntoBatchesWithID(Map objects) { - List>> wrappedBatches = new ArrayList<>(); - - int i = 0; - int j = 0; - - for (Entry 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; - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 5b0c8f0bc..5310d11bc 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -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; + } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanDBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/BukkitDBSystem.java similarity index 74% rename from Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanDBSystem.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/BukkitDBSystem.java index e84c33a5e..c22470f2c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanDBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/BukkitDBSystem.java @@ -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 { diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanBungeeDBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java similarity index 74% rename from Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanBungeeDBSystem.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java index 25e2eb9ec..8c216fbd3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/PlanBungeeDBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java @@ -2,19 +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.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 { db = new MySQLDB(); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/DBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java similarity index 81% rename from Plan/src/main/java/com/djrapitops/plan/systems/file/database/DBSystem.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java index afadcb981..32f5f5d90 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/file/database/DBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java @@ -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)) { diff --git a/Plan/src/main/java/com/djrapitops/plan/database/Database.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/Database.java similarity index 98% rename from Plan/src/main/java/com/djrapitops/plan/database/Database.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/databases/Database.java index e0ad1310e..db5b8aa55 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/Database.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/Database.java @@ -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. */ diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/MySQLDB.java similarity index 97% rename from Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/databases/MySQLDB.java index 2ea9c55f4..8837f11bf 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/MySQLDB.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLDB.java similarity index 98% rename from Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLDB.java index ed544d912..2ed862a89 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLDB.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLiteDB.java similarity index 98% rename from Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLiteDB.java index c8380ad43..e66d7daab 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/SQLiteDB.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/processing/ExecStatement.java b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/ExecStatement.java similarity index 94% rename from Plan/src/main/java/com/djrapitops/plan/database/processing/ExecStatement.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/processing/ExecStatement.java index 0efe6c60b..7f12a4cac 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/processing/ExecStatement.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/ExecStatement.java @@ -1,8 +1,8 @@ -/* +/* * 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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/processing/QueryAllStatement.java b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryAllStatement.java similarity index 92% rename from Plan/src/main/java/com/djrapitops/plan/database/processing/QueryAllStatement.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryAllStatement.java index e7d0247ff..d4cf06c7d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/processing/QueryAllStatement.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryAllStatement.java @@ -1,8 +1,8 @@ -/* +/* * 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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/processing/QueryStatement.java b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryStatement.java similarity index 95% rename from Plan/src/main/java/com/djrapitops/plan/database/processing/QueryStatement.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryStatement.java index e024374bb..b38687683 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/processing/QueryStatement.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/processing/QueryStatement.java @@ -1,8 +1,8 @@ -/* +/* * 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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/Insert.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Insert.java similarity index 94% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/Insert.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/Insert.java index 7acba858a..ac63d3c0c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/Insert.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Insert.java @@ -1,4 +1,4 @@ -package com.djrapitops.plan.database.sql; +package com.djrapitops.plan.system.database.sql; public class Insert extends SqlParser { diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/Select.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Select.java similarity index 92% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/Select.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/Select.java index 142f36a0b..58e9a249c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/Select.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Select.java @@ -1,4 +1,4 @@ -package com.djrapitops.plan.database.sql; +package com.djrapitops.plan.system.database.sql; public class Select extends WhereParser { diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/Sql.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Sql.java similarity index 89% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/Sql.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/Sql.java index c9b552060..fdf964c55 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/Sql.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Sql.java @@ -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"; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/SqlParser.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/SqlParser.java similarity index 92% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/SqlParser.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/SqlParser.java index 9110e135a..3e51824fa 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/SqlParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/SqlParser.java @@ -1,4 +1,4 @@ -package com.djrapitops.plan.database.sql; +package com.djrapitops.plan.system.database.sql; /** * Class for parsing different SQL strings. diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/TableSqlParser.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/TableSqlParser.java similarity index 98% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/TableSqlParser.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/TableSqlParser.java index 0f286a891..3edb43fdb 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/TableSqlParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/TableSqlParser.java @@ -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. diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/Update.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Update.java similarity index 93% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/Update.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/Update.java index 183f0a2fb..178b1e43d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/Update.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/Update.java @@ -1,8 +1,8 @@ -/* +/* * 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 diff --git a/Plan/src/main/java/com/djrapitops/plan/database/sql/WhereParser.java b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/WhereParser.java similarity index 95% rename from Plan/src/main/java/com/djrapitops/plan/database/sql/WhereParser.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/sql/WhereParser.java index d38bb0ce3..8e03a3d3a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/sql/WhereParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/sql/WhereParser.java @@ -1,8 +1,8 @@ -/* +/* * 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 diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/Actions.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/Actions.java similarity index 94% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/Actions.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/Actions.java index e243276cf..c10eadb2f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/Actions.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/Actions.java @@ -1,8 +1,8 @@ -/* +/* * 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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/ActionsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/ActionsTable.java similarity index 95% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/ActionsTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/ActionsTable.java index 6c5b688f9..189407cc8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/ActionsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/ActionsTable.java @@ -1,19 +1,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.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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/CommandUseTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/CommandUseTable.java similarity index 94% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/CommandUseTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/CommandUseTable.java index 0161f7db2..428f66b14 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/CommandUseTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/CommandUseTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/IPsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/IPsTable.java similarity index 93% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/IPsTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/IPsTable.java index e75af6596..0d0856189 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/IPsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/IPsTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/KillsTable.java similarity index 96% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/KillsTable.java index 129f17b41..eb67b74d8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/KillsTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/NicknamesTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/NicknamesTable.java similarity index 95% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/NicknamesTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/NicknamesTable.java index 04ad76e4f..8b4c1bdd9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/NicknamesTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/NicknamesTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/SecurityTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/SecurityTable.java similarity index 89% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/SecurityTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/SecurityTable.java index 2c34dc0ce..00ef2368b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/SecurityTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/SecurityTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/ServerTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/ServerTable.java similarity index 97% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/ServerTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/ServerTable.java index ef905b567..ef9a9b728 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/ServerTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/ServerTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/SessionsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/SessionsTable.java similarity index 98% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/SessionsTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/SessionsTable.java index a9a98e8cb..1b3ab61fb 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/SessionsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/SessionsTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/TPSTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/TPSTable.java similarity index 96% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/TPSTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/TPSTable.java index d24549fd5..0cf5af36e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/TPSTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/TPSTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/Table.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/Table.java similarity index 95% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/Table.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/Table.java index 0abde340b..3837286ff 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/Table.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/Table.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserIDTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserIDTable.java similarity index 83% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/UserIDTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserIDTable.java index cba453050..695154c69 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserIDTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserIDTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserInfoTable.java similarity index 96% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserInfoTable.java index dbdb316eb..bf3e97103 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UserInfoTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/UsersTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UsersTable.java similarity index 97% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/UsersTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/UsersTable.java index abfdbb7f4..9eea71115 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/UsersTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/UsersTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/VersionTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/VersionTable.java similarity index 83% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/VersionTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/VersionTable.java index d398549d8..6fa3c818e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/VersionTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/VersionTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTable.java similarity index 92% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTable.java index 80be4ca9e..cc1f78a60 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTimesTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTimesTable.java similarity index 97% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTimesTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTimesTable.java index fec3b97c8..84f68dfa4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/WorldTimesTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/WorldTimesTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/move/BatchOperationTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/BatchOperationTable.java similarity index 94% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/move/BatchOperationTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/BatchOperationTable.java index e328d2417..8533cc06e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/move/BatchOperationTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/BatchOperationTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/move/Version8TransferTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/Version8TransferTable.java similarity index 97% rename from Plan/src/main/java/com/djrapitops/plan/database/tables/move/Version8TransferTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/Version8TransferTable.java index bce666da9..3180159af 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/move/Version8TransferTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/tables/move/Version8TransferTable.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java index 81e24d2b6..559180643 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/PlayersPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/PlayersPageResponse.java index e9220fecb..e2eead794 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/PlayersPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/PlayersPageResponse.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/Systems.java b/Plan/src/main/java/com/djrapitops/plan/systems/Systems.java index a2b4b41a9..1e8a0176b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/Systems.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/Systems.java @@ -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(); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/cache/DataCache.java b/Plan/src/main/java/com/djrapitops/plan/systems/cache/DataCache.java index 4aad6c76e..2521e19c3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/cache/DataCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/cache/DataCache.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java index 4c417534e..81fcc6bca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/InspectPageParser.java @@ -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())); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/NetworkPageParser.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/NetworkPageParser.java index d441d49ce..99a7efb83 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/NetworkPageParser.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/parsing/NetworkPageParser.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java index f4cd81ece..7d043fe87 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BukkitServerInfoManager.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BungeeServerInfoManager.java b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BungeeServerInfoManager.java index b44f56101..2a80be406 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BungeeServerInfoManager.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/info/server/BungeeServerInfoManager.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/NewNickActionProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/NewNickActionProcessor.java index 124f1e7cd..948a9c9e9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/NewNickActionProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/NewNickActionProcessor.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/importing/importers/Importer.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/importing/importers/Importer.java index dc1665cde..5f5eb5092 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/importing/importers/Importer.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/importing/importers/Importer.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/BungeePlayerRegisterProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/BungeePlayerRegisterProcessor.java index 9b1505836..36505c201 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/BungeePlayerRegisterProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/BungeePlayerRegisterProcessor.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/FirstLeaveProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/FirstLeaveProcessor.java index 68751ba95..b4df70f6f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/FirstLeaveProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/FirstLeaveProcessor.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/NameProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/NameProcessor.java index 4dec0a1bb..e0aac70ce 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/NameProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/NameProcessor.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java index 0d29b2110..a961acbca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/RegisterProcessor.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java index 092809fd0..c3c65eae7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/ManageUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/ManageUtils.java index 6877ce531..58506eb42 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/ManageUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/ManageUtils.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java index 8619c2e06..f46009bd3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java index 05baae732..d7ae999e7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java index 7b043c7c5..b4a99a730 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java @@ -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> map = activityData.getOrDefault(date, new HashMap<>()); - Set uuids = map.getOrDefault(index, new HashSet<>()); + Set uuids = map.getOrDefault(activityGroup, new HashSet<>()); uuids.add(player.getUuid()); - map.put(index, uuids); + map.put(activityGroup, uuids); activityData.put(date, map); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java index ce16eef5d..58cbe3336 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java index 49b02d581..877ec3f85 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java @@ -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 ? " (Banned)" : " (" + readableIndex + ")"); + ActivityIndex activityIndex = profile.getActivityIndex(now); + String activityGroup = activityIndex.getGroup(); + String activityString = activityIndex.getFormattedValue() + + (isBanned ? " (Banned)" : " (" + activityGroup + ")"); String geoLocation = profile.getMostRecentGeoInfo().getGeolocation(); html.append(Html.TABLELINE_PLAYERS.parse( diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java index 4384dd4e1..e3261fbcf 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java @@ -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; diff --git a/Plan/test/main/java/com/djrapitops/plan/data/PlayerProfileTest.java b/Plan/test/main/java/com/djrapitops/plan/data/PlayerProfileTest.java index c87610e85..3152f3280 100644 --- a/Plan/test/main/java/com/djrapitops/plan/data/PlayerProfileTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/data/PlayerProfileTest.java @@ -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) diff --git a/Plan/test/main/java/com/djrapitops/plan/data/cache/DataCacheTest.java b/Plan/test/main/java/com/djrapitops/plan/data/cache/DataCacheTest.java index a093737f5..13877e46e 100644 --- a/Plan/test/main/java/com/djrapitops/plan/data/cache/DataCacheTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/data/cache/DataCacheTest.java @@ -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; diff --git a/Plan/test/main/java/com/djrapitops/plan/database/DBUtilsTest.java b/Plan/test/main/java/com/djrapitops/plan/database/DBUtilsTest.java deleted file mode 100644 index 1969dfe88..000000000 --- a/Plan/test/main/java/com/djrapitops/plan/database/DBUtilsTest.java +++ /dev/null @@ -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 list = new ArrayList<>(); - for (int i = 0; i < 21336; i++) { - list.add(i); - } - - List> 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 list = new ArrayList<>(); - for (int i = 0; i < 10192; i++) { - list.add(i); - } - - List> result = DBUtils.splitIntoBatches(list); - - assertEquals(1, result.size()); - assertEquals(10192, result.get(0).size()); - } - - @Test - public void testSplitIntoBatchesId() { - Map> 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>> 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 container = new Container<>(object, id); - - assertEquals(id, container.getId()); - assertEquals(object, container.getObject()); - } - -} diff --git a/Plan/test/main/java/com/djrapitops/plan/database/DatabaseTest.java b/Plan/test/main/java/com/djrapitops/plan/system/database/DatabaseTest.java similarity index 98% rename from Plan/test/main/java/com/djrapitops/plan/database/DatabaseTest.java rename to Plan/test/main/java/com/djrapitops/plan/system/database/DatabaseTest.java index e98c3dd16..feb51eaaf 100644 --- a/Plan/test/main/java/com/djrapitops/plan/database/DatabaseTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/system/database/DatabaseTest.java @@ -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; diff --git a/Plan/test/main/java/com/djrapitops/plan/database/tables/ActionsTest.java b/Plan/test/main/java/com/djrapitops/plan/system/database/tables/ActionsTest.java similarity index 83% rename from Plan/test/main/java/com/djrapitops/plan/database/tables/ActionsTest.java rename to Plan/test/main/java/com/djrapitops/plan/system/database/tables/ActionsTest.java index 27e28d8e6..10018c9af 100644 --- a/Plan/test/main/java/com/djrapitops/plan/database/tables/ActionsTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/system/database/tables/ActionsTest.java @@ -1,4 +1,4 @@ -package com.djrapitops.plan.database.tables; +package com.djrapitops.plan.system.database.tables; import org.junit.Test; diff --git a/Plan/test/main/java/com/djrapitops/plan/utilities/MiscUtilsTest.java b/Plan/test/main/java/com/djrapitops/plan/utilities/MiscUtilsTest.java index 391520aa5..304a76cba 100644 --- a/Plan/test/main/java/com/djrapitops/plan/utilities/MiscUtilsTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/utilities/MiscUtilsTest.java @@ -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; diff --git a/Plan/test/main/java/test/utilities/DBTestSuite.java b/Plan/test/main/java/test/utilities/DBTestSuite.java index 8a02fd347..5175019ae 100644 --- a/Plan/test/main/java/test/utilities/DBTestSuite.java +++ b/Plan/test/main/java/test/utilities/DBTestSuite.java @@ -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;