diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java
index 0146a943a..bfe9e1587 100644
--- a/Plan/src/main/java/com/djrapitops/plan/Plan.java
+++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java
@@ -72,9 +72,9 @@ public class Plan extends JavaPlugin {
* OnEnable method.
*
* Creates the config file. Checks for new version. Initializes Database.
- * Hooks PlanLite. Initializes DataCaches. Registers Listeners. Registers
- * Command /plan and initializes API. Enables Webserver & analysis tasks if
- * enabled in config. Warns about possible mistakes made in config.
+ * Hooks to Supported plugins. Initializes DataCaches. Registers Listeners.
+ * Registers Command /plan and initializes API. Enables Webserver & analysis
+ * tasks if enabled in config. Warns about possible mistakes made in config.
*/
@Override
public void onEnable() {
@@ -176,7 +176,13 @@ public class Plan extends JavaPlugin {
getLogger().severe(message);
}
- public void toLog(String source, Exception e) {
+ /**
+ * Logs trace of caught Exception to Errors.txt & notifies on console.
+ *
+ * @param source Class name the exception was caught in.
+ * @param e Throwable, eg NullPointerException
+ */
+ public void toLog(String source, Throwable e) {
logError(Phrase.ERROR_LOGGED.parse(e.toString()));
toLog(source + " Caught " + e);
for (StackTraceElement x : e.getStackTrace()) {
@@ -185,12 +191,23 @@ public class Plan extends JavaPlugin {
toLog("");
}
- public void toLog(String source, Collection e) {
- for (Exception ex : e) {
+ /**
+ * Logs multiple caught Errors to Errors.txt.
+ *
+ * @param source Class name the exception was caught in.
+ * @param e Collection of Throwables, eg NullPointerException
+ */
+ public void toLog(String source, Collection e) {
+ for (Throwable ex : e) {
toLog(source, ex);
}
}
+ /**
+ * Logs a message to the Errors.txt with a timestamp.
+ *
+ * @param message Message to log to Errors.txt
+ */
public void toLog(String message) {
File folder = getDataFolder();
if (!folder.exists()) {
@@ -296,21 +313,21 @@ public class Plan extends JavaPlugin {
}
/**
- * @return Currnet instance of the InspectCacheHandler
+ * @return Current instance of the InspectCacheHandler
*/
public InspectCacheHandler getInspectCache() {
return inspectCache;
}
/**
- * @return Currnet instance of the DataCacheHandler
+ * @return Current instance of the DataCacheHandler
*/
public DataCacheHandler getHandler() {
return handler;
}
/**
- * @return the Database
+ * @return the Current Database
*/
public Database getDB() {
return db;
@@ -323,19 +340,22 @@ public class Plan extends JavaPlugin {
return uiServer;
}
+ /**
+ * @return HookHandler that manages Hooks to other plugins.
+ */
public HookHandler getHookHandler() {
return hookHandler;
}
/**
- * @return Set containing SqLite & MySQL classes.
+ * @return Set containing the SqLite & MySQL classes.
*/
public HashSet getDatabases() {
return databases;
}
/**
- * @return
+ * @return ID of the bootAnalysisTask
*/
public int getBootAnalysisTaskID() {
return bootAnalysisTaskID;
@@ -343,7 +363,8 @@ public class Plan extends JavaPlugin {
private void initLocale() {
String locale = Settings.LOCALE.toString().toUpperCase();
- /*File genLocale = new File(getDataFolder(), "locale_EN.txt");
+ /*// Used to write a new Locale file
+ File genLocale = new File(getDataFolder(), "locale_EN.txt");
try {
genLocale.createNewFile();
FileWriter fw = new FileWriter(genLocale, true);
diff --git a/Plan/src/main/java/com/djrapitops/plan/Settings.java b/Plan/src/main/java/com/djrapitops/plan/Settings.java
index 4be5b70e0..4e1e575f0 100644
--- a/Plan/src/main/java/com/djrapitops/plan/Settings.java
+++ b/Plan/src/main/java/com/djrapitops/plan/Settings.java
@@ -22,6 +22,9 @@ public enum Settings {
CLEAR_CACHE_X_SAVES("Settings.Cache.DataCache.ClearCacheEveryXSaves"),
WEBSERVER_PORT("Settings.WebServer.Port"),
ANALYSIS_AUTO_REFRESH("Settings.Cache.AnalysisCache.RefreshEveryXMinutes"),
+ PROCESS_GET_LIMIT("Settings.Cache.Processing.GetLimit"),
+ PROCESS_SAVE_LIMIT("Settings.Cache.Processing.SaveLimit"),
+ PROCESS_CLEAR_LIMIT("Settings.Cache.Processing.ClearLimit"),
// String
ALTERNATIVE_IP("Settings.WebServer.AlternativeIP"),
DB_TYPE("database.type"),
@@ -68,6 +71,9 @@ public enum Settings {
return getPlugin(Plan.class).getConfig().getInt(configPath);
}
+ /**
+ * @return Path of the config setting.
+ */
public String getPath() {
return configPath;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java
index 16de7836e..c7ddb4c39 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/AnalysisData.java
@@ -42,6 +42,8 @@ public class AnalysisData {
private long totalkills;
private long totalmobkills;
private long totaldeaths;
+
+ private long sessionAverage;
/**
* Class constructor.
@@ -57,10 +59,19 @@ public class AnalysisData {
}
// Getters and setters v---------------------------------v
+
+ /**
+ *
+ * @return
+ */
public String getSortablePlayersTable() {
return sortablePlayersTable;
}
+ /**
+ *
+ * @param sortablePlayersTable
+ */
public void setSortablePlayersTable(String sortablePlayersTable) {
this.sortablePlayersTable = sortablePlayersTable;
}
@@ -82,7 +93,7 @@ public class AnalysisData {
/**
* @return HTML String of the Top50CommandsList
*/
- public String getTop50CommandsListHtml() {
+ public String getCommandUseListHtml() {
return commandUseTableHtml;
}
@@ -311,83 +322,179 @@ public class AnalysisData {
this.ops = ops;
}
+ /**
+ *
+ * @return
+ */
public String getTop20ActivePlayers() {
return top20ActivePlayers;
}
+ /**
+ *
+ * @param top20ActivePlayers
+ */
public void setTop20ActivePlayers(String top20ActivePlayers) {
this.top20ActivePlayers = top20ActivePlayers;
}
+ /**
+ *
+ * @return
+ */
public String getRecentPlayers() {
return recentPlayers;
}
+ /**
+ *
+ * @param recentPlayers
+ */
public void setRecentPlayers(String recentPlayers) {
this.recentPlayers = recentPlayers;
}
+ /**
+ *
+ * @return
+ */
public int getNewPlayersMonth() {
return newPlayersMonth;
}
+ /**
+ *
+ * @param newPlayersMonth
+ */
public void setNewPlayersMonth(int newPlayersMonth) {
this.newPlayersMonth = newPlayersMonth;
}
+ /**
+ *
+ * @return
+ */
public int getNewPlayersWeek() {
return newPlayersWeek;
}
+ /**
+ *
+ * @param newPlayersWeek
+ */
public void setNewPlayersWeek(int newPlayersWeek) {
this.newPlayersWeek = newPlayersWeek;
}
+ /**
+ *
+ * @return
+ */
public int getNewPlayersDay() {
return newPlayersDay;
}
+ /**
+ *
+ * @param newPlayersDay
+ */
public void setNewPlayersDay(int newPlayersDay) {
this.newPlayersDay = newPlayersDay;
}
+ /**
+ *
+ * @return
+ */
public long getTotalkills() {
return totalkills;
}
+ /**
+ *
+ * @return
+ */
public long getTotalmobkills() {
return totalmobkills;
}
+ /**
+ *
+ * @return
+ */
public long getTotaldeaths() {
return totaldeaths;
}
+ /**
+ *
+ * @param totalkills
+ */
public void setTotalkills(long totalkills) {
this.totalkills = totalkills;
}
+ /**
+ *
+ * @param totalmobkills
+ */
public void setTotalmobkills(long totalmobkills) {
this.totalmobkills = totalmobkills;
}
+ /**
+ *
+ * @param totaldeaths
+ */
public void setTotaldeaths(long totaldeaths) {
this.totaldeaths = totaldeaths;
}
+ /**
+ *
+ * @return
+ */
public String[] getPlayersDataArray() {
return playersDataArray;
}
+ /**
+ *
+ * @param playersDataArray
+ */
public void setPlayersDataArray(String[] playersDataArray) {
this.playersDataArray = playersDataArray;
}
+ /**
+ *
+ * @param totalCommands
+ */
public void setTotalCommands(long totalCommands) {
this.totalCommands = totalCommands;
}
+ /**
+ *
+ * @return
+ */
public long getTotalCommands() {
return totalCommands;
}
+
+ /**
+ *
+ * @return
+ */
+ public long getSessionAverage() {
+ return sessionAverage;
+ }
+
+ /**
+ *
+ * @param sessionAverage
+ */
+ public void setSessionAverage(long sessionAverage) {
+ this.sessionAverage = sessionAverage;
+ }
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/KillData.java b/Plan/src/main/java/com/djrapitops/plan/data/KillData.java
index 7ad3f10b2..26c3c74d6 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/KillData.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/KillData.java
@@ -13,6 +13,13 @@ public class KillData {
private long date;
private String weapon;
+ /**
+ *
+ * @param victim
+ * @param victimID
+ * @param weapon
+ * @param date
+ */
public KillData(UUID victim, int victimID, String weapon, long date) {
this.victim = victim;
this.weapon = weapon;
@@ -20,18 +27,34 @@ public class KillData {
this.date = date;
}
+ /**
+ *
+ * @return
+ */
public UUID getVictim() {
return victim;
}
+ /**
+ *
+ * @return
+ */
public long getDate() {
return date;
}
+ /**
+ *
+ * @return
+ */
public String getWeapon() {
return weapon;
}
+ /**
+ *
+ * @return
+ */
public int getVictimUserID() {
return victimUserID;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/RawAnalysisData.java b/Plan/src/main/java/com/djrapitops/plan/data/RawAnalysisData.java
index 9751138c6..7d1292c15 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/RawAnalysisData.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/RawAnalysisData.java
@@ -31,6 +31,9 @@ public class RawAnalysisData {
private HashMap commandUse;
private List registered;
+ /**
+ *
+ */
public RawAnalysisData() {
gmZero = 0;
gmOne = 0;
@@ -53,142 +56,282 @@ public class RawAnalysisData {
registered = new ArrayList<>();
}
+ /**
+ *
+ * @param gmZero
+ */
public void addToGmZero(long gmZero) {
this.gmZero += gmZero;
}
+ /**
+ *
+ * @param gmOne
+ */
public void addToGmOne(long gmOne) {
this.gmOne += gmOne;
}
+ /**
+ *
+ * @param gmTwo
+ */
public void addToGmTwo(long gmTwo) {
this.gmTwo += gmTwo;
}
+ /**
+ *
+ * @param gmThree
+ */
public void addGmThree(long gmThree) {
this.gmThree += gmThree;
}
+ /**
+ *
+ * @param totalLoginTimes
+ */
public void addTotalLoginTimes(long totalLoginTimes) {
this.totalLoginTimes += totalLoginTimes;
}
+ /**
+ *
+ * @param totalPlaytime
+ */
public void addTotalPlaytime(long totalPlaytime) {
this.totalPlaytime += totalPlaytime;
}
+ /**
+ *
+ * @param totalBanned
+ */
public void addTotalBanned(int totalBanned) {
this.totalBanned += totalBanned;
}
+ /**
+ *
+ * @param active
+ */
public void addActive(int active) {
this.active += active;
}
+ /**
+ *
+ * @param joinleaver
+ */
public void addJoinleaver(int joinleaver) {
this.joinleaver += joinleaver;
}
+ /**
+ *
+ * @param inactive
+ */
public void addInactive(int inactive) {
this.inactive += inactive;
}
+ /**
+ *
+ * @param totalKills
+ */
public void addTotalKills(long totalKills) {
this.totalKills += totalKills;
}
+ /**
+ *
+ * @param totalMobKills
+ */
public void addTotalMobKills(long totalMobKills) {
this.totalMobKills += totalMobKills;
}
+ /**
+ *
+ * @param totalDeaths
+ */
public void addTotalDeaths(long totalDeaths) {
this.totalDeaths += totalDeaths;
}
+ /**
+ *
+ * @param ops
+ */
public void addOps(int ops) {
this.ops += ops;
}
+ /**
+ *
+ * @return
+ */
public long getGmZero() {
return gmZero;
}
+ /**
+ *
+ * @return
+ */
public long getGmOne() {
return gmOne;
}
+ /**
+ *
+ * @return
+ */
public long getGmTwo() {
return gmTwo;
}
+ /**
+ *
+ * @return
+ */
public long getGmThree() {
return gmThree;
}
+ /**
+ *
+ * @return
+ */
public long getTotalLoginTimes() {
return totalLoginTimes;
}
+ /**
+ *
+ * @return
+ */
public long getTotalPlaytime() {
return totalPlaytime;
}
+ /**
+ *
+ * @return
+ */
public int getTotalBanned() {
return totalBanned;
}
+ /**
+ *
+ * @return
+ */
public int getActive() {
return active;
}
+ /**
+ *
+ * @return
+ */
public int getJoinleaver() {
return joinleaver;
}
+ /**
+ *
+ * @return
+ */
public int getInactive() {
return inactive;
}
+ /**
+ *
+ * @return
+ */
public long getTotalKills() {
return totalKills;
}
+ /**
+ *
+ * @return
+ */
public long getTotalMobKills() {
return totalMobKills;
}
+ /**
+ *
+ * @return
+ */
public long getTotalDeaths() {
return totalDeaths;
}
+ /**
+ *
+ * @return
+ */
public int getOps() {
return ops;
}
+ /**
+ *
+ * @return
+ */
public List getAges() {
return ages;
}
+ /**
+ *
+ * @return
+ */
public HashMap getLatestLogins() {
return latestLogins;
}
+ /**
+ *
+ * @return
+ */
public HashMap getPlaytimes() {
return playtimes;
}
+ /**
+ *
+ * @return
+ */
public List getSessiondata() {
return sessiondata;
}
+ /**
+ *
+ * @param commandUse
+ */
public void setCommandUse(HashMap commandUse) {
this.commandUse = commandUse;
}
+ /**
+ *
+ * @return
+ */
public HashMap getCommandUse() {
return commandUse;
}
+ /**
+ *
+ * @return
+ */
public List getRegistered() {
return registered;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/SessionData.java b/Plan/src/main/java/com/djrapitops/plan/data/SessionData.java
index f22e495d4..07cf8fa8f 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/SessionData.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/SessionData.java
@@ -9,24 +9,45 @@ public class SessionData {
private long sessionStart;
private long sessionEnd;
+ /**
+ *
+ * @param sessionStart
+ */
public SessionData(long sessionStart) {
this.sessionStart = sessionStart;
this.sessionEnd = -1;
}
+ /**
+ *
+ * @param sessionStart
+ * @param sessionEnd
+ */
public SessionData(long sessionStart, long sessionEnd) {
this.sessionStart = sessionStart;
this.sessionEnd = sessionEnd;
}
+ /**
+ *
+ * @param endOfSession
+ */
public void endSession(long endOfSession) {
sessionEnd = endOfSession;
}
+ /**
+ *
+ * @return
+ */
public long getSessionStart() {
return sessionStart;
}
+ /**
+ *
+ * @return
+ */
public long getSessionEnd() {
return sessionEnd;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/UserData.java b/Plan/src/main/java/com/djrapitops/plan/data/UserData.java
index 4ff0d35cf..50a28915e 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/UserData.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/UserData.java
@@ -15,6 +15,10 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
+/**
+ *
+ * @author Rsl1122
+ */
public class UserData {
private int accessing;
@@ -47,6 +51,11 @@ public class UserData {
private SessionData currentSession;
private List sessions;
+ /**
+ *
+ * @param player
+ * @param demData
+ */
public UserData(Player player, DemographicsData demData) {
accessing = 0;
uuid = player.getUniqueId();
@@ -81,6 +90,11 @@ public class UserData {
playerKills = new ArrayList<>();
}
+ /**
+ *
+ * @param player
+ * @param demData
+ */
public UserData(OfflinePlayer player, DemographicsData demData) {
accessing = 0;
uuid = player.getUniqueId();
@@ -113,22 +127,37 @@ public class UserData {
playerKills = new ArrayList<>();
}
-
+ /**
+ *
+ * @param ip
+ */
public void addIpAddress(InetAddress ip) {
if (!ips.contains(ip)) {
ips.add(ip);
}
}
+ /**
+ *
+ * @param addIps
+ */
public void addIpAddresses(Collection addIps) {
ips.addAll(addIps);
}
+ /**
+ *
+ * @param loc
+ */
public void addLocation(Location loc) {
locations.add(loc);
location = loc;
}
+ /**
+ *
+ * @param addLocs
+ */
public void addLocations(Collection addLocs) {
locations.addAll(addLocs);
if (!locations.isEmpty()) {
@@ -136,6 +165,11 @@ public class UserData {
}
}
+ /**
+ *
+ * @param nick
+ * @return
+ */
public boolean addNickname(String nick) {
if (!nicknames.contains(nick)) {
if (!nick.isEmpty()) {
@@ -146,14 +180,30 @@ public class UserData {
return false;
}
+ /**
+ *
+ * @param addNicks
+ */
public void addNicknames(Collection addNicks) {
nicknames.addAll(addNicks);
}
+ /**
+ *
+ * @param gm
+ * @param time
+ */
public void setGMTime(GameMode gm, long time) {
gmTimes.put(gm, time);
}
+ /**
+ *
+ * @param survivalTime
+ * @param creativeTime
+ * @param adventureTime
+ * @param spectatorTime
+ */
public void setAllGMTimes(long survivalTime, long creativeTime, long adventureTime, long spectatorTime) {
gmTimes.clear();
gmTimes.put(GameMode.SURVIVAL, survivalTime);
@@ -165,12 +215,20 @@ public class UserData {
}
}
+ /**
+ *
+ * @param session
+ */
public void addSession(SessionData session) {
if (session != null) {
sessions.add(session);
}
}
+ /**
+ *
+ * @param sessions
+ */
public void addSessions(Collection sessions) {
Collection filteredSessions = sessions.parallelStream()
.filter(session -> session != null)
@@ -178,201 +236,397 @@ public class UserData {
this.sessions.addAll(filteredSessions);
}
+ /**
+ *
+ * @param session
+ */
public void setCurrentSession(SessionData session) {
currentSession = session;
}
+ /**
+ *
+ * @param isBanned
+ */
public void updateBanned(boolean isBanned) {
this.isBanned = isBanned;
}
+ /**
+ *
+ * @return
+ */
public boolean isAccessed() {
return accessing > 0;
}
+ /**
+ *
+ */
public void access() {
accessing++;
}
+ /**
+ *
+ */
public void stopAccessing() {
accessing--;
}
// Getters -------------------------------------------------------------
+ /**
+ *
+ * @return
+ */
+
public UUID getUuid() {
return uuid;
}
+ /**
+ *
+ * @return
+ */
public Location getLocation() {
return location;
}
+ /**
+ *
+ * @return
+ */
public List getLocations() {
return locations;
}
+ /**
+ *
+ * @return
+ */
public HashSet getIps() {
return ips;
}
+ /**
+ *
+ * @return
+ */
public HashSet getNicknames() {
return nicknames;
}
+ /**
+ *
+ * @return
+ */
public long getRegistered() {
return registered;
}
+ /**
+ *
+ * @return
+ */
public long getLastPlayed() {
return lastPlayed;
}
+ /**
+ *
+ * @return
+ */
public long getPlayTime() {
return playTime;
}
+ /**
+ *
+ * @return
+ */
public int getLoginTimes() {
return loginTimes;
}
+ /**
+ *
+ * @return
+ */
public int getTimesKicked() {
return timesKicked;
}
+ /**
+ *
+ * @return
+ */
public HashMap getGmTimes() {
return gmTimes;
}
+ /**
+ *
+ * @return
+ */
public long getLastGmSwapTime() {
return lastGmSwapTime;
}
+ /**
+ *
+ * @return
+ */
public GameMode getLastGamemode() {
return lastGamemode;
}
+ /**
+ *
+ * @return
+ */
public boolean isOp() {
return isOp;
}
+ /**
+ *
+ * @return
+ */
public boolean isBanned() {
return isBanned;
}
+ /**
+ *
+ * @return
+ */
public DemographicsData getDemData() {
return demData;
}
+ /**
+ *
+ * @return
+ */
public String getName() {
return name;
}
// Setters -------------------------------------------------------------
+
+ /**
+ *
+ * @param uuid
+ */
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
+ /**
+ *
+ * @param location
+ */
public void setLocation(Location location) {
this.location = location;
}
+ /**
+ *
+ * @param locations
+ */
public void setLocations(List locations) {
this.locations = locations;
}
+ /**
+ *
+ * @param ips
+ */
public void setIps(HashSet ips) {
this.ips = ips;
}
+ /**
+ *
+ * @param nicknames
+ */
public void setNicknames(HashSet nicknames) {
this.nicknames = nicknames;
}
+ /**
+ *
+ * @param registered
+ */
public void setRegistered(long registered) {
this.registered = registered;
}
+ /**
+ *
+ * @param lastPlayed
+ */
public void setLastPlayed(long lastPlayed) {
this.lastPlayed = lastPlayed;
}
+ /**
+ *
+ * @param playTime
+ */
public void setPlayTime(long playTime) {
this.playTime = playTime;
}
+ /**
+ *
+ * @param loginTimes
+ */
public void setLoginTimes(int loginTimes) {
this.loginTimes = loginTimes;
}
+ /**
+ *
+ * @param timesKicked
+ */
public void setTimesKicked(int timesKicked) {
this.timesKicked = timesKicked;
}
+ /**
+ *
+ * @param gmTimes
+ */
public void setGmTimes(HashMap gmTimes) {
this.gmTimes = gmTimes;
}
+ /**
+ *
+ * @param lastGmSwapTime
+ */
public void setLastGmSwapTime(long lastGmSwapTime) {
this.lastGmSwapTime = lastGmSwapTime;
}
+ /**
+ *
+ * @param lastGamemode
+ */
public void setLastGamemode(GameMode lastGamemode) {
this.lastGamemode = lastGamemode;
}
+ /**
+ *
+ * @param isOp
+ */
public void setIsOp(boolean isOp) {
this.isOp = isOp;
}
+ /**
+ *
+ * @param demData
+ */
public void setDemData(DemographicsData demData) {
this.demData = demData;
}
+ /**
+ *
+ * @param name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ *
+ * @return
+ */
public boolean isOnline() {
return isOnline;
}
+ /**
+ *
+ * @return
+ */
public int getMobKills() {
return mobKills;
}
+ /**
+ *
+ * @param mobKills
+ */
public void setMobKills(int mobKills) {
this.mobKills = mobKills;
}
+ /**
+ *
+ * @return
+ */
public List getPlayerKills() {
return playerKills;
}
+ /**
+ *
+ * @param playerKills
+ */
public void setPlayerKills(List playerKills) {
this.playerKills = playerKills;
}
+ /**
+ *
+ * @param kill
+ */
public void addPlayerKill(KillData kill) {
playerKills.add(kill);
}
+ /**
+ *
+ * @return
+ */
public int getDeaths() {
return deaths;
}
+ /**
+ *
+ * @param deaths
+ */
public void setDeaths(int deaths) {
this.deaths = deaths;
}
+ /**
+ *
+ * @return
+ */
public List getSessions() {
return sessions;
}
+ /**
+ *
+ * @return
+ */
public String getLastNick() {
return lastNick;
}
+ /**
+ *
+ * @param lastNick
+ */
public void setLastNick(String lastNick) {
this.lastNick = lastNick;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/AdvancedAchievementsHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/AdvancedAchievementsHook.java
index aed2856c6..b297d2872 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/AdvancedAchievementsHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/AdvancedAchievementsHook.java
@@ -33,6 +33,9 @@ public class AdvancedAchievementsHook extends Hook {
}
}
+ /**
+ *
+ */
public AdvancedAchievementsHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/EssentialsHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/EssentialsHook.java
index 5371f2ffe..b2698e85d 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/EssentialsHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/EssentialsHook.java
@@ -33,6 +33,9 @@ public class EssentialsHook extends Hook {
}
}
+ /**
+ *
+ */
public EssentialsHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/FactionsHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/FactionsHook.java
index 5decf7ce0..3781b7e0a 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/FactionsHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/FactionsHook.java
@@ -34,6 +34,9 @@ public class FactionsHook extends Hook {
this.plugin = plugin;
}
+ /**
+ *
+ */
public FactionsHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/Hook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/Hook.java
index 657e0bba3..d689cf9de 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/Hook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/Hook.java
@@ -25,6 +25,9 @@ public abstract class Hook {
}
}
+ /**
+ *
+ */
public Hook() {
enabled = false;
}
@@ -36,6 +39,10 @@ public abstract class Hook {
return enabled;
}
+ /**
+ *
+ * @param enabled
+ */
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java
index 9d52c51b0..a8b160cf6 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java
@@ -23,11 +23,18 @@ public class HookHandler {
private OnTimeHook onTimeHook;
private TownyHook townyHook;
+ /**
+ *
+ * @param plan
+ */
public HookHandler(Plan plan) {
this.plan = plan;
hook();
}
+ /**
+ *
+ */
public void reloadHooks() {
hook();
}
@@ -65,30 +72,58 @@ public class HookHandler {
}
}
+ /**
+ *
+ * @return
+ */
public AdvancedAchievementsHook getAdvancedAchievementsHook() {
return advancedAchievementsHook;
}
+ /**
+ *
+ * @return
+ */
public EssentialsHook getEssentialsHook() {
return essentialsHook;
}
+ /**
+ *
+ * @return
+ */
public SuperbVoteHook getSuperbVoteHook() {
return superbVoteHook;
}
+ /**
+ *
+ * @return
+ */
public FactionsHook getFactionsHook() {
return factionsHook;
}
+ /**
+ *
+ * @return
+ */
public TownyHook getTownyHook() {
return townyHook;
}
+ /**
+ *
+ * @return
+ */
public OnTimeHook getOnTimeHook() {
return onTimeHook;
}
+ /**
+ *
+ * @return
+ */
public Map getAdditionalAnalysisReplaceRules() {
Map addReplace = new HashMap<>();
AdvancedAchievementsHook aH = advancedAchievementsHook;
@@ -102,6 +137,11 @@ public class HookHandler {
return addReplace;
}
+ /**
+ *
+ * @param uuid
+ * @return
+ */
public Map getAdditionalInspectReplaceRules(UUID uuid) {
Map addReplace = new HashMap<>();
AdvancedAchievementsHook aH = advancedAchievementsHook;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/OnTimeHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/OnTimeHook.java
index 182dafc5d..bf8d8ac9c 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/OnTimeHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/OnTimeHook.java
@@ -25,6 +25,9 @@ public class OnTimeHook extends Hook {
this.plugin = plugin;
}
+ /**
+ *
+ */
public OnTimeHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/SuperbVoteHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/SuperbVoteHook.java
index 42717c951..f4805fffe 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/SuperbVoteHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/SuperbVoteHook.java
@@ -23,6 +23,9 @@ public class SuperbVoteHook extends Hook {
this.plugin = plugin;
}
+ /**
+ *
+ */
public SuperbVoteHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/additional/TownyHook.java b/Plan/src/main/java/com/djrapitops/plan/data/additional/TownyHook.java
index 035e15d1c..a10fc9f19 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/additional/TownyHook.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/additional/TownyHook.java
@@ -36,6 +36,9 @@ public class TownyHook extends Hook {
this.towny = getPlugin(Towny.class);
}
+ /**
+ *
+ */
public TownyHook() {
super();
plugin = null;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DBCallableProcessor.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DBCallableProcessor.java
index 9fd5690c1..0be43d5cc 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DBCallableProcessor.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DBCallableProcessor.java
@@ -8,5 +8,10 @@ import main.java.com.djrapitops.plan.data.UserData;
* @author Rsl1122
*/
public abstract class DBCallableProcessor {
+
+ /**
+ *
+ * @param data
+ */
public abstract void process(UserData data);
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheClearQueue.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheClearQueue.java
index 35412ed44..f6c16083d 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheClearQueue.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheClearQueue.java
@@ -5,6 +5,7 @@ import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan;
+import main.java.com.djrapitops.plan.Settings;
import static org.bukkit.Bukkit.getOfflinePlayer;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@@ -17,20 +18,36 @@ public class DataCacheClearQueue {
private BlockingQueue q;
private ClearSetup s;
+ /**
+ *
+ * @param plugin
+ * @param handler
+ */
public DataCacheClearQueue(Plan plugin, DataCacheHandler handler) {
- q = new ArrayBlockingQueue(1000);
+ q = new ArrayBlockingQueue(Settings.PROCESS_CLEAR_LIMIT.getNumber());
s = new ClearSetup();
s.go(q, handler);
}
+ /**
+ *
+ * @param uuid
+ */
public void scheduleForClear(UUID uuid) {
q.add(uuid);
}
+ /**
+ *
+ * @param uuids
+ */
public void scheduleForClear(Collection uuids) {
q.addAll(uuids);
}
+ /**
+ *
+ */
public void stop() {
s.stop();
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheGetQueue.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheGetQueue.java
index ebec44f7d..f8cebc640 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheGetQueue.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheGetQueue.java
@@ -9,6 +9,7 @@ import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan;
+import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.database.Database;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@@ -21,12 +22,21 @@ public class DataCacheGetQueue {
private BlockingQueue>> q;
private GetSetup s;
+ /**
+ *
+ * @param plugin
+ */
public DataCacheGetQueue(Plan plugin) {
- q = new ArrayBlockingQueue(1000);
+ q = new ArrayBlockingQueue(Settings.PROCESS_GET_LIMIT.getNumber());
s = new GetSetup();
s.go(q, plugin.getDB());
}
+ /**
+ *
+ * @param uuid
+ * @param processors
+ */
public void scheduleForGet(UUID uuid, DBCallableProcessor... processors) {
HashMap> map = new HashMap<>();
if (map.get(uuid) == null) {
@@ -36,6 +46,9 @@ public class DataCacheGetQueue {
q.add(map);
}
+ /**
+ *
+ */
public void stop() {
s.stop();
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java
index 8f961dff2..3c3e1e796 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java
@@ -220,6 +220,10 @@ public class DataCacheHandler {
}
// Should only be called from Async thread
+
+ /**
+ *
+ */
public void saveHandlerDataToCache() {
Bukkit.getServer().getOnlinePlayers().parallelStream().forEach((p) -> {
saveHandlerDataToCache(p);
@@ -255,10 +259,19 @@ public class DataCacheHandler {
plugin.log(Phrase.CACHE_REMOVE.parse(uuid.toString()));
}
+ /**
+ *
+ * @param uuid
+ */
public void scheludeForClear(UUID uuid) {
clearTask.scheduleForClear(uuid);
}
+ /**
+ *
+ * @param uuid
+ * @return
+ */
public boolean isDataAccessed(UUID uuid) {
UserData userData = dataCache.get(uuid);
if (userData != null) {
@@ -276,6 +289,10 @@ public class DataCacheHandler {
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
}
+ /**
+ *
+ * @param player
+ */
public void newPlayer(OfflinePlayer player) {
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
}
@@ -329,6 +346,10 @@ public class DataCacheHandler {
return gamemodeTimesHandler;
}
+ /**
+ *
+ * @return
+ */
public KillHandler getKillHandler() {
return killHandler;
}
@@ -342,6 +363,10 @@ public class DataCacheHandler {
return db;
}
+ /**
+ *
+ * @return
+ */
public HashMap getCommandUse() {
return commandUse;
}
@@ -353,6 +378,10 @@ public class DataCacheHandler {
return commandUseHandler;
}
+ /**
+ *
+ * @return
+ */
public SessionHandler getSessionHandler() {
return sessionHandler;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheSaveQueue.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheSaveQueue.java
index 068190afe..b155f5a3d 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheSaveQueue.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheSaveQueue.java
@@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan;
+import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.database.Database;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@@ -18,24 +19,43 @@ public class DataCacheSaveQueue {
private BlockingQueue q;
private SaveSetup s;
+ /**
+ *
+ * @param plugin
+ */
public DataCacheSaveQueue(Plan plugin) {
- q = new ArrayBlockingQueue(1000);
+ q = new ArrayBlockingQueue(Settings.PROCESS_SAVE_LIMIT.getNumber());
s = new SaveSetup();
s.go(q, plugin.getDB());
}
+ /**
+ *
+ * @param data
+ */
public void scheduleForSave(UserData data) {
q.add(data);
}
+ /**
+ *
+ * @param data
+ */
public void scheduleForSave(Collection data) {
q.addAll(data);
}
+ /**
+ *
+ * @param data
+ */
public void scheduleNewPlayer(UserData data) {
q.add(data);
}
+ /**
+ *
+ */
public void stop() {
s.stop();
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/InspectCacheHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/InspectCacheHandler.java
index 8790a7f18..06770ac8b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/cache/InspectCacheHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/InspectCacheHandler.java
@@ -46,6 +46,11 @@ public class InspectCacheHandler {
cache(uuid, minutes);
}
+ /**
+ *
+ * @param uuid
+ * @param minutes
+ */
public void cache(UUID uuid, int minutes) {
DBCallableProcessor cacher = new DBCallableProcessor() {
@Override
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/handlers/BasicInfoHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/handlers/BasicInfoHandler.java
index 11cccf174..c9ed26a63 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/handlers/BasicInfoHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/handlers/BasicInfoHandler.java
@@ -47,6 +47,11 @@ public class BasicInfoHandler {
data.addIpAddress(ip);
}
+ /**
+ *
+ * @param nickname
+ * @param data
+ */
public void addNickname(String nickname, UserData data) {
if (!nickname.isEmpty()) {
if (data.addNickname(nickname)) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/handlers/KillHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/handlers/KillHandler.java
index e9ae7ae4f..0a8df01b8 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/handlers/KillHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/handlers/KillHandler.java
@@ -14,10 +14,20 @@ import main.java.com.djrapitops.plan.data.UserData;
public class KillHandler {
private Plan plugin;
+ /**
+ *
+ * @param plugin
+ */
public KillHandler(Plan plugin) {
this.plugin = plugin;
}
+ /**
+ *
+ * @param killerData
+ * @param victimUUID
+ * @param weapon
+ */
public void handlePlayerKill(UserData killerData, UUID victimUUID, String weapon) {
long now = new Date().toInstant().getEpochSecond()*(long)1000;
int victimID;
@@ -30,10 +40,18 @@ public class KillHandler {
killerData.addPlayerKill(new KillData(victimUUID, victimID, weapon, now));
}
+ /**
+ *
+ * @param data
+ */
public void handlePlayerDeath(UserData data) {
data.setDeaths(data.getDeaths()+1);
}
+ /**
+ *
+ * @param data
+ */
public void handleMobKill(UserData data) {
data.setMobKills(data.getMobKills()+1);
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/handlers/LocationHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/handlers/LocationHandler.java
index 2f2f4a969..6c99baf1e 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/handlers/LocationHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/handlers/LocationHandler.java
@@ -53,6 +53,11 @@ public class LocationHandler {
locations.get(uuid).addAll(locs);
}
+ /**
+ *
+ * @param uuid
+ * @return
+ */
public List getLocationsForSaving(UUID uuid) {
if (!locations.containsKey(uuid)) {
return new ArrayList<>();
@@ -60,6 +65,10 @@ public class LocationHandler {
return locations.get(uuid);
}
+ /**
+ *
+ * @param uuid
+ */
public void clearLocations(UUID uuid) {
locations.remove(uuid);
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/handlers/SessionHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/handlers/SessionHandler.java
index 181d79849..21c334525 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/handlers/SessionHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/handlers/SessionHandler.java
@@ -18,12 +18,20 @@ public class SessionHandler {
private final DataCacheHandler handler;
private final Plan plugin;
+ /**
+ *
+ * @param plugin
+ */
public SessionHandler(Plan plugin) {
this.plugin = plugin;
this.handler = plugin.getHandler();
this.activeSessions = new HashMap<>();
}
+ /**
+ *
+ * @param data
+ */
public void startSession(UserData data) {
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
SessionData session = new SessionData(now);
@@ -31,6 +39,10 @@ public class SessionHandler {
data.setCurrentSession(session);
}
+ /**
+ *
+ * @param data
+ */
public void endSession (UserData data) {
UUID uuid = data.getUuid();
SessionData currentSession = activeSessions.get(uuid);
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/importing/Importer.java b/Plan/src/main/java/com/djrapitops/plan/data/importing/Importer.java
index 67b31f0ef..bbbb491a5 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/importing/Importer.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/importing/Importer.java
@@ -10,6 +10,17 @@ import java.util.UUID;
* @author Rsl1122
*/
public interface Importer {
+
+ /**
+ *
+ * @param uuids
+ * @return
+ */
public HashMap grabNumericData(Set uuids);
+
+ /**
+ *
+ * @return
+ */
public boolean isEnabled();
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/importing/OnTimeImporter.java b/Plan/src/main/java/com/djrapitops/plan/data/importing/OnTimeImporter.java
index a5b36ba9d..4fe405925 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/importing/OnTimeImporter.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/importing/OnTimeImporter.java
@@ -17,11 +17,20 @@ public class OnTimeImporter implements Importer {
private final Plan plugin;
private boolean enabled;
+ /**
+ *
+ * @param plugin
+ */
public OnTimeImporter(Plan plugin) {
this.plugin = plugin;
this.enabled = Bukkit.getPluginManager().isPluginEnabled("OnTime");
}
+ /**
+ *
+ * @param uuids
+ * @return
+ */
@Override
public HashMap grabNumericData(Set uuids) {
HashMap onTimeData = new HashMap<>();
@@ -35,6 +44,10 @@ public class OnTimeImporter implements Importer {
return onTimeData;
}
+ /**
+ *
+ * @return
+ */
@Override
public boolean isEnabled() {
return enabled;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java
index 0eab581e9..47ce7f4f2 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java
@@ -22,6 +22,10 @@ public class PlanDeathEventListener implements Listener {
private final DataCacheHandler handler;
private final KillHandler kH;
+ /**
+ *
+ * @param plugin
+ */
public PlanDeathEventListener(Plan plugin) {
this.plugin = plugin;
this.handler = plugin.getHandler();
@@ -51,6 +55,13 @@ public class PlanDeathEventListener implements Listener {
}
}
+ /**
+ *
+ * @param dead
+ * @param killerIsPlayer
+ * @param killer
+ * @param killersData
+ */
public void continueProcessing(LivingEntity dead, boolean killerIsPlayer, Player killer, UserData killersData) {
if (dead instanceof Player) {
Player killed = (Player) dead;
diff --git a/Plan/src/main/java/com/djrapitops/plan/database/Database.java b/Plan/src/main/java/com/djrapitops/plan/database/Database.java
index a5df7786f..43c891499 100644
--- a/Plan/src/main/java/com/djrapitops/plan/database/Database.java
+++ b/Plan/src/main/java/com/djrapitops/plan/database/Database.java
@@ -15,36 +15,153 @@ public abstract class Database {
private final Plan plugin;
+ /**
+ *
+ * @param plugin
+ */
public Database(Plan plugin) {
this.plugin = plugin;
}
+
+ /**
+ *
+ * @return
+ */
public boolean init(){
return false;
}
+
+ /**
+ *
+ * @param uuid
+ * @param processors
+ * @throws SQLException
+ */
public void giveUserDataToProcessors(UUID uuid, DBCallableProcessor... processors) throws SQLException {
List coll = new ArrayList<>();
coll.addAll(Arrays.asList(processors));
giveUserDataToProcessors(uuid, coll);
}
+
+ /**
+ *
+ * @param uuid
+ * @param processors
+ * @throws SQLException
+ */
public abstract void giveUserDataToProcessors(UUID uuid, Collection processors) throws SQLException;
+
+ /**
+ *
+ * @param uuid
+ * @param data
+ * @throws SQLException
+ */
public abstract void saveUserData(UUID uuid, UserData data) throws SQLException;
+
+ /**
+ *
+ * @param data
+ * @throws SQLException
+ */
public abstract void saveMultipleUserData(List data) throws SQLException;
+
+ /**
+ *
+ * @param uuid
+ * @return
+ */
public abstract boolean wasSeenBefore(UUID uuid);
+
+ /**
+ *
+ */
public abstract void clean();
+
+ /**
+ *
+ * @return
+ */
public abstract String getName();
+
+ /**
+ *
+ * @return
+ */
public String getConfigName() {
return getName().toLowerCase().replace(" ", "");
}
+
+ /**
+ *
+ * @return
+ */
public ConfigurationSection getConfigSection() {
return plugin.getConfig().getConfigurationSection(getConfigName());
}
+
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
public abstract int getVersion() throws SQLException;
+
+ /**
+ *
+ * @param version
+ * @throws SQLException
+ */
public abstract void setVersion(int version) throws SQLException;
+
+ /**
+ *
+ * @throws SQLException
+ */
public abstract void close() throws SQLException;
+
+ /**
+ *
+ * @param uuid
+ * @return
+ * @throws SQLException
+ */
public abstract boolean removeAccount(String uuid) throws SQLException;
+
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
public abstract boolean removeAllData() throws SQLException;
+
+ /**
+ *
+ * @param data
+ * @throws SQLException
+ * @throws NullPointerException
+ */
public abstract void saveCommandUse(HashMap data) throws SQLException, NullPointerException;
+
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
public abstract Set getSavedUUIDs() throws SQLException;
+
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
public abstract HashMap getCommandUse() throws SQLException;
+
+ /**
+ *
+ * @param uuid
+ * @return
+ * @throws SQLException
+ */
public abstract int getUserId(String uuid) throws SQLException;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java b/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java
index 398eaf72b..eb07c6db0 100644
--- a/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java
+++ b/Plan/src/main/java/com/djrapitops/plan/database/databases/MySQLDB.java
@@ -45,6 +45,10 @@ public class MySQLDB extends SQLDB {
}
}
+ /**
+ *
+ * @return
+ */
@Override
public String getName() {
return "MySQL";
diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java
index 84a273a8b..9e803e63b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java
+++ b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java
@@ -24,6 +24,10 @@ import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable;
import static org.bukkit.Bukkit.getOfflinePlayer;
+/**
+ *
+ * @author Rsl1122
+ */
public abstract class SQLDB extends Database {
final Plan plugin;
@@ -88,6 +92,11 @@ public abstract class SQLDB extends Database {
private String versionName;
+ /**
+ *
+ * @param plugin
+ * @param supportsModification
+ */
public SQLDB(Plan plugin, boolean supportsModification) {
super(plugin);
this.plugin = plugin;
@@ -166,6 +175,10 @@ public abstract class SQLDB extends Database {
}).runTaskTimerAsynchronously(plugin, 60 * 20, 60 * 20);
}
+ /**
+ *
+ * @return
+ */
@Override
public boolean init() {
super.init();
@@ -177,6 +190,11 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
public boolean checkConnection() throws SQLException {
if (connection == null || connection.isClosed()) {
connection = getNewConnection();
@@ -304,13 +322,27 @@ public abstract class SQLDB extends Database {
return true;
}
+ /**
+ *
+ * @return
+ */
protected abstract Connection getNewConnection();
+ /**
+ *
+ * @param sql
+ * @return
+ * @throws SQLException
+ */
public boolean query(String sql) throws SQLException {
boolean success = connection.createStatement().execute(sql);
return success;
}
+ /**
+ *
+ * @throws SQLException
+ */
@Override
public void close() throws SQLException {
if (connection != null) {
@@ -318,6 +350,11 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
@Override
public int getVersion() throws SQLException {
int version = 0;
@@ -332,6 +369,11 @@ public abstract class SQLDB extends Database {
return version;
}
+ /**
+ *
+ * @param version
+ * @throws SQLException
+ */
@Override
public void setVersion(int version) throws SQLException {
connection.prepareStatement("DELETE FROM " + versionName).executeUpdate();
@@ -339,6 +381,11 @@ public abstract class SQLDB extends Database {
}
+ /**
+ *
+ * @param uuid
+ * @return
+ */
@Override
public boolean wasSeenBefore(UUID uuid) {
try {
@@ -349,6 +396,12 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @param uuid
+ * @return
+ * @throws SQLException
+ */
@Override
public int getUserId(String uuid) throws SQLException {
int userId = -1;
@@ -384,6 +437,11 @@ public abstract class SQLDB extends Database {
return uuid;
}
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
@Override
public Set getSavedUUIDs() throws SQLException {
Set uuids = new HashSet<>();
@@ -400,6 +458,12 @@ public abstract class SQLDB extends Database {
return uuids;
}
+ /**
+ *
+ * @param data
+ * @throws SQLException
+ * @throws NullPointerException
+ */
@Override
public void saveCommandUse(HashMap data) throws SQLException, NullPointerException {
if (data.isEmpty()) {
@@ -434,6 +498,11 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
@Override
public HashMap getCommandUse() throws SQLException {
HashMap commandUse = new HashMap<>();
@@ -450,6 +519,12 @@ public abstract class SQLDB extends Database {
return commandUse;
}
+ /**
+ *
+ * @param uuid
+ * @return
+ * @throws SQLException
+ */
@Override
public boolean removeAccount(String uuid) throws SQLException {
try {
@@ -497,6 +572,12 @@ public abstract class SQLDB extends Database {
return true;
}
+ /**
+ *
+ * @param uuid
+ * @param processors
+ * @throws SQLException
+ */
@Override
public void giveUserDataToProcessors(UUID uuid, Collection processors) throws SQLException {
try {
@@ -665,13 +746,18 @@ public abstract class SQLDB extends Database {
return killData;
}
+ /**
+ *
+ * @param data
+ * @throws SQLException
+ */
@Override
public void saveMultipleUserData(List data) throws SQLException {
checkConnection();
if (data.isEmpty()) {
return;
}
- Set exceptions = new HashSet<>();
+ Set exceptions = new HashSet<>();
List saveLast = new ArrayList<>();
String uSQL = "UPDATE " + userName + " SET "
+ userColumnDemAge + "=?, "
@@ -778,6 +864,12 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @param uuid
+ * @param data
+ * @throws SQLException
+ */
@Override
public void saveUserData(UUID uuid, UserData data) throws SQLException {
if (uuid == null) {
@@ -866,6 +958,12 @@ public abstract class SQLDB extends Database {
data.stopAccessing();
}
+ /**
+ *
+ * @param userId
+ * @param locations
+ * @throws SQLException
+ */
public void saveAdditionalLocationsList(int userId, List locations) throws SQLException {
List newLocations = new ArrayList<>();
newLocations.addAll(locations);
@@ -900,6 +998,13 @@ public abstract class SQLDB extends Database {
saveStatement.close();
}
+ /**
+ *
+ * @param userId
+ * @param names
+ * @param lastNick
+ * @throws SQLException
+ */
public void saveNickList(int userId, HashSet names, String lastNick) throws SQLException {
if (names.isEmpty()) {
return;
@@ -929,6 +1034,12 @@ public abstract class SQLDB extends Database {
statement.close();
}
+ /**
+ *
+ * @param userId
+ * @param sessions
+ * @throws SQLException
+ */
public void saveSessionList(int userId, List sessions) throws SQLException {
if (sessions.isEmpty()) {
return;
@@ -958,6 +1069,12 @@ public abstract class SQLDB extends Database {
statement.close();
}
+ /**
+ *
+ * @param userId
+ * @param kills
+ * @throws SQLException
+ */
public void savePlayerKills(int userId, List kills) throws SQLException {
if (kills.isEmpty()) {
return;
@@ -989,6 +1106,12 @@ public abstract class SQLDB extends Database {
statement.close();
}
+ /**
+ *
+ * @param userId
+ * @param ips
+ * @throws SQLException
+ */
public void saveIPList(int userId, HashSet ips) throws SQLException {
if (ips.isEmpty()) {
return;
@@ -1017,6 +1140,12 @@ public abstract class SQLDB extends Database {
statement.close();
}
+ /**
+ *
+ * @param userId
+ * @param gamemodeTimes
+ * @throws SQLException
+ */
public void saveGMTimes(int userId, HashMap gamemodeTimes) throws SQLException {
if (gamemodeTimes.isEmpty()) {
return;
@@ -1054,6 +1183,9 @@ public abstract class SQLDB extends Database {
}
+ /**
+ *
+ */
@Override
public void clean() {
try {
@@ -1064,6 +1196,10 @@ public abstract class SQLDB extends Database {
}
}
+ /**
+ *
+ * @return
+ */
@Override
public boolean removeAllData() {
try {
@@ -1093,10 +1229,18 @@ public abstract class SQLDB extends Database {
return success;
}
+ /**
+ *
+ * @return
+ */
public boolean supportsModification() {
return supportsModification;
}
+ /**
+ *
+ * @return
+ */
public Connection getConnection() {
return connection;
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java
index dec7f6eff..d09b89cda 100644
--- a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java
+++ b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLiteDB.java
@@ -24,6 +24,11 @@ public class SQLiteDB extends SQLDB {
this(plugin, "database");
}
+ /**
+ *
+ * @param plugin
+ * @param dbName
+ */
public SQLiteDB(Plan plugin, String dbName) {
super(plugin, false);
@@ -41,6 +46,11 @@ public class SQLiteDB extends SQLDB {
return getNewConnection(dbName);
}
+ /**
+ *
+ * @param dbName
+ * @return
+ */
public Connection getNewConnection(String dbName) {
try {
Class.forName("org.sqlite.JDBC");
@@ -52,6 +62,10 @@ public class SQLiteDB extends SQLDB {
}
}
+ /**
+ *
+ * @return
+ */
@Override
public String getName() {
return "SQLite";
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/Html.java b/Plan/src/main/java/com/djrapitops/plan/ui/Html.java
index 50ac5ea5d..085c68fbe 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/Html.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/Html.java
@@ -49,8 +49,8 @@ public enum Html {
OPERATOR(", Operator (Op)"),
ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")),
OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")),
- ACTIVE("| Player is Active"),
- INACTIVE("| Player is inactive"),
+ ACTIVE("Player is Active"),
+ INACTIVE("Player is inactive"),
ERROR_LIST("Error Creating List
"),
HIDDEN("Hidden (config)"),
ERROR_NOT_SET("Error: Replace rule was not set"),
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/graphs/PlayerActivityGraphCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/graphs/PlayerActivityGraphCreator.java
index 66d9d8940..5df63670b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/graphs/PlayerActivityGraphCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/graphs/PlayerActivityGraphCreator.java
@@ -15,6 +15,12 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/
public class PlayerActivityGraphCreator {
+ /**
+ *
+ * @param sessionData
+ * @param scale
+ * @return
+ */
public static String[] generateDataArray(List sessionData, long scale) {
Plan plugin = getPlugin(Plan.class);
int maxPlayers = plugin.getHandler().getMaxPlayers();
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableCommandUseTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableCommandUseTableCreator.java
index d76e3b6f7..a64427dbf 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableCommandUseTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableCommandUseTableCreator.java
@@ -14,6 +14,11 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/
public class SortableCommandUseTableCreator {
+ /**
+ *
+ * @param commandUse
+ * @return
+ */
public static String createSortedCommandUseTable(HashMap commandUse) {
List sorted = MapComparator.sortByValue(commandUse);
String html = "";
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableFactionsTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableFactionsTableCreator.java
index bc2fe87e9..1424045da 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableFactionsTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableFactionsTableCreator.java
@@ -13,6 +13,12 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/
public class SortableFactionsTableCreator {
+ /**
+ *
+ * @param factionList
+ * @param fHook
+ * @return
+ */
public static String createSortableFactionsTable(Collection factionList, FactionsHook fHook) {
String html = Html.TABLE_FACTIONS_START.parse();
if (factionList.isEmpty()) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableKillsTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableKillsTableCreator.java
index 9d6964edc..eb148cd06 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableKillsTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableKillsTableCreator.java
@@ -14,6 +14,11 @@ import static org.bukkit.Bukkit.getOfflinePlayer;
*/
public class SortableKillsTableCreator {
+ /**
+ *
+ * @param killData
+ * @return
+ */
public static String createSortedSessionDataTable10(List killData) {
String html = Html.TABLE_KILLS_START.parse();
if (killData.isEmpty()) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortablePlayersTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortablePlayersTableCreator.java
index 66a835a4b..ce1280ebf 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortablePlayersTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortablePlayersTableCreator.java
@@ -13,6 +13,11 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/
public class SortablePlayersTableCreator {
+ /**
+ *
+ * @param data
+ * @return
+ */
public static String createSortablePlayersTable(Collection data) {
String html = "";
for (UserData uData : data) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableSessionTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableSessionTableCreator.java
index 58a246d85..eedf7f52d 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableSessionTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableSessionTableCreator.java
@@ -13,6 +13,11 @@ import main.java.com.djrapitops.plan.utilities.comparators.SessionDataComparator
*/
public class SortableSessionTableCreator {
+ /**
+ *
+ * @param sessionData
+ * @return
+ */
public static String createSortedSessionDataTable10(List sessionData) {
String html = Html.TABLE_SESSIONS_START.parse();
if (sessionData.isEmpty()) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableTownTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableTownTableCreator.java
index f6993ddda..a3b5ab894 100644
--- a/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableTownTableCreator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/tables/SortableTownTableCreator.java
@@ -13,6 +13,12 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/
public class SortableTownTableCreator {
+ /**
+ *
+ * @param townNames
+ * @param tHook
+ * @return
+ */
public static String createSortableTownsTable(Collection townNames, TownyHook tHook) {
String html = Html.TABLE_TOWNS_START.parse();
if (townNames.isEmpty()) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java
index fcfe8f493..aad44ebc8 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java
@@ -21,9 +21,6 @@ import org.bukkit.GameMode;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import static org.bukkit.Bukkit.getOfflinePlayer;
-import static org.bukkit.Bukkit.getOfflinePlayer;
-import static org.bukkit.Bukkit.getOfflinePlayer;
-import static org.bukkit.Bukkit.getOfflinePlayer;
/**
*
@@ -152,6 +149,7 @@ public class Analysis {
long totalPlaytime = sorted.getTotalPlaytime();
analysisData.setTotalPlayTime(totalPlaytime);
analysisData.setAveragePlayTime(totalPlaytime / rawData.size());
+ analysisData.setSessionAverage(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(sorted.getSessiondata())));
analysisData.setTotalLoginTimes(sorted.getTotalLoginTimes());
createActivityVisalization(sorted.getTotalBanned(), sorted.getActive(), sorted.getInactive(), sorted.getJoinleaver(), analysisData);
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java
index 7dcd0f502..9056505cd 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java
@@ -1,11 +1,13 @@
package main.java.com.djrapitops.plan.utilities;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import main.java.com.djrapitops.plan.Settings;
+import main.java.com.djrapitops.plan.data.SessionData;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.ui.Html;
import main.java.com.djrapitops.plan.ui.tables.SortableCommandUseTableCreator;
@@ -18,6 +20,13 @@ import main.java.com.djrapitops.plan.utilities.comparators.MapComparator;
*/
public class AnalysisUtils {
+ /**
+ *
+ * @param lastPlayed
+ * @param playTime
+ * @param loginTimes
+ * @return
+ */
public static boolean isActive(long lastPlayed, long playTime, int loginTimes) {
int timeToActive = Settings.ANALYSIS_MINUTES_FOR_ACTIVE.getNumber();
if (timeToActive < 0) {
@@ -73,4 +82,23 @@ public class AnalysisUtils {
return newPlayers;
}
+
+ static List transformSessionDataToLengths(Collection data) {
+ List list = new ArrayList<>();
+ data.stream().forEach((sData) -> {
+ list.add(sData.getSessionEnd()-sData.getSessionStart());
+ });
+ return list;
+ }
+
+ static long average(Collection list) {
+ if (list.isEmpty()) {
+ return 0;
+ }
+ long total = 0;
+ for (Long long1 : list) {
+ total += long1;
+ }
+ return total / list.size();
+ }
}
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 df3e391fd..cf8816959 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java
@@ -168,6 +168,11 @@ public class FormatUtils {
return string.replaceAll("§r", "");
}
+ /**
+ *
+ * @param d
+ * @return
+ */
public static String cutDecimals(double d) {
DecimalFormat df = new DecimalFormat("#.##");
df.setRoundingMode(RoundingMode.CEILING);
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
index 481d2d20c..255faf76c 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
@@ -2,7 +2,6 @@ package main.java.com.djrapitops.plan.utilities;
import java.io.File;
import java.io.FileNotFoundException;
-import java.nio.file.Files;
import java.util.HashMap;
import java.util.Scanner;
import main.java.com.djrapitops.plan.Plan;
@@ -15,6 +14,12 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/
public class HtmlUtils {
+ /**
+ *
+ * @param fileName
+ * @return
+ * @throws FileNotFoundException
+ */
public static String getHtmlStringFromResource(String fileName) throws FileNotFoundException {
Plan plugin = getPlugin(Plan.class);
File localFile = new File(plugin.getDataFolder(), fileName);
@@ -30,6 +35,12 @@ public class HtmlUtils {
return html;
}
+ /**
+ *
+ * @param html
+ * @param replaceMap
+ * @return
+ */
public static String replacePlaceholders(String html, HashMap replaceMap) {
for (String key : replaceMap.keySet()) {
html = html.replaceAll(key, replaceMap.get(key));
@@ -37,6 +48,10 @@ public class HtmlUtils {
return html;
}
+ /**
+ *
+ * @return
+ */
public static String getServerAnalysisUrl() {
int port = Settings.WEBSERVER_PORT.getNumber();
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
@@ -49,6 +64,11 @@ public class HtmlUtils {
return url;
}
+ /**
+ *
+ * @param playerName
+ * @return
+ */
public static String getInspectUrl(String playerName) {
int port = Settings.WEBSERVER_PORT.getNumber();
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
@@ -60,4 +80,11 @@ public class HtmlUtils {
String url = "http://" + ip + "/" + securityCode + "/player/" + playerName;
return url;
}
+
+ static String removeXSS(String string) {
+ return string.replaceAll("", "")
+ .replaceAll("", "");
+ }
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/PlaceholderUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/PlaceholderUtils.java
index d07d0e143..c43a57003 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/PlaceholderUtils.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/PlaceholderUtils.java
@@ -43,7 +43,7 @@ public class PlaceholderUtils {
replaceMap.put("%npday%", data.getNewPlayersDay() + "");
replaceMap.put("%npweek%", data.getNewPlayersWeek() + "");
replaceMap.put("%npmonth%", data.getNewPlayersMonth() + "");
- replaceMap.put("%commanduse%", data.getTop50CommandsListHtml());
+ replaceMap.put("%commanduse%", HtmlUtils.removeXSS(data.getCommandUseListHtml()));
replaceMap.put("%totalcommands%", data.getTotalCommands()+"");
replaceMap.put("%avgage%", (data.getAverageAge() != -1) ? "" + data.getAverageAge() : Phrase.DEM_UNKNOWN + "");
replaceMap.put("%avgplaytime%", FormatUtils.formatTimeAmount("" + data.getAveragePlayTime()));
@@ -98,6 +98,7 @@ public class PlaceholderUtils {
replaceMap.put("%gmcolors%", "\"#" + Settings.HCOLOR_GMP_0 + "\",\"#" + Settings.HCOLOR_GMP_1
+ "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\"");
replaceMap.putAll(plugin.getHookHandler().getAdditionalAnalysisReplaceRules());
+ replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(data.getSessionAverage()+""));
return replaceMap;
}
@@ -143,13 +144,9 @@ public class PlaceholderUtils {
replaceMap.put("%gm1%", FormatUtils.formatTimeAmount("" + gmData[1]));
replaceMap.put("%gm2%", FormatUtils.formatTimeAmount("" + gmData[2]));
replaceMap.put("%gm3%", FormatUtils.formatTimeAmount("" + gmData[3]));
- replaceMap.put("%gmdata%", Arrays.toString(gmData));
- replaceMap.put("%gmlabels%", "[\"Survival\", \"Creative\", \"Adventure\", \"Spectator\"]");
- replaceMap.put("%gmcolors%", "\"#" + Settings.HCOLOR_GMP_0 + "\",\"#" + Settings.HCOLOR_GMP_1
- + "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\"");
replaceMap.put("%gmtotal%", FormatUtils.formatTimeAmount("" + total));
replaceMap.put("%ips%", (showIPandUUID ? data.getIps().toString() : Html.HIDDEN.parse()));
- replaceMap.put("%nicknames%", FormatUtils.swapColorsToSpan(data.getNicknames().toString()));
+ replaceMap.put("%nicknames%", HtmlUtils.removeXSS(FormatUtils.swapColorsToSpan(data.getNicknames().toString())));
replaceMap.put("%name%", data.getName());
replaceMap.put("%registered%", FormatUtils.formatTimeStamp("" + data.getRegistered()));
replaceMap.put("%timeskicked%", "" + data.getTimesKicked());
@@ -162,6 +159,7 @@ public class PlaceholderUtils {
replaceMap.put("%playerkills%", data.getPlayerKills().size() + "");
replaceMap.put("%mobkills%", data.getMobKills() + "");
replaceMap.put("%sessionstable%", SortableSessionTableCreator.createSortedSessionDataTable10(data.getSessions()));
+ replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(data.getSessions()))+""));
replaceMap.put("%killstable%", SortableKillsTableCreator.createSortedSessionDataTable10(data.getPlayerKills()));
Plan plugin = getPlugin(Plan.class);
replaceMap.put("%version%", plugin.getDescription().getVersion());
@@ -171,6 +169,10 @@ public class PlaceholderUtils {
replaceMap.put("%labelsweek%", playersDataArray[1]);
replaceMap.put("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL + "");
replaceMap.put("%playersgraphfill%", Settings.HCOLOR_ACT_ONL_FILL + "");
+ replaceMap.put("%gm0col%", Settings.HCOLOR_GMP_0+"");
+ replaceMap.put("%gm1col%", Settings.HCOLOR_GMP_1+"");
+ replaceMap.put("%gm2col%", Settings.HCOLOR_GMP_2+"");
+ replaceMap.put("%gm3col%", Settings.HCOLOR_GMP_3+"");
replaceMap.put("%inaccuratedatawarning%", (new Date().getTime() - data.getRegistered() < 180000) ? Html.WARN_INACCURATE.parse() : "");
replaceMap.putAll(plugin.getHookHandler().getAdditionalInspectReplaceRules(uuid));
return replaceMap;
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java
index aa21f0a0d..38f9c2040 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java
@@ -27,6 +27,11 @@ public class MapComparator {
return sortedList;
}
+ /**
+ *
+ * @param hashMap
+ * @return
+ */
public static List sortByValueLong(HashMap hashMap) {
List sortedList = new ArrayList<>();
hashMap.keySet().stream().forEach((key) -> {
diff --git a/Plan/src/main/resources/analysis.html b/Plan/src/main/resources/analysis.html
index 7c0e0f9e3..4af0fe2c9 100644
--- a/Plan/src/main/resources/analysis.html
+++ b/Plan/src/main/resources/analysis.html
@@ -200,7 +200,7 @@
-
Information
+
Information
Online Activity
Playerlist
Command usage
@@ -228,9 +228,10 @@
-
-
-
Most recent logins: %recentlogins%
+
+
Recent Logins
+
+ %recentlogins%
%towntable%
%factionstable%
@@ -238,7 +239,7 @@
-
Information
+
Information
@@ -254,11 +255,11 @@
-
A Total of %totalplaytime% has been played with the average of %avgplaytime%
- Players have joined %totallogins% times.
- Players have died %deaths% times, of which %playerkills% were caused by another Player.
- A Total of %mobkills% mobs have been slain.
- The average of known player ages is %avgage%.
+
Total Playtime: %totalplaytime% | Player Average: %avgplaytime%
+ Average Session Length: %sessionaverage%
+ Total Login times: %totallogins%
+ Player kills: %playerkills% | Mob kills: %mobkills% | Deaths: %deaths%
+
%essentialswarps%