Changed all incorrect package names + Bugfixes, small things

- Removed remaints of ServerData
- Named a few tasks
- Empty nickname no longer added to Nicknames
- SessionData no longer cleared when DataCache clears data from cache
- Moved all imports and package declerations to correct form (Should
have done this ages ago) main.java.com.djrapitops.plan....
This commit is contained in:
Rsl1122 2017-02-14 17:46:38 +02:00
parent a2cd3af688
commit ded1ef53bf
74 changed files with 438 additions and 409 deletions

View File

@ -1,9 +1,8 @@
package com.djrapitops.plan;
package main.java.com.djrapitops.plan;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import org.bukkit.ChatColor;

View File

@ -18,16 +18,16 @@
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/licence.yml
*/
package com.djrapitops.plan;
package main.java.com.djrapitops.plan;
import com.djrapitops.plan.command.PlanCommand;
import com.djrapitops.plan.api.API;
import com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.*;
import com.djrapitops.plan.data.cache.*;
import com.djrapitops.plan.data.listeners.*;
import main.java.com.djrapitops.plan.command.PlanCommand;
import main.java.com.djrapitops.plan.api.API;
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.databases.*;
import main.java.com.djrapitops.plan.data.cache.*;
import main.java.com.djrapitops.plan.data.listeners.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@ -41,7 +41,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashSet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.listeners.PlanDeathEventListener;
import main.java.com.djrapitops.plan.ui.Html;
import org.bukkit.Bukkit;
@ -56,27 +55,10 @@ Database cleaning
Play session length
Location Analysis to view meaningful locations on Dynmap (Investigate dynmap api)
Integrate PlanLite features to Plan and discontinue PlanLite
Seperate serverdata and userdata saving
Database Cleaning of useless data
Fix any bugs that come up
- New Players not counted for some reason.
Sortable player table.
Add -n argument for nickname search.
Online activity revamp
- Create new SessionData
- Data saved to UserData
- Database table
- Data saved to database
- Data retrieval from db
- Remove ServerData
-> Move commanduse responsibility to a new handler
- Online player analysis
- New player analysis (Registered)
Kill table
- weapon
- KillData
- Saving
- DB
*/
/**
*
@ -145,7 +127,7 @@ public class Plan extends JavaPlugin {
uiServer = new WebSocketServer(this);
uiServer.initServer();
if (Settings.ANALYSIS_REFRESH_ON_ENABLE.isTrue()) {
startBootRefreshTask();
startBootAnalysisTask();
}
int analysisRefreshMinutes = Settings.ANALYSIS_AUTO_REFRESH.getNumber();
if (analysisRefreshMinutes != -1) {
@ -269,7 +251,7 @@ public class Plan extends JavaPlugin {
}
private void startAnalysisRefreshTask(int analysisRefreshMinutes) throws IllegalStateException, IllegalArgumentException {
(new BukkitRunnable() {
BukkitTask asyncPeriodicalAnalysisTask = (new BukkitRunnable() {
@Override
public void run() {
if (!analysisCache.isCached()) {
@ -281,9 +263,9 @@ public class Plan extends JavaPlugin {
}).runTaskTimerAsynchronously(this, analysisRefreshMinutes * 60 * 20, analysisRefreshMinutes * 60 * 20);
}
private void startBootRefreshTask() throws IllegalStateException, IllegalArgumentException {
private void startBootAnalysisTask() throws IllegalStateException, IllegalArgumentException {
log(Phrase.ANALYSIS_BOOT_NOTIFY + "");
BukkitTask analysis = (new BukkitRunnable() {
BukkitTask bootAnalysisTask = (new BukkitRunnable() {
@Override
public void run() {
log(Phrase.ANALYSIS_BOOT + "");
@ -291,7 +273,7 @@ public class Plan extends JavaPlugin {
this.cancel();
}
}).runTaskLater(this, 30 * 20);
bootAnalysisTaskID = analysis.getTaskId();
bootAnalysisTaskID = bootAnalysisTask.getTaskId();
}
/**

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan;
package main.java.com.djrapitops.plan;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.api.API;

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
/**
@ -20,7 +20,6 @@ public enum Settings {
// Integer
ANALYSIS_MINUTES_FOR_ACTIVE("Settings.Analysis.MinutesPlayedUntilConsidiredActive"),
SAVE_CACHE_MIN("Settings.Cache.DataCache.SaveEveryXMinutes"),
SAVE_SERVER_MIN("Settings.Cache.DataCache.SaveServerDataEveryXMinutes"),
CLEAR_INSPECT_CACHE("Settings.Cache.InspectCache.ClearFromInspectCacheAfterXMinutes"),
CLEAR_CACHE_X_SAVES("Settings.Cache.DataCache.ClearCacheEveryXSaves"),
WEBSERVER_PORT("Settings.WebServer.Port"),

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.api;
package main.java.com.djrapitops.plan.api;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.data.AnalysisData;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.ui.DataRequestHandler;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.data.AnalysisData;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.ui.DataRequestHandler;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.planlite.UUIDFetcher;
import java.util.Date;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.api;
package main.java.com.djrapitops.plan.api;
public enum Gender {
MALE, FEMALE, OTHER, UNKNOWN;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.command;
package main.java.com.djrapitops.plan.command;
public enum CommandType {
CONSOLE,

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.command;
package main.java.com.djrapitops.plan.command;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.command.commands.*;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.command.commands.*;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.command;
package main.java.com.djrapitops.plan.command;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import java.util.Date;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
@ -14,6 +14,7 @@ import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
/**
*
@ -69,8 +70,7 @@ public class AnalyzeCommand extends SubCommand {
analysisCache.updateCache();
}
(new BukkitRunnable() {
BukkitTask analysisMessageSenderTask = (new BukkitRunnable() {
private int timesrun = 0;
@Override

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
//import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.PlanCommand;
import com.djrapitops.plan.command.SubCommand;
//import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.PlanCommand;
import main.java.com.djrapitops.plan.command.SubCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,14 +1,14 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.utilities.UUIDFetcher;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.utilities.UUIDFetcher;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.cache.InspectCacheHandler;
import com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.util.UUID;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
@ -20,6 +20,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import static org.bukkit.Bukkit.getOfflinePlayer;
import org.bukkit.scheduler.BukkitTask;
/**
*
@ -98,7 +99,7 @@ public class InspectCommand extends SubCommand {
configValue = 4;
}
final int available = configValue;
(new BukkitRunnable() {
BukkitTask inspectMessageSenderTask = (new BukkitRunnable() {
private int timesrun = 0;
@Override

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.command.commands;
package main.java.com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.cache.InspectCacheHandler;
import com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLiteDB;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

View File

@ -1,11 +1,11 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.Database;
import java.util.Arrays;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.Database;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -1,9 +1,9 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.command.commands.ManageCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;

View File

@ -1,10 +1,10 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.database.Database;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.Database;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.utilities.UUIDFetcher;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.utilities.UUIDFetcher;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.util.Arrays;
import java.util.UUID;

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.database.databases.SQLiteDB;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -1,9 +1,9 @@
package main.java.com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.CommandType;
import main.java.com.djrapitops.plan.command.SubCommand;
import org.bukkit.ChatColor;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.data;
package main.java.com.djrapitops.plan.data;
import main.java.com.djrapitops.plan.data.PlanLiteAnalyzedData;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.data;
package main.java.com.djrapitops.plan.data;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.api.Gender;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.api.Gender;
/**
*

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.data;
package main.java.com.djrapitops.plan.data;
import com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.database.Database;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
@ -162,17 +162,8 @@ public class UserData {
this.sessions.addAll(sessions);
}
public void startSession(long startTime) {
currentSession = new SessionData(startTime);
}
public void endSession(long endTime) {
if (currentSession != null) {
currentSession.endSession(endTime);
addSession(currentSession);
} else {
System.out.println("Player's session was initialized in a wrong way! (" + name + ")");
}
public void setCurrentSession(SessionData session) {
currentSession = session;
}
public void updateBanned(Player p) {

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.cache;
package main.java.com.djrapitops.plan.data.cache;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.AnalysisData;
import com.djrapitops.plan.utilities.Analysis;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.AnalysisData;
import main.java.com.djrapitops.plan.utilities.Analysis;
/**
*

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.data.cache;
package main.java.com.djrapitops.plan.data.cache;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.data.*;
import com.djrapitops.plan.data.handlers.*;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.data.*;
import main.java.com.djrapitops.plan.data.handlers.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -13,11 +13,13 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.handlers.SessionHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.OfflinePlayer;
import static org.bukkit.Bukkit.getPlayer;
import org.bukkit.scheduler.BukkitTask;
/**
*
@ -37,6 +39,7 @@ public class DataCacheHandler {
private final CommandUseHandler commandUseHandler;
private final PlanLiteHandler planLiteHandler;
private final KillHandler killHandler;
private final SessionHandler sessionHandler;
private final Database db;
private final NewPlayerCreator newPlayerCreator;
@ -66,6 +69,7 @@ public class DataCacheHandler {
planLiteHandler = new PlanLiteHandler(plugin);
newPlayerCreator = new NewPlayerCreator(plugin, this);
killHandler = new KillHandler(plugin);
sessionHandler = new SessionHandler(plugin);
timesSaved = 0;
maxPlayers = plugin.getServer().getMaxPlayers();
@ -74,10 +78,6 @@ public class DataCacheHandler {
if (minutes <= 0) {
minutes = 5;
}
int sMinutes = Settings.SAVE_SERVER_MIN.getNumber();
if (sMinutes <= 0) {
sMinutes = 5;
}
final int clearAfterXsaves;
int configValue = Settings.CLEAR_CACHE_X_SAVES.getNumber();
if (configValue <= 1) {
@ -85,7 +85,7 @@ public class DataCacheHandler {
} else {
clearAfterXsaves = configValue;
}
(new BukkitRunnable() {
BukkitTask asyncPeriodicCacheSaveTask = (new BukkitRunnable() {
@Override
public void run() {
DataCacheHandler handler = plugin.getHandler();
@ -159,27 +159,27 @@ public class DataCacheHandler {
* Saves all data in the cache to Database with AsyncTasks
*/
public void saveCachedUserData() {
BukkitTask asyncFullCacheSaveTask = (new BukkitRunnable() {
@Override
public void run() {
List<UserData> data = new ArrayList<>();
data.addAll(dataCache.values());
db.saveMultipleUserData(data);
timesSaved++;
this.cancel();
}
}).runTaskAsynchronously(plugin);
}
/**
* Saves all data in the cache to Database and closes the database down.
*/
public void saveCacheOnDisable() {
// dataCache.keySet().stream().forEach((uuid) -> {
// if (dataCache.get(uuid) != null) {
// db.saveUserData(uuid, dataCache.get(uuid));
// }
// });
List<UserData> data = new ArrayList<>();
data.addAll(dataCache.values());
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
for (UserData userData : data) {
userData.endSession(now);
}
data.parallelStream().forEach((userData) -> {
sessionHandler.endSession(userData);
});
db.saveMultipleUserData(data);
db.saveCommandUse(commandUse);
db.close();
@ -191,7 +191,7 @@ public class DataCacheHandler {
* @param uuid Player's UUID
*/
public void saveCachedData(UUID uuid) {
(new BukkitRunnable() {
BukkitTask asyncCachedUserSaveTask = (new BukkitRunnable() {
@Override
public void run() {
if (dataCache.get(uuid) != null) {
@ -209,7 +209,7 @@ public class DataCacheHandler {
* Data is saved on a new line with a long value matching current Date
*/
public void saveCommandUse() {
(new BukkitRunnable() {
BukkitTask asyncCommandUseSaveTask = (new BukkitRunnable() {
@Override
public void run() {
db.saveCommandUse(commandUse);
@ -317,6 +317,7 @@ public class DataCacheHandler {
public void newPlayer(Player player) {
newPlayerCreator.createNewPlayer(player);
}
public void newPlayer(OfflinePlayer player) {
newPlayerCreator.createNewPlayer(player);
}
@ -401,6 +402,10 @@ public class DataCacheHandler {
return commandUseHandler;
}
public SessionHandler getSessionHandler() {
return sessionHandler;
}
/**
* If /reload is run this treats every online player as a new login.
*
@ -417,8 +422,8 @@ public class DataCacheHandler {
activityHandler.handleReload(player, data);
basicInfoHandler.handleReload(player, data);
gamemodeTimesHandler.handleReload(player, data);
saveCachedData(uuid);
}
saveCachedUserData();
}
/**

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.data.cache;
package main.java.com.djrapitops.plan.data.cache;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import java.util.UUID;
import org.bukkit.entity.Player;
@ -63,12 +63,11 @@ public class ActivityHandler {
* @param data UserData matching the Player
*/
public void handleLogin(PlayerJoinEvent event, UserData data) {
Date now = new Date();
data.setLastPlayed(now.getTime());
data.setLastPlayed(new Date().getTime());
Player player = event.getPlayer();
data.updateBanned(player);
data.setLoginTimes(data.getLoginTimes() + 1);
data.startSession(now.toInstant().getEpochSecond() * (long) 1000);
// handler.getLocationHandler().addLocation(player.getUniqueId(), player.getLocation());
}
@ -85,7 +84,7 @@ public class ActivityHandler {
long timeNow = now.getTime();
data.setPlayTime(data.getPlayTime() + (timeNow - data.getLastPlayed()));
data.setLastPlayed(timeNow);
data.endSession(now.toInstant().getEpochSecond() * (long) 1000);
handler.getSessionHandler().endSession(data);
}
/**
@ -101,6 +100,6 @@ public class ActivityHandler {
long timeNow = now.getTime();
data.setPlayTime(data.getPlayTime() + (timeNow - data.getLastPlayed()));
data.setLastPlayed(timeNow);
data.startSession(now.toInstant().getEpochSecond() * (long) 1000);
handler.getSessionHandler().startSession(data);
}
}

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
@ -32,9 +32,11 @@ public class BasicInfoHandler {
*/
public void handleLogin(PlayerJoinEvent event, UserData data) {
Player player = event.getPlayer();
String nick = player.getDisplayName();
if (data.addNickname(nick)) {
data.setLastNick(nick);
String nickname = player.getDisplayName();
if (!nickname.isEmpty()) {
if (data.addNickname(nickname)) {
data.setLastNick(nickname);
}
}
data.addIpAddress(player.getAddress().getAddress());
}
@ -46,9 +48,11 @@ public class BasicInfoHandler {
* @param data UserData matching the Player
*/
public void handleReload(Player player, UserData data) {
String nick = player.getDisplayName();
if (data.addNickname(nick)) {
data.setLastNick(nick);
String nickname = player.getDisplayName();
if (!nickname.isEmpty()) {
if (data.addNickname(nickname)) {
data.setLastNick(nickname);
}
}
data.addIpAddress(player.getAddress().getAddress());
}

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import java.util.HashMap;

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.Gender;
import com.djrapitops.plan.data.DemographicsData;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.api.Gender;
import main.java.com.djrapitops.plan.data.DemographicsData;
import main.java.com.djrapitops.plan.data.UserData;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetAddress;

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.HashMap;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,7 @@
package main.java.com.djrapitops.plan.data.handlers;
package com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.KillData;

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Collection;
import java.util.UUID;
import org.bukkit.Location;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.data.DemographicsData;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.data.DemographicsData;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import org.bukkit.GameMode;
import org.bukkit.OfflinePlayer;

View File

@ -1,9 +1,9 @@
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.InspectCacheHandler;
import com.djrapitops.plan.utilities.PlaceholderUtils;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
import main.java.com.djrapitops.plan.utilities.PlaceholderUtils;
import com.djrapitops.planlite.UUIDFetcher;
import com.djrapitops.planlite.api.DataPoint;
import com.djrapitops.planlite.api.DataType;

View File

@ -1,11 +1,11 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.planlite.api.DataPoint;
import java.util.HashMap;
import java.util.Set;

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.handlers;
package main.java.com.djrapitops.plan.data.handlers;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerKickEvent;

View File

@ -0,0 +1,46 @@
package main.java.com.djrapitops.plan.data.handlers;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.SessionData;
/**
*
* @author Rsl1122
*/
public class SessionHandler {
private final HashMap<UUID, SessionData> activeSessions;
private final DataCacheHandler handler;
private final Plan plugin;
public SessionHandler(Plan plugin) {
this.plugin = plugin;
this.handler = plugin.getHandler();
this.activeSessions = new HashMap<>();
}
public void startSession(UserData data) {
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
SessionData session = new SessionData(now);
activeSessions.put(data.getUuid(), session);
data.setCurrentSession(session);
}
public void endSession (UserData data) {
UUID uuid = data.getUuid();
SessionData currentSession = activeSessions.get(uuid);
if (currentSession != null) {
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
currentSession.endSession(now);
data.addSession(currentSession);
activeSessions.remove(uuid);
} else {
System.out.println("Player's session was initialized in a wrong way! (" + data.getName() + ")");
}
}
}

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan.data.importing;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import java.util.HashMap;
import java.util.Set;
import java.util.UUID;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.data.listeners;
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.DemographicsHandler;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.DemographicsHandler;
import main.java.com.djrapitops.plan.data.UserData;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -43,7 +43,10 @@ public class PlanChatListener implements Listener {
}
Player p = event.getPlayer();
UserData data = handler.getCurrentData(p.getUniqueId());
data.addNickname(p.getDisplayName());
String nickname = p.getDisplayName();
if (!nickname.isEmpty()) {
data.addNickname(nickname);
}
demographicsHandler.handleChatEvent(event, data);
}
}

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.listeners;
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.CommandUseHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.CommandUseHandler;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;

View File

@ -1,9 +1,9 @@
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.KillHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.KillHandler;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.data.listeners;
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.GamemodeTimesHandler;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.GamemodeTimesHandler;
import main.java.com.djrapitops.plan.data.UserData;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.data.listeners;
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.*;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.*;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View File

@ -1,8 +1,8 @@
package com.djrapitops.plan.data.listeners;
package main.java.com.djrapitops.plan.data.listeners;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.cache.DataCacheHandler;
import com.djrapitops.plan.data.handlers.LocationHandler;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
import main.java.com.djrapitops.plan.data.handlers.LocationHandler;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.database;
package main.java.com.djrapitops.plan.database;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Plan;
import org.bukkit.configuration.ConfigurationSection;
import java.util.*;

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.database.databases;
package main.java.com.djrapitops.plan.database.databases;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import org.bukkit.configuration.ConfigurationSection;
import java.sql.Connection;

View File

@ -1,9 +1,9 @@
package com.djrapitops.plan.database.databases;
package main.java.com.djrapitops.plan.database.databases;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.api.Gender;
import com.djrapitops.plan.database.Database;
import com.djrapitops.plan.data.*;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.api.Gender;
import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.data.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Connection;
@ -654,8 +654,10 @@ public abstract class SQLDB extends Database {
lastNick = nickname;
}
}
if (!lastNick.isEmpty()) {
nicknames.remove(lastNick);
nicknames.add(lastNick);
}
set.close();
statement.close();
return nicknames;

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.database.databases;
package main.java.com.djrapitops.plan.database.databases;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import org.bukkit.configuration.ConfigurationSection;
import java.io.File;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.ui;
package main.java.com.djrapitops.plan.ui;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import com.djrapitops.plan.data.cache.InspectCacheHandler;
import com.djrapitops.plan.utilities.PlaceholderUtils;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
import main.java.com.djrapitops.plan.utilities.PlaceholderUtils;
import java.util.UUID;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan.ui;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan.ui.graphs;
import com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Phrase;
import com.googlecode.charts4j.Color;
import com.googlecode.charts4j.GCharts;
import com.googlecode.charts4j.PieChart;

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.ui.graphs;
package main.java.com.djrapitops.plan.ui.graphs;
import com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Phrase;
import com.googlecode.charts4j.Color;
import com.googlecode.charts4j.GCharts;
import com.googlecode.charts4j.PieChart;

View File

@ -1,8 +1,8 @@
package main.java.com.djrapitops.plan.ui.graphs;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import com.googlecode.charts4j.AxisLabels;
import com.googlecode.charts4j.AxisLabelsFactory;
import com.googlecode.charts4j.Color;

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan.ui.tables;
import com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.ui.webserver;
package main.java.com.djrapitops.plan.ui.webserver;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.ui.webserver;
package main.java.com.djrapitops.plan.ui.webserver;
import com.djrapitops.plan.ui.DataRequestHandler;
import com.djrapitops.plan.utilities.UUIDFetcher;
import main.java.com.djrapitops.plan.ui.DataRequestHandler;
import main.java.com.djrapitops.plan.utilities.UUIDFetcher;
import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;

View File

@ -1,10 +1,10 @@
package main.java.com.djrapitops.plan.ui.webserver;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.ui.DataRequestHandler;
import com.djrapitops.plan.ui.webserver.Request;
import com.djrapitops.plan.ui.webserver.Response;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.ui.DataRequestHandler;
import main.java.com.djrapitops.plan.ui.webserver.Request;
import main.java.com.djrapitops.plan.ui.webserver.Response;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

View File

@ -1,12 +1,12 @@
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.data.AnalysisData;
import com.djrapitops.plan.data.UserData;
import com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import com.djrapitops.plan.data.cache.InspectCacheHandler;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.data.AnalysisData;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -86,10 +86,10 @@ public class Analysis {
});
}
// Create empty Dataset
final RawAnalysisData raw = new RawAnalysisData();
raw.setCommandUse(plugin.getDB().getCommandUse());
final RawAnalysisData sorted = new RawAnalysisData();
sorted.setCommandUse(plugin.getDB().getCommandUse());
log(Phrase.ANALYSIS_BEGIN_ANALYSIS + "");
AnalysisData data = new AnalysisData();
AnalysisData analysisData = new AnalysisData();
// DEPRECATED - WILL BE REMOVED
boolean planLiteEnabled = isPlanLiteEnabled();
@ -102,78 +102,78 @@ public class Analysis {
rawData.parallelStream().forEach((uData) -> {
try {
HashMap<GameMode, Long> gmTimes = uData.getGmTimes();
raw.addToGmZero(gmTimes.get(GameMode.SURVIVAL));
raw.addToGmOne(gmTimes.get(GameMode.CREATIVE));
raw.addToGmTwo(gmTimes.get(GameMode.ADVENTURE));
sorted.addToGmZero(gmTimes.get(GameMode.SURVIVAL));
sorted.addToGmOne(gmTimes.get(GameMode.CREATIVE));
sorted.addToGmTwo(gmTimes.get(GameMode.ADVENTURE));
try {
Long gm = gmTimes.get(GameMode.SPECTATOR);
if (gm != null) {
raw.addGmThree(gm);
sorted.addGmThree(gm);
}
} catch (NoSuchFieldError e) {
}
long playTime = uData.getPlayTime();
raw.addTotalPlaytime(playTime);
sorted.addTotalPlaytime(playTime);
String playerName = uData.getName();
String url = HtmlUtils.getInspectUrl(playerName);
String html = Html.BUTTON.parse(url, playerName);
raw.getLatestLogins().put(html, uData.getLastPlayed());
raw.addTotalLoginTimes(uData.getLoginTimes());
sorted.getLatestLogins().put(html, uData.getLastPlayed());
sorted.addTotalLoginTimes(uData.getLoginTimes());
int age = uData.getDemData().getAge();
if (age != -1) {
raw.getAges().add(age);
sorted.getAges().add(age);
}
if (uData.isOp()) {
raw.addOps(1);
sorted.addOps(1);
}
if (uData.isBanned()) {
raw.addTotalBanned(1);
sorted.addTotalBanned(1);
} else if (uData.getLoginTimes() == 1) {
raw.addJoinleaver(1);
sorted.addJoinleaver(1);
} else if (AnalysisUtils.isActive(uData.getLastPlayed(), playTime, uData.getLoginTimes())) {
raw.addActive(1);
raw.getPlaytimes().put(html, playTime);
sorted.addActive(1);
sorted.getPlaytimes().put(html, playTime);
} else {
raw.addInactive(1);
sorted.addInactive(1);
}
raw.addTotalKills(uData.getPlayerKills().size());
raw.addTotalMobKills(uData.getMobKills());
raw.addTotalDeaths(uData.getDeaths());
raw.getSessiondata().addAll(uData.getSessions());
raw.getRegistered().add(uData.getRegistered());
sorted.addTotalKills(uData.getPlayerKills().size());
sorted.addTotalMobKills(uData.getMobKills());
sorted.addTotalDeaths(uData.getDeaths());
sorted.getSessiondata().addAll(uData.getSessions());
sorted.getRegistered().add(uData.getRegistered());
} catch (NullPointerException e) {
plugin.logError(Phrase.DATA_CORRUPTION_WARN.parse(uData.getUuid() + ""));
}
});
// Analyze & Save RawAnalysisData to AnalysisData
createPlayerActivityGraphs(data, raw.getSessiondata(), raw.getRegistered());
createPlayerActivityGraphs(analysisData, sorted.getSessiondata(), sorted.getRegistered());
data.setTop20ActivePlayers(AnalysisUtils.createActivePlayersTable(raw.getPlaytimes(), 20));
data.setRecentPlayers(AnalysisUtils.createListStringOutOfHashMapLong(raw.getLatestLogins(), 20));
analysisData.setTop20ActivePlayers(AnalysisUtils.createActivePlayersTable(sorted.getPlaytimes(), 20));
analysisData.setRecentPlayers(AnalysisUtils.createListStringOutOfHashMapLong(sorted.getLatestLogins(), 20));
addPlanLiteToData(planLiteEnabled, plData, factionMap, townMap, totalVotes, totalMoney, data);
addPlanLiteToData(planLiteEnabled, plData, factionMap, townMap, totalVotes, totalMoney, analysisData);
long totalPlaytime = raw.getTotalPlaytime();
data.setTotalPlayTime(totalPlaytime);
data.setAveragePlayTime(totalPlaytime / rawData.size());
data.setTotalLoginTimes(raw.getTotalLoginTimes());
long totalPlaytime = sorted.getTotalPlaytime();
analysisData.setTotalPlayTime(totalPlaytime);
analysisData.setAveragePlayTime(totalPlaytime / rawData.size());
analysisData.setTotalLoginTimes(sorted.getTotalLoginTimes());
createActivityVisalization(raw.getTotalBanned(), raw.getActive(), raw.getInactive(), raw.getJoinleaver(), data);
createActivityVisalization(sorted.getTotalBanned(), sorted.getActive(), sorted.getInactive(), sorted.getJoinleaver(), analysisData);
data.setOps(raw.getOps());
analysisData.setOps(sorted.getOps());
analyzeAverageAge(raw.getAges(), data);
createGamemodeUsageVisualization(raw.getGmZero(), raw.getGmOne(), raw.getGmTwo(), raw.getGmThree(), data);
createCommandUseTable(raw, data);
analyzeAverageAge(sorted.getAges(), analysisData);
createGamemodeUsageVisualization(sorted.getGmZero(), sorted.getGmOne(), sorted.getGmTwo(), sorted.getGmThree(), analysisData);
createCommandUseTable(sorted, analysisData);
data.setTotaldeaths(raw.getTotalDeaths());
data.setTotalkills(raw.getTotalKills());
data.setTotalmobkills(raw.getTotalMobKills());
analysisData.setTotaldeaths(sorted.getTotalDeaths());
analysisData.setTotalkills(sorted.getTotalKills());
analysisData.setTotalmobkills(sorted.getTotalMobKills());
data.setRefreshDate(new Date().getTime());
analysisCache.cache(data);
analysisData.setRefreshDate(new Date().getTime());
analysisCache.cache(analysisData);
plugin.log(Phrase.ANALYSIS_COMPLETE + "");
this.cancel();
}

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.ui.graphs.GMTimesPieChartCreator;
import main.java.com.djrapitops.plan.ui.graphs.GMTimesPieChartCreator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;

View File

@ -1,8 +1,8 @@
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.data.DemographicsData;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.data.DemographicsData;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import java.util.Date;
import main.java.com.djrapitops.plan.ui.Html;

View File

@ -1,6 +1,6 @@
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Plan;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;

View File

@ -1,10 +1,10 @@
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.data.AnalysisData;
import com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.PlanLiteHook;
import main.java.com.djrapitops.plan.data.AnalysisData;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.Date;
import java.util.HashMap;
import main.java.com.djrapitops.plan.Settings;

View File

@ -19,7 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.djrapitops.plan.utilities;
package main.java.com.djrapitops.plan.utilities;
import com.google.common.collect.ImmutableList;
import org.json.simple.JSONArray;

View File

@ -13,7 +13,6 @@ Settings:
ClearFromInspectCacheAfterXMinutes: 5
DataCache:
SaveEveryXMinutes: 2
SaveServerDataEveryXMinutes: 1
ClearCacheEveryXSaves: 5
WebServer:
Enabled: true