[2.8.0-SNAPSHOT] Further improvements to Html

Fixes for #38 #37 #36
Inspect page html improved
- Removed piechart
Added Session average to inspect & analysis pages
Empty javadoc parts generated
This commit is contained in:
Rsl1122 2017-03-05 14:13:25 +02:00
parent 09a3de2535
commit 1abdc26a11
49 changed files with 1462 additions and 89 deletions

View File

@ -72,9 +72,9 @@ public class Plan extends JavaPlugin {
* OnEnable method. * OnEnable method.
* *
* Creates the config file. Checks for new version. Initializes Database. * Creates the config file. Checks for new version. Initializes Database.
* Hooks PlanLite. Initializes DataCaches. Registers Listeners. Registers * Hooks to Supported plugins. Initializes DataCaches. Registers Listeners.
* Command /plan and initializes API. Enables Webserver & analysis tasks if * Registers Command /plan and initializes API. Enables Webserver & analysis
* enabled in config. Warns about possible mistakes made in config. * tasks if enabled in config. Warns about possible mistakes made in config.
*/ */
@Override @Override
public void onEnable() { public void onEnable() {
@ -176,7 +176,13 @@ public class Plan extends JavaPlugin {
getLogger().severe(message); 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())); logError(Phrase.ERROR_LOGGED.parse(e.toString()));
toLog(source + " Caught " + e); toLog(source + " Caught " + e);
for (StackTraceElement x : e.getStackTrace()) { for (StackTraceElement x : e.getStackTrace()) {
@ -185,12 +191,23 @@ public class Plan extends JavaPlugin {
toLog(""); toLog("");
} }
public void toLog(String source, Collection<Exception> 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<Throwable> e) {
for (Throwable ex : e) {
toLog(source, ex); 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) { public void toLog(String message) {
File folder = getDataFolder(); File folder = getDataFolder();
if (!folder.exists()) { 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() { public InspectCacheHandler getInspectCache() {
return inspectCache; return inspectCache;
} }
/** /**
* @return Currnet instance of the DataCacheHandler * @return Current instance of the DataCacheHandler
*/ */
public DataCacheHandler getHandler() { public DataCacheHandler getHandler() {
return handler; return handler;
} }
/** /**
* @return the Database * @return the Current Database
*/ */
public Database getDB() { public Database getDB() {
return db; return db;
@ -323,19 +340,22 @@ public class Plan extends JavaPlugin {
return uiServer; return uiServer;
} }
/**
* @return HookHandler that manages Hooks to other plugins.
*/
public HookHandler getHookHandler() { public HookHandler getHookHandler() {
return hookHandler; return hookHandler;
} }
/** /**
* @return Set containing SqLite & MySQL classes. * @return Set containing the SqLite & MySQL classes.
*/ */
public HashSet<Database> getDatabases() { public HashSet<Database> getDatabases() {
return databases; return databases;
} }
/** /**
* @return * @return ID of the bootAnalysisTask
*/ */
public int getBootAnalysisTaskID() { public int getBootAnalysisTaskID() {
return bootAnalysisTaskID; return bootAnalysisTaskID;
@ -343,7 +363,8 @@ public class Plan extends JavaPlugin {
private void initLocale() { private void initLocale() {
String locale = Settings.LOCALE.toString().toUpperCase(); 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 { try {
genLocale.createNewFile(); genLocale.createNewFile();
FileWriter fw = new FileWriter(genLocale, true); FileWriter fw = new FileWriter(genLocale, true);

View File

@ -22,6 +22,9 @@ public enum Settings {
CLEAR_CACHE_X_SAVES("Settings.Cache.DataCache.ClearCacheEveryXSaves"), CLEAR_CACHE_X_SAVES("Settings.Cache.DataCache.ClearCacheEveryXSaves"),
WEBSERVER_PORT("Settings.WebServer.Port"), WEBSERVER_PORT("Settings.WebServer.Port"),
ANALYSIS_AUTO_REFRESH("Settings.Cache.AnalysisCache.RefreshEveryXMinutes"), 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 // String
ALTERNATIVE_IP("Settings.WebServer.AlternativeIP"), ALTERNATIVE_IP("Settings.WebServer.AlternativeIP"),
DB_TYPE("database.type"), DB_TYPE("database.type"),
@ -68,6 +71,9 @@ public enum Settings {
return getPlugin(Plan.class).getConfig().getInt(configPath); return getPlugin(Plan.class).getConfig().getInt(configPath);
} }
/**
* @return Path of the config setting.
*/
public String getPath() { public String getPath() {
return configPath; return configPath;
} }

View File

@ -42,6 +42,8 @@ public class AnalysisData {
private long totalkills; private long totalkills;
private long totalmobkills; private long totalmobkills;
private long totaldeaths; private long totaldeaths;
private long sessionAverage;
/** /**
* Class constructor. * Class constructor.
@ -57,10 +59,19 @@ public class AnalysisData {
} }
// Getters and setters v---------------------------------v // Getters and setters v---------------------------------v
/**
*
* @return
*/
public String getSortablePlayersTable() { public String getSortablePlayersTable() {
return sortablePlayersTable; return sortablePlayersTable;
} }
/**
*
* @param sortablePlayersTable
*/
public void setSortablePlayersTable(String sortablePlayersTable) { public void setSortablePlayersTable(String sortablePlayersTable) {
this.sortablePlayersTable = sortablePlayersTable; this.sortablePlayersTable = sortablePlayersTable;
} }
@ -82,7 +93,7 @@ public class AnalysisData {
/** /**
* @return HTML String of the Top50CommandsList * @return HTML String of the Top50CommandsList
*/ */
public String getTop50CommandsListHtml() { public String getCommandUseListHtml() {
return commandUseTableHtml; return commandUseTableHtml;
} }
@ -311,83 +322,179 @@ public class AnalysisData {
this.ops = ops; this.ops = ops;
} }
/**
*
* @return
*/
public String getTop20ActivePlayers() { public String getTop20ActivePlayers() {
return top20ActivePlayers; return top20ActivePlayers;
} }
/**
*
* @param top20ActivePlayers
*/
public void setTop20ActivePlayers(String top20ActivePlayers) { public void setTop20ActivePlayers(String top20ActivePlayers) {
this.top20ActivePlayers = top20ActivePlayers; this.top20ActivePlayers = top20ActivePlayers;
} }
/**
*
* @return
*/
public String getRecentPlayers() { public String getRecentPlayers() {
return recentPlayers; return recentPlayers;
} }
/**
*
* @param recentPlayers
*/
public void setRecentPlayers(String recentPlayers) { public void setRecentPlayers(String recentPlayers) {
this.recentPlayers = recentPlayers; this.recentPlayers = recentPlayers;
} }
/**
*
* @return
*/
public int getNewPlayersMonth() { public int getNewPlayersMonth() {
return newPlayersMonth; return newPlayersMonth;
} }
/**
*
* @param newPlayersMonth
*/
public void setNewPlayersMonth(int newPlayersMonth) { public void setNewPlayersMonth(int newPlayersMonth) {
this.newPlayersMonth = newPlayersMonth; this.newPlayersMonth = newPlayersMonth;
} }
/**
*
* @return
*/
public int getNewPlayersWeek() { public int getNewPlayersWeek() {
return newPlayersWeek; return newPlayersWeek;
} }
/**
*
* @param newPlayersWeek
*/
public void setNewPlayersWeek(int newPlayersWeek) { public void setNewPlayersWeek(int newPlayersWeek) {
this.newPlayersWeek = newPlayersWeek; this.newPlayersWeek = newPlayersWeek;
} }
/**
*
* @return
*/
public int getNewPlayersDay() { public int getNewPlayersDay() {
return newPlayersDay; return newPlayersDay;
} }
/**
*
* @param newPlayersDay
*/
public void setNewPlayersDay(int newPlayersDay) { public void setNewPlayersDay(int newPlayersDay) {
this.newPlayersDay = newPlayersDay; this.newPlayersDay = newPlayersDay;
} }
/**
*
* @return
*/
public long getTotalkills() { public long getTotalkills() {
return totalkills; return totalkills;
} }
/**
*
* @return
*/
public long getTotalmobkills() { public long getTotalmobkills() {
return totalmobkills; return totalmobkills;
} }
/**
*
* @return
*/
public long getTotaldeaths() { public long getTotaldeaths() {
return totaldeaths; return totaldeaths;
} }
/**
*
* @param totalkills
*/
public void setTotalkills(long totalkills) { public void setTotalkills(long totalkills) {
this.totalkills = totalkills; this.totalkills = totalkills;
} }
/**
*
* @param totalmobkills
*/
public void setTotalmobkills(long totalmobkills) { public void setTotalmobkills(long totalmobkills) {
this.totalmobkills = totalmobkills; this.totalmobkills = totalmobkills;
} }
/**
*
* @param totaldeaths
*/
public void setTotaldeaths(long totaldeaths) { public void setTotaldeaths(long totaldeaths) {
this.totaldeaths = totaldeaths; this.totaldeaths = totaldeaths;
} }
/**
*
* @return
*/
public String[] getPlayersDataArray() { public String[] getPlayersDataArray() {
return playersDataArray; return playersDataArray;
} }
/**
*
* @param playersDataArray
*/
public void setPlayersDataArray(String[] playersDataArray) { public void setPlayersDataArray(String[] playersDataArray) {
this.playersDataArray = playersDataArray; this.playersDataArray = playersDataArray;
} }
/**
*
* @param totalCommands
*/
public void setTotalCommands(long totalCommands) { public void setTotalCommands(long totalCommands) {
this.totalCommands = totalCommands; this.totalCommands = totalCommands;
} }
/**
*
* @return
*/
public long getTotalCommands() { public long getTotalCommands() {
return totalCommands; return totalCommands;
} }
/**
*
* @return
*/
public long getSessionAverage() {
return sessionAverage;
}
/**
*
* @param sessionAverage
*/
public void setSessionAverage(long sessionAverage) {
this.sessionAverage = sessionAverage;
}
} }

View File

@ -13,6 +13,13 @@ public class KillData {
private long date; private long date;
private String weapon; private String weapon;
/**
*
* @param victim
* @param victimID
* @param weapon
* @param date
*/
public KillData(UUID victim, int victimID, String weapon, long date) { public KillData(UUID victim, int victimID, String weapon, long date) {
this.victim = victim; this.victim = victim;
this.weapon = weapon; this.weapon = weapon;
@ -20,18 +27,34 @@ public class KillData {
this.date = date; this.date = date;
} }
/**
*
* @return
*/
public UUID getVictim() { public UUID getVictim() {
return victim; return victim;
} }
/**
*
* @return
*/
public long getDate() { public long getDate() {
return date; return date;
} }
/**
*
* @return
*/
public String getWeapon() { public String getWeapon() {
return weapon; return weapon;
} }
/**
*
* @return
*/
public int getVictimUserID() { public int getVictimUserID() {
return victimUserID; return victimUserID;
} }

View File

@ -31,6 +31,9 @@ public class RawAnalysisData {
private HashMap<String, Integer> commandUse; private HashMap<String, Integer> commandUse;
private List<Long> registered; private List<Long> registered;
/**
*
*/
public RawAnalysisData() { public RawAnalysisData() {
gmZero = 0; gmZero = 0;
gmOne = 0; gmOne = 0;
@ -53,142 +56,282 @@ public class RawAnalysisData {
registered = new ArrayList<>(); registered = new ArrayList<>();
} }
/**
*
* @param gmZero
*/
public void addToGmZero(long gmZero) { public void addToGmZero(long gmZero) {
this.gmZero += gmZero; this.gmZero += gmZero;
} }
/**
*
* @param gmOne
*/
public void addToGmOne(long gmOne) { public void addToGmOne(long gmOne) {
this.gmOne += gmOne; this.gmOne += gmOne;
} }
/**
*
* @param gmTwo
*/
public void addToGmTwo(long gmTwo) { public void addToGmTwo(long gmTwo) {
this.gmTwo += gmTwo; this.gmTwo += gmTwo;
} }
/**
*
* @param gmThree
*/
public void addGmThree(long gmThree) { public void addGmThree(long gmThree) {
this.gmThree += gmThree; this.gmThree += gmThree;
} }
/**
*
* @param totalLoginTimes
*/
public void addTotalLoginTimes(long totalLoginTimes) { public void addTotalLoginTimes(long totalLoginTimes) {
this.totalLoginTimes += totalLoginTimes; this.totalLoginTimes += totalLoginTimes;
} }
/**
*
* @param totalPlaytime
*/
public void addTotalPlaytime(long totalPlaytime) { public void addTotalPlaytime(long totalPlaytime) {
this.totalPlaytime += totalPlaytime; this.totalPlaytime += totalPlaytime;
} }
/**
*
* @param totalBanned
*/
public void addTotalBanned(int totalBanned) { public void addTotalBanned(int totalBanned) {
this.totalBanned += totalBanned; this.totalBanned += totalBanned;
} }
/**
*
* @param active
*/
public void addActive(int active) { public void addActive(int active) {
this.active += active; this.active += active;
} }
/**
*
* @param joinleaver
*/
public void addJoinleaver(int joinleaver) { public void addJoinleaver(int joinleaver) {
this.joinleaver += joinleaver; this.joinleaver += joinleaver;
} }
/**
*
* @param inactive
*/
public void addInactive(int inactive) { public void addInactive(int inactive) {
this.inactive += inactive; this.inactive += inactive;
} }
/**
*
* @param totalKills
*/
public void addTotalKills(long totalKills) { public void addTotalKills(long totalKills) {
this.totalKills += totalKills; this.totalKills += totalKills;
} }
/**
*
* @param totalMobKills
*/
public void addTotalMobKills(long totalMobKills) { public void addTotalMobKills(long totalMobKills) {
this.totalMobKills += totalMobKills; this.totalMobKills += totalMobKills;
} }
/**
*
* @param totalDeaths
*/
public void addTotalDeaths(long totalDeaths) { public void addTotalDeaths(long totalDeaths) {
this.totalDeaths += totalDeaths; this.totalDeaths += totalDeaths;
} }
/**
*
* @param ops
*/
public void addOps(int ops) { public void addOps(int ops) {
this.ops += ops; this.ops += ops;
} }
/**
*
* @return
*/
public long getGmZero() { public long getGmZero() {
return gmZero; return gmZero;
} }
/**
*
* @return
*/
public long getGmOne() { public long getGmOne() {
return gmOne; return gmOne;
} }
/**
*
* @return
*/
public long getGmTwo() { public long getGmTwo() {
return gmTwo; return gmTwo;
} }
/**
*
* @return
*/
public long getGmThree() { public long getGmThree() {
return gmThree; return gmThree;
} }
/**
*
* @return
*/
public long getTotalLoginTimes() { public long getTotalLoginTimes() {
return totalLoginTimes; return totalLoginTimes;
} }
/**
*
* @return
*/
public long getTotalPlaytime() { public long getTotalPlaytime() {
return totalPlaytime; return totalPlaytime;
} }
/**
*
* @return
*/
public int getTotalBanned() { public int getTotalBanned() {
return totalBanned; return totalBanned;
} }
/**
*
* @return
*/
public int getActive() { public int getActive() {
return active; return active;
} }
/**
*
* @return
*/
public int getJoinleaver() { public int getJoinleaver() {
return joinleaver; return joinleaver;
} }
/**
*
* @return
*/
public int getInactive() { public int getInactive() {
return inactive; return inactive;
} }
/**
*
* @return
*/
public long getTotalKills() { public long getTotalKills() {
return totalKills; return totalKills;
} }
/**
*
* @return
*/
public long getTotalMobKills() { public long getTotalMobKills() {
return totalMobKills; return totalMobKills;
} }
/**
*
* @return
*/
public long getTotalDeaths() { public long getTotalDeaths() {
return totalDeaths; return totalDeaths;
} }
/**
*
* @return
*/
public int getOps() { public int getOps() {
return ops; return ops;
} }
/**
*
* @return
*/
public List<Integer> getAges() { public List<Integer> getAges() {
return ages; return ages;
} }
/**
*
* @return
*/
public HashMap<String, Long> getLatestLogins() { public HashMap<String, Long> getLatestLogins() {
return latestLogins; return latestLogins;
} }
/**
*
* @return
*/
public HashMap<String, Long> getPlaytimes() { public HashMap<String, Long> getPlaytimes() {
return playtimes; return playtimes;
} }
/**
*
* @return
*/
public List<SessionData> getSessiondata() { public List<SessionData> getSessiondata() {
return sessiondata; return sessiondata;
} }
/**
*
* @param commandUse
*/
public void setCommandUse(HashMap<String, Integer> commandUse) { public void setCommandUse(HashMap<String, Integer> commandUse) {
this.commandUse = commandUse; this.commandUse = commandUse;
} }
/**
*
* @return
*/
public HashMap<String, Integer> getCommandUse() { public HashMap<String, Integer> getCommandUse() {
return commandUse; return commandUse;
} }
/**
*
* @return
*/
public List<Long> getRegistered() { public List<Long> getRegistered() {
return registered; return registered;
} }

View File

@ -9,24 +9,45 @@ public class SessionData {
private long sessionStart; private long sessionStart;
private long sessionEnd; private long sessionEnd;
/**
*
* @param sessionStart
*/
public SessionData(long sessionStart) { public SessionData(long sessionStart) {
this.sessionStart = sessionStart; this.sessionStart = sessionStart;
this.sessionEnd = -1; this.sessionEnd = -1;
} }
/**
*
* @param sessionStart
* @param sessionEnd
*/
public SessionData(long sessionStart, long sessionEnd) { public SessionData(long sessionStart, long sessionEnd) {
this.sessionStart = sessionStart; this.sessionStart = sessionStart;
this.sessionEnd = sessionEnd; this.sessionEnd = sessionEnd;
} }
/**
*
* @param endOfSession
*/
public void endSession(long endOfSession) { public void endSession(long endOfSession) {
sessionEnd = endOfSession; sessionEnd = endOfSession;
} }
/**
*
* @return
*/
public long getSessionStart() { public long getSessionStart() {
return sessionStart; return sessionStart;
} }
/**
*
* @return
*/
public long getSessionEnd() { public long getSessionEnd() {
return sessionEnd; return sessionEnd;
} }

View File

@ -15,6 +15,10 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin; import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
/**
*
* @author Rsl1122
*/
public class UserData { public class UserData {
private int accessing; private int accessing;
@ -47,6 +51,11 @@ public class UserData {
private SessionData currentSession; private SessionData currentSession;
private List<SessionData> sessions; private List<SessionData> sessions;
/**
*
* @param player
* @param demData
*/
public UserData(Player player, DemographicsData demData) { public UserData(Player player, DemographicsData demData) {
accessing = 0; accessing = 0;
uuid = player.getUniqueId(); uuid = player.getUniqueId();
@ -81,6 +90,11 @@ public class UserData {
playerKills = new ArrayList<>(); playerKills = new ArrayList<>();
} }
/**
*
* @param player
* @param demData
*/
public UserData(OfflinePlayer player, DemographicsData demData) { public UserData(OfflinePlayer player, DemographicsData demData) {
accessing = 0; accessing = 0;
uuid = player.getUniqueId(); uuid = player.getUniqueId();
@ -113,22 +127,37 @@ public class UserData {
playerKills = new ArrayList<>(); playerKills = new ArrayList<>();
} }
/**
*
* @param ip
*/
public void addIpAddress(InetAddress ip) { public void addIpAddress(InetAddress ip) {
if (!ips.contains(ip)) { if (!ips.contains(ip)) {
ips.add(ip); ips.add(ip);
} }
} }
/**
*
* @param addIps
*/
public void addIpAddresses(Collection<InetAddress> addIps) { public void addIpAddresses(Collection<InetAddress> addIps) {
ips.addAll(addIps); ips.addAll(addIps);
} }
/**
*
* @param loc
*/
public void addLocation(Location loc) { public void addLocation(Location loc) {
locations.add(loc); locations.add(loc);
location = loc; location = loc;
} }
/**
*
* @param addLocs
*/
public void addLocations(Collection<Location> addLocs) { public void addLocations(Collection<Location> addLocs) {
locations.addAll(addLocs); locations.addAll(addLocs);
if (!locations.isEmpty()) { if (!locations.isEmpty()) {
@ -136,6 +165,11 @@ public class UserData {
} }
} }
/**
*
* @param nick
* @return
*/
public boolean addNickname(String nick) { public boolean addNickname(String nick) {
if (!nicknames.contains(nick)) { if (!nicknames.contains(nick)) {
if (!nick.isEmpty()) { if (!nick.isEmpty()) {
@ -146,14 +180,30 @@ public class UserData {
return false; return false;
} }
/**
*
* @param addNicks
*/
public void addNicknames(Collection<String> addNicks) { public void addNicknames(Collection<String> addNicks) {
nicknames.addAll(addNicks); nicknames.addAll(addNicks);
} }
/**
*
* @param gm
* @param time
*/
public void setGMTime(GameMode gm, long time) { public void setGMTime(GameMode gm, long time) {
gmTimes.put(gm, time); gmTimes.put(gm, time);
} }
/**
*
* @param survivalTime
* @param creativeTime
* @param adventureTime
* @param spectatorTime
*/
public void setAllGMTimes(long survivalTime, long creativeTime, long adventureTime, long spectatorTime) { public void setAllGMTimes(long survivalTime, long creativeTime, long adventureTime, long spectatorTime) {
gmTimes.clear(); gmTimes.clear();
gmTimes.put(GameMode.SURVIVAL, survivalTime); gmTimes.put(GameMode.SURVIVAL, survivalTime);
@ -165,12 +215,20 @@ public class UserData {
} }
} }
/**
*
* @param session
*/
public void addSession(SessionData session) { public void addSession(SessionData session) {
if (session != null) { if (session != null) {
sessions.add(session); sessions.add(session);
} }
} }
/**
*
* @param sessions
*/
public void addSessions(Collection<SessionData> sessions) { public void addSessions(Collection<SessionData> sessions) {
Collection<SessionData> filteredSessions = sessions.parallelStream() Collection<SessionData> filteredSessions = sessions.parallelStream()
.filter(session -> session != null) .filter(session -> session != null)
@ -178,201 +236,397 @@ public class UserData {
this.sessions.addAll(filteredSessions); this.sessions.addAll(filteredSessions);
} }
/**
*
* @param session
*/
public void setCurrentSession(SessionData session) { public void setCurrentSession(SessionData session) {
currentSession = session; currentSession = session;
} }
/**
*
* @param isBanned
*/
public void updateBanned(boolean isBanned) { public void updateBanned(boolean isBanned) {
this.isBanned = isBanned; this.isBanned = isBanned;
} }
/**
*
* @return
*/
public boolean isAccessed() { public boolean isAccessed() {
return accessing > 0; return accessing > 0;
} }
/**
*
*/
public void access() { public void access() {
accessing++; accessing++;
} }
/**
*
*/
public void stopAccessing() { public void stopAccessing() {
accessing--; accessing--;
} }
// Getters ------------------------------------------------------------- // Getters -------------------------------------------------------------
/**
*
* @return
*/
public UUID getUuid() { public UUID getUuid() {
return uuid; return uuid;
} }
/**
*
* @return
*/
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
/**
*
* @return
*/
public List<Location> getLocations() { public List<Location> getLocations() {
return locations; return locations;
} }
/**
*
* @return
*/
public HashSet<InetAddress> getIps() { public HashSet<InetAddress> getIps() {
return ips; return ips;
} }
/**
*
* @return
*/
public HashSet<String> getNicknames() { public HashSet<String> getNicknames() {
return nicknames; return nicknames;
} }
/**
*
* @return
*/
public long getRegistered() { public long getRegistered() {
return registered; return registered;
} }
/**
*
* @return
*/
public long getLastPlayed() { public long getLastPlayed() {
return lastPlayed; return lastPlayed;
} }
/**
*
* @return
*/
public long getPlayTime() { public long getPlayTime() {
return playTime; return playTime;
} }
/**
*
* @return
*/
public int getLoginTimes() { public int getLoginTimes() {
return loginTimes; return loginTimes;
} }
/**
*
* @return
*/
public int getTimesKicked() { public int getTimesKicked() {
return timesKicked; return timesKicked;
} }
/**
*
* @return
*/
public HashMap<GameMode, Long> getGmTimes() { public HashMap<GameMode, Long> getGmTimes() {
return gmTimes; return gmTimes;
} }
/**
*
* @return
*/
public long getLastGmSwapTime() { public long getLastGmSwapTime() {
return lastGmSwapTime; return lastGmSwapTime;
} }
/**
*
* @return
*/
public GameMode getLastGamemode() { public GameMode getLastGamemode() {
return lastGamemode; return lastGamemode;
} }
/**
*
* @return
*/
public boolean isOp() { public boolean isOp() {
return isOp; return isOp;
} }
/**
*
* @return
*/
public boolean isBanned() { public boolean isBanned() {
return isBanned; return isBanned;
} }
/**
*
* @return
*/
public DemographicsData getDemData() { public DemographicsData getDemData() {
return demData; return demData;
} }
/**
*
* @return
*/
public String getName() { public String getName() {
return name; return name;
} }
// Setters ------------------------------------------------------------- // Setters -------------------------------------------------------------
/**
*
* @param uuid
*/
public void setUuid(UUID uuid) { public void setUuid(UUID uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
/**
*
* @param location
*/
public void setLocation(Location location) { public void setLocation(Location location) {
this.location = location; this.location = location;
} }
/**
*
* @param locations
*/
public void setLocations(List<Location> locations) { public void setLocations(List<Location> locations) {
this.locations = locations; this.locations = locations;
} }
/**
*
* @param ips
*/
public void setIps(HashSet<InetAddress> ips) { public void setIps(HashSet<InetAddress> ips) {
this.ips = ips; this.ips = ips;
} }
/**
*
* @param nicknames
*/
public void setNicknames(HashSet<String> nicknames) { public void setNicknames(HashSet<String> nicknames) {
this.nicknames = nicknames; this.nicknames = nicknames;
} }
/**
*
* @param registered
*/
public void setRegistered(long registered) { public void setRegistered(long registered) {
this.registered = registered; this.registered = registered;
} }
/**
*
* @param lastPlayed
*/
public void setLastPlayed(long lastPlayed) { public void setLastPlayed(long lastPlayed) {
this.lastPlayed = lastPlayed; this.lastPlayed = lastPlayed;
} }
/**
*
* @param playTime
*/
public void setPlayTime(long playTime) { public void setPlayTime(long playTime) {
this.playTime = playTime; this.playTime = playTime;
} }
/**
*
* @param loginTimes
*/
public void setLoginTimes(int loginTimes) { public void setLoginTimes(int loginTimes) {
this.loginTimes = loginTimes; this.loginTimes = loginTimes;
} }
/**
*
* @param timesKicked
*/
public void setTimesKicked(int timesKicked) { public void setTimesKicked(int timesKicked) {
this.timesKicked = timesKicked; this.timesKicked = timesKicked;
} }
/**
*
* @param gmTimes
*/
public void setGmTimes(HashMap<GameMode, Long> gmTimes) { public void setGmTimes(HashMap<GameMode, Long> gmTimes) {
this.gmTimes = gmTimes; this.gmTimes = gmTimes;
} }
/**
*
* @param lastGmSwapTime
*/
public void setLastGmSwapTime(long lastGmSwapTime) { public void setLastGmSwapTime(long lastGmSwapTime) {
this.lastGmSwapTime = lastGmSwapTime; this.lastGmSwapTime = lastGmSwapTime;
} }
/**
*
* @param lastGamemode
*/
public void setLastGamemode(GameMode lastGamemode) { public void setLastGamemode(GameMode lastGamemode) {
this.lastGamemode = lastGamemode; this.lastGamemode = lastGamemode;
} }
/**
*
* @param isOp
*/
public void setIsOp(boolean isOp) { public void setIsOp(boolean isOp) {
this.isOp = isOp; this.isOp = isOp;
} }
/**
*
* @param demData
*/
public void setDemData(DemographicsData demData) { public void setDemData(DemographicsData demData) {
this.demData = demData; this.demData = demData;
} }
/**
*
* @param name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
*
* @return
*/
public boolean isOnline() { public boolean isOnline() {
return isOnline; return isOnline;
} }
/**
*
* @return
*/
public int getMobKills() { public int getMobKills() {
return mobKills; return mobKills;
} }
/**
*
* @param mobKills
*/
public void setMobKills(int mobKills) { public void setMobKills(int mobKills) {
this.mobKills = mobKills; this.mobKills = mobKills;
} }
/**
*
* @return
*/
public List<KillData> getPlayerKills() { public List<KillData> getPlayerKills() {
return playerKills; return playerKills;
} }
/**
*
* @param playerKills
*/
public void setPlayerKills(List<KillData> playerKills) { public void setPlayerKills(List<KillData> playerKills) {
this.playerKills = playerKills; this.playerKills = playerKills;
} }
/**
*
* @param kill
*/
public void addPlayerKill(KillData kill) { public void addPlayerKill(KillData kill) {
playerKills.add(kill); playerKills.add(kill);
} }
/**
*
* @return
*/
public int getDeaths() { public int getDeaths() {
return deaths; return deaths;
} }
/**
*
* @param deaths
*/
public void setDeaths(int deaths) { public void setDeaths(int deaths) {
this.deaths = deaths; this.deaths = deaths;
} }
/**
*
* @return
*/
public List<SessionData> getSessions() { public List<SessionData> getSessions() {
return sessions; return sessions;
} }
/**
*
* @return
*/
public String getLastNick() { public String getLastNick() {
return lastNick; return lastNick;
} }
/**
*
* @param lastNick
*/
public void setLastNick(String lastNick) { public void setLastNick(String lastNick) {
this.lastNick = lastNick; this.lastNick = lastNick;
} }

View File

@ -33,6 +33,9 @@ public class AdvancedAchievementsHook extends Hook {
} }
} }
/**
*
*/
public AdvancedAchievementsHook() { public AdvancedAchievementsHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -33,6 +33,9 @@ public class EssentialsHook extends Hook {
} }
} }
/**
*
*/
public EssentialsHook() { public EssentialsHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -34,6 +34,9 @@ public class FactionsHook extends Hook {
this.plugin = plugin; this.plugin = plugin;
} }
/**
*
*/
public FactionsHook() { public FactionsHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -25,6 +25,9 @@ public abstract class Hook {
} }
} }
/**
*
*/
public Hook() { public Hook() {
enabled = false; enabled = false;
} }
@ -36,6 +39,10 @@ public abstract class Hook {
return enabled; return enabled;
} }
/**
*
* @param enabled
*/
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
this.enabled = enabled; this.enabled = enabled;
} }

View File

@ -23,11 +23,18 @@ public class HookHandler {
private OnTimeHook onTimeHook; private OnTimeHook onTimeHook;
private TownyHook townyHook; private TownyHook townyHook;
/**
*
* @param plan
*/
public HookHandler(Plan plan) { public HookHandler(Plan plan) {
this.plan = plan; this.plan = plan;
hook(); hook();
} }
/**
*
*/
public void reloadHooks() { public void reloadHooks() {
hook(); hook();
} }
@ -65,30 +72,58 @@ public class HookHandler {
} }
} }
/**
*
* @return
*/
public AdvancedAchievementsHook getAdvancedAchievementsHook() { public AdvancedAchievementsHook getAdvancedAchievementsHook() {
return advancedAchievementsHook; return advancedAchievementsHook;
} }
/**
*
* @return
*/
public EssentialsHook getEssentialsHook() { public EssentialsHook getEssentialsHook() {
return essentialsHook; return essentialsHook;
} }
/**
*
* @return
*/
public SuperbVoteHook getSuperbVoteHook() { public SuperbVoteHook getSuperbVoteHook() {
return superbVoteHook; return superbVoteHook;
} }
/**
*
* @return
*/
public FactionsHook getFactionsHook() { public FactionsHook getFactionsHook() {
return factionsHook; return factionsHook;
} }
/**
*
* @return
*/
public TownyHook getTownyHook() { public TownyHook getTownyHook() {
return townyHook; return townyHook;
} }
/**
*
* @return
*/
public OnTimeHook getOnTimeHook() { public OnTimeHook getOnTimeHook() {
return onTimeHook; return onTimeHook;
} }
/**
*
* @return
*/
public Map<String, String> getAdditionalAnalysisReplaceRules() { public Map<String, String> getAdditionalAnalysisReplaceRules() {
Map<String, String> addReplace = new HashMap<>(); Map<String, String> addReplace = new HashMap<>();
AdvancedAchievementsHook aH = advancedAchievementsHook; AdvancedAchievementsHook aH = advancedAchievementsHook;
@ -102,6 +137,11 @@ public class HookHandler {
return addReplace; return addReplace;
} }
/**
*
* @param uuid
* @return
*/
public Map<String, String> getAdditionalInspectReplaceRules(UUID uuid) { public Map<String, String> getAdditionalInspectReplaceRules(UUID uuid) {
Map<String, String> addReplace = new HashMap<>(); Map<String, String> addReplace = new HashMap<>();
AdvancedAchievementsHook aH = advancedAchievementsHook; AdvancedAchievementsHook aH = advancedAchievementsHook;

View File

@ -25,6 +25,9 @@ public class OnTimeHook extends Hook {
this.plugin = plugin; this.plugin = plugin;
} }
/**
*
*/
public OnTimeHook() { public OnTimeHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -23,6 +23,9 @@ public class SuperbVoteHook extends Hook {
this.plugin = plugin; this.plugin = plugin;
} }
/**
*
*/
public SuperbVoteHook() { public SuperbVoteHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -36,6 +36,9 @@ public class TownyHook extends Hook {
this.towny = getPlugin(Towny.class); this.towny = getPlugin(Towny.class);
} }
/**
*
*/
public TownyHook() { public TownyHook() {
super(); super();
plugin = null; plugin = null;

View File

@ -8,5 +8,10 @@ import main.java.com.djrapitops.plan.data.UserData;
* @author Rsl1122 * @author Rsl1122
*/ */
public abstract class DBCallableProcessor { public abstract class DBCallableProcessor {
/**
*
* @param data
*/
public abstract void process(UserData data); public abstract void process(UserData data);
} }

View File

@ -5,6 +5,7 @@ import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings;
import static org.bukkit.Bukkit.getOfflinePlayer; import static org.bukkit.Bukkit.getOfflinePlayer;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin; import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@ -17,20 +18,36 @@ public class DataCacheClearQueue {
private BlockingQueue<UUID> q; private BlockingQueue<UUID> q;
private ClearSetup s; private ClearSetup s;
/**
*
* @param plugin
* @param handler
*/
public DataCacheClearQueue(Plan plugin, DataCacheHandler handler) { public DataCacheClearQueue(Plan plugin, DataCacheHandler handler) {
q = new ArrayBlockingQueue(1000); q = new ArrayBlockingQueue(Settings.PROCESS_CLEAR_LIMIT.getNumber());
s = new ClearSetup(); s = new ClearSetup();
s.go(q, handler); s.go(q, handler);
} }
/**
*
* @param uuid
*/
public void scheduleForClear(UUID uuid) { public void scheduleForClear(UUID uuid) {
q.add(uuid); q.add(uuid);
} }
/**
*
* @param uuids
*/
public void scheduleForClear(Collection<UUID> uuids) { public void scheduleForClear(Collection<UUID> uuids) {
q.addAll(uuids); q.addAll(uuids);
} }
/**
*
*/
public void stop() { public void stop() {
s.stop(); s.stop();
} }

View File

@ -9,6 +9,7 @@ import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.database.Database; import main.java.com.djrapitops.plan.database.Database;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin; import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@ -21,12 +22,21 @@ public class DataCacheGetQueue {
private BlockingQueue<HashMap<UUID, List<DBCallableProcessor>>> q; private BlockingQueue<HashMap<UUID, List<DBCallableProcessor>>> q;
private GetSetup s; private GetSetup s;
/**
*
* @param plugin
*/
public DataCacheGetQueue(Plan plugin) { public DataCacheGetQueue(Plan plugin) {
q = new ArrayBlockingQueue(1000); q = new ArrayBlockingQueue(Settings.PROCESS_GET_LIMIT.getNumber());
s = new GetSetup(); s = new GetSetup();
s.go(q, plugin.getDB()); s.go(q, plugin.getDB());
} }
/**
*
* @param uuid
* @param processors
*/
public void scheduleForGet(UUID uuid, DBCallableProcessor... processors) { public void scheduleForGet(UUID uuid, DBCallableProcessor... processors) {
HashMap<UUID, List<DBCallableProcessor>> map = new HashMap<>(); HashMap<UUID, List<DBCallableProcessor>> map = new HashMap<>();
if (map.get(uuid) == null) { if (map.get(uuid) == null) {
@ -36,6 +46,9 @@ public class DataCacheGetQueue {
q.add(map); q.add(map);
} }
/**
*
*/
public void stop() { public void stop() {
s.stop(); s.stop();
} }

View File

@ -220,6 +220,10 @@ public class DataCacheHandler {
} }
// Should only be called from Async thread // Should only be called from Async thread
/**
*
*/
public void saveHandlerDataToCache() { public void saveHandlerDataToCache() {
Bukkit.getServer().getOnlinePlayers().parallelStream().forEach((p) -> { Bukkit.getServer().getOnlinePlayers().parallelStream().forEach((p) -> {
saveHandlerDataToCache(p); saveHandlerDataToCache(p);
@ -255,10 +259,19 @@ public class DataCacheHandler {
plugin.log(Phrase.CACHE_REMOVE.parse(uuid.toString())); plugin.log(Phrase.CACHE_REMOVE.parse(uuid.toString()));
} }
/**
*
* @param uuid
*/
public void scheludeForClear(UUID uuid) { public void scheludeForClear(UUID uuid) {
clearTask.scheduleForClear(uuid); clearTask.scheduleForClear(uuid);
} }
/**
*
* @param uuid
* @return
*/
public boolean isDataAccessed(UUID uuid) { public boolean isDataAccessed(UUID uuid) {
UserData userData = dataCache.get(uuid); UserData userData = dataCache.get(uuid);
if (userData != null) { if (userData != null) {
@ -276,6 +289,10 @@ public class DataCacheHandler {
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player)); saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
} }
/**
*
* @param player
*/
public void newPlayer(OfflinePlayer player) { public void newPlayer(OfflinePlayer player) {
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player)); saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
} }
@ -329,6 +346,10 @@ public class DataCacheHandler {
return gamemodeTimesHandler; return gamemodeTimesHandler;
} }
/**
*
* @return
*/
public KillHandler getKillHandler() { public KillHandler getKillHandler() {
return killHandler; return killHandler;
} }
@ -342,6 +363,10 @@ public class DataCacheHandler {
return db; return db;
} }
/**
*
* @return
*/
public HashMap<String, Integer> getCommandUse() { public HashMap<String, Integer> getCommandUse() {
return commandUse; return commandUse;
} }
@ -353,6 +378,10 @@ public class DataCacheHandler {
return commandUseHandler; return commandUseHandler;
} }
/**
*
* @return
*/
public SessionHandler getSessionHandler() { public SessionHandler getSessionHandler() {
return sessionHandler; return sessionHandler;
} }

View File

@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import main.java.com.djrapitops.plan.Plan; 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.data.UserData;
import main.java.com.djrapitops.plan.database.Database; import main.java.com.djrapitops.plan.database.Database;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin; import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
@ -18,24 +19,43 @@ public class DataCacheSaveQueue {
private BlockingQueue<UserData> q; private BlockingQueue<UserData> q;
private SaveSetup s; private SaveSetup s;
/**
*
* @param plugin
*/
public DataCacheSaveQueue(Plan plugin) { public DataCacheSaveQueue(Plan plugin) {
q = new ArrayBlockingQueue(1000); q = new ArrayBlockingQueue(Settings.PROCESS_SAVE_LIMIT.getNumber());
s = new SaveSetup(); s = new SaveSetup();
s.go(q, plugin.getDB()); s.go(q, plugin.getDB());
} }
/**
*
* @param data
*/
public void scheduleForSave(UserData data) { public void scheduleForSave(UserData data) {
q.add(data); q.add(data);
} }
/**
*
* @param data
*/
public void scheduleForSave(Collection<UserData> data) { public void scheduleForSave(Collection<UserData> data) {
q.addAll(data); q.addAll(data);
} }
/**
*
* @param data
*/
public void scheduleNewPlayer(UserData data) { public void scheduleNewPlayer(UserData data) {
q.add(data); q.add(data);
} }
/**
*
*/
public void stop() { public void stop() {
s.stop(); s.stop();
} }

View File

@ -46,6 +46,11 @@ public class InspectCacheHandler {
cache(uuid, minutes); cache(uuid, minutes);
} }
/**
*
* @param uuid
* @param minutes
*/
public void cache(UUID uuid, int minutes) { public void cache(UUID uuid, int minutes) {
DBCallableProcessor cacher = new DBCallableProcessor() { DBCallableProcessor cacher = new DBCallableProcessor() {
@Override @Override

View File

@ -47,6 +47,11 @@ public class BasicInfoHandler {
data.addIpAddress(ip); data.addIpAddress(ip);
} }
/**
*
* @param nickname
* @param data
*/
public void addNickname(String nickname, UserData data) { public void addNickname(String nickname, UserData data) {
if (!nickname.isEmpty()) { if (!nickname.isEmpty()) {
if (data.addNickname(nickname)) { if (data.addNickname(nickname)) {

View File

@ -14,10 +14,20 @@ import main.java.com.djrapitops.plan.data.UserData;
public class KillHandler { public class KillHandler {
private Plan plugin; private Plan plugin;
/**
*
* @param plugin
*/
public KillHandler(Plan plugin) { public KillHandler(Plan plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
/**
*
* @param killerData
* @param victimUUID
* @param weapon
*/
public void handlePlayerKill(UserData killerData, UUID victimUUID, String weapon) { public void handlePlayerKill(UserData killerData, UUID victimUUID, String weapon) {
long now = new Date().toInstant().getEpochSecond()*(long)1000; long now = new Date().toInstant().getEpochSecond()*(long)1000;
int victimID; int victimID;
@ -30,10 +40,18 @@ public class KillHandler {
killerData.addPlayerKill(new KillData(victimUUID, victimID, weapon, now)); killerData.addPlayerKill(new KillData(victimUUID, victimID, weapon, now));
} }
/**
*
* @param data
*/
public void handlePlayerDeath(UserData data) { public void handlePlayerDeath(UserData data) {
data.setDeaths(data.getDeaths()+1); data.setDeaths(data.getDeaths()+1);
} }
/**
*
* @param data
*/
public void handleMobKill(UserData data) { public void handleMobKill(UserData data) {
data.setMobKills(data.getMobKills()+1); data.setMobKills(data.getMobKills()+1);
} }

View File

@ -53,6 +53,11 @@ public class LocationHandler {
locations.get(uuid).addAll(locs); locations.get(uuid).addAll(locs);
} }
/**
*
* @param uuid
* @return
*/
public List<Location> getLocationsForSaving(UUID uuid) { public List<Location> getLocationsForSaving(UUID uuid) {
if (!locations.containsKey(uuid)) { if (!locations.containsKey(uuid)) {
return new ArrayList<>(); return new ArrayList<>();
@ -60,6 +65,10 @@ public class LocationHandler {
return locations.get(uuid); return locations.get(uuid);
} }
/**
*
* @param uuid
*/
public void clearLocations(UUID uuid) { public void clearLocations(UUID uuid) {
locations.remove(uuid); locations.remove(uuid);
} }

View File

@ -18,12 +18,20 @@ public class SessionHandler {
private final DataCacheHandler handler; private final DataCacheHandler handler;
private final Plan plugin; private final Plan plugin;
/**
*
* @param plugin
*/
public SessionHandler(Plan plugin) { public SessionHandler(Plan plugin) {
this.plugin = plugin; this.plugin = plugin;
this.handler = plugin.getHandler(); this.handler = plugin.getHandler();
this.activeSessions = new HashMap<>(); this.activeSessions = new HashMap<>();
} }
/**
*
* @param data
*/
public void startSession(UserData data) { public void startSession(UserData data) {
long now = new Date().toInstant().getEpochSecond() * (long) 1000; long now = new Date().toInstant().getEpochSecond() * (long) 1000;
SessionData session = new SessionData(now); SessionData session = new SessionData(now);
@ -31,6 +39,10 @@ public class SessionHandler {
data.setCurrentSession(session); data.setCurrentSession(session);
} }
/**
*
* @param data
*/
public void endSession (UserData data) { public void endSession (UserData data) {
UUID uuid = data.getUuid(); UUID uuid = data.getUuid();
SessionData currentSession = activeSessions.get(uuid); SessionData currentSession = activeSessions.get(uuid);

View File

@ -10,6 +10,17 @@ import java.util.UUID;
* @author Rsl1122 * @author Rsl1122
*/ */
public interface Importer { public interface Importer {
/**
*
* @param uuids
* @return
*/
public HashMap<UUID, Long> grabNumericData(Set<UUID> uuids); public HashMap<UUID, Long> grabNumericData(Set<UUID> uuids);
/**
*
* @return
*/
public boolean isEnabled(); public boolean isEnabled();
} }

View File

@ -17,11 +17,20 @@ public class OnTimeImporter implements Importer {
private final Plan plugin; private final Plan plugin;
private boolean enabled; private boolean enabled;
/**
*
* @param plugin
*/
public OnTimeImporter(Plan plugin) { public OnTimeImporter(Plan plugin) {
this.plugin = plugin; this.plugin = plugin;
this.enabled = Bukkit.getPluginManager().isPluginEnabled("OnTime"); this.enabled = Bukkit.getPluginManager().isPluginEnabled("OnTime");
} }
/**
*
* @param uuids
* @return
*/
@Override @Override
public HashMap<UUID, Long> grabNumericData(Set<UUID> uuids) { public HashMap<UUID, Long> grabNumericData(Set<UUID> uuids) {
HashMap<UUID, Long> onTimeData = new HashMap<>(); HashMap<UUID, Long> onTimeData = new HashMap<>();
@ -35,6 +44,10 @@ public class OnTimeImporter implements Importer {
return onTimeData; return onTimeData;
} }
/**
*
* @return
*/
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;

View File

@ -22,6 +22,10 @@ public class PlanDeathEventListener implements Listener {
private final DataCacheHandler handler; private final DataCacheHandler handler;
private final KillHandler kH; private final KillHandler kH;
/**
*
* @param plugin
*/
public PlanDeathEventListener(Plan plugin) { public PlanDeathEventListener(Plan plugin) {
this.plugin = plugin; this.plugin = plugin;
this.handler = plugin.getHandler(); 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) { public void continueProcessing(LivingEntity dead, boolean killerIsPlayer, Player killer, UserData killersData) {
if (dead instanceof Player) { if (dead instanceof Player) {
Player killed = (Player) dead; Player killed = (Player) dead;

View File

@ -15,36 +15,153 @@ public abstract class Database {
private final Plan plugin; private final Plan plugin;
/**
*
* @param plugin
*/
public Database(Plan plugin) { public Database(Plan plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
/**
*
* @return
*/
public boolean init(){ public boolean init(){
return false; return false;
} }
/**
*
* @param uuid
* @param processors
* @throws SQLException
*/
public void giveUserDataToProcessors(UUID uuid, DBCallableProcessor... processors) throws SQLException { public void giveUserDataToProcessors(UUID uuid, DBCallableProcessor... processors) throws SQLException {
List<DBCallableProcessor> coll = new ArrayList<>(); List<DBCallableProcessor> coll = new ArrayList<>();
coll.addAll(Arrays.asList(processors)); coll.addAll(Arrays.asList(processors));
giveUserDataToProcessors(uuid, coll); giveUserDataToProcessors(uuid, coll);
} }
/**
*
* @param uuid
* @param processors
* @throws SQLException
*/
public abstract void giveUserDataToProcessors(UUID uuid, Collection<DBCallableProcessor> processors) throws SQLException; public abstract void giveUserDataToProcessors(UUID uuid, Collection<DBCallableProcessor> processors) throws SQLException;
/**
*
* @param uuid
* @param data
* @throws SQLException
*/
public abstract void saveUserData(UUID uuid, UserData data) throws SQLException; public abstract void saveUserData(UUID uuid, UserData data) throws SQLException;
/**
*
* @param data
* @throws SQLException
*/
public abstract void saveMultipleUserData(List<UserData> data) throws SQLException; public abstract void saveMultipleUserData(List<UserData> data) throws SQLException;
/**
*
* @param uuid
* @return
*/
public abstract boolean wasSeenBefore(UUID uuid); public abstract boolean wasSeenBefore(UUID uuid);
/**
*
*/
public abstract void clean(); public abstract void clean();
/**
*
* @return
*/
public abstract String getName(); public abstract String getName();
/**
*
* @return
*/
public String getConfigName() { public String getConfigName() {
return getName().toLowerCase().replace(" ", ""); return getName().toLowerCase().replace(" ", "");
} }
/**
*
* @return
*/
public ConfigurationSection getConfigSection() { public ConfigurationSection getConfigSection() {
return plugin.getConfig().getConfigurationSection(getConfigName()); return plugin.getConfig().getConfigurationSection(getConfigName());
} }
/**
*
* @return
* @throws SQLException
*/
public abstract int getVersion() throws SQLException; public abstract int getVersion() throws SQLException;
/**
*
* @param version
* @throws SQLException
*/
public abstract void setVersion(int version) throws SQLException; public abstract void setVersion(int version) throws SQLException;
/**
*
* @throws SQLException
*/
public abstract void close() throws SQLException; public abstract void close() throws SQLException;
/**
*
* @param uuid
* @return
* @throws SQLException
*/
public abstract boolean removeAccount(String uuid) throws SQLException; public abstract boolean removeAccount(String uuid) throws SQLException;
/**
*
* @return
* @throws SQLException
*/
public abstract boolean removeAllData() throws SQLException; public abstract boolean removeAllData() throws SQLException;
/**
*
* @param data
* @throws SQLException
* @throws NullPointerException
*/
public abstract void saveCommandUse(HashMap<String, Integer> data) throws SQLException, NullPointerException; public abstract void saveCommandUse(HashMap<String, Integer> data) throws SQLException, NullPointerException;
/**
*
* @return
* @throws SQLException
*/
public abstract Set<UUID> getSavedUUIDs() throws SQLException; public abstract Set<UUID> getSavedUUIDs() throws SQLException;
/**
*
* @return
* @throws SQLException
*/
public abstract HashMap<String, Integer> getCommandUse() throws SQLException; public abstract HashMap<String, Integer> getCommandUse() throws SQLException;
/**
*
* @param uuid
* @return
* @throws SQLException
*/
public abstract int getUserId(String uuid) throws SQLException; public abstract int getUserId(String uuid) throws SQLException;
} }

View File

@ -45,6 +45,10 @@ public class MySQLDB extends SQLDB {
} }
} }
/**
*
* @return
*/
@Override @Override
public String getName() { public String getName() {
return "MySQL"; return "MySQL";

View File

@ -24,6 +24,10 @@ import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import static org.bukkit.Bukkit.getOfflinePlayer; import static org.bukkit.Bukkit.getOfflinePlayer;
/**
*
* @author Rsl1122
*/
public abstract class SQLDB extends Database { public abstract class SQLDB extends Database {
final Plan plugin; final Plan plugin;
@ -88,6 +92,11 @@ public abstract class SQLDB extends Database {
private String versionName; private String versionName;
/**
*
* @param plugin
* @param supportsModification
*/
public SQLDB(Plan plugin, boolean supportsModification) { public SQLDB(Plan plugin, boolean supportsModification) {
super(plugin); super(plugin);
this.plugin = plugin; this.plugin = plugin;
@ -166,6 +175,10 @@ public abstract class SQLDB extends Database {
}).runTaskTimerAsynchronously(plugin, 60 * 20, 60 * 20); }).runTaskTimerAsynchronously(plugin, 60 * 20, 60 * 20);
} }
/**
*
* @return
*/
@Override @Override
public boolean init() { public boolean init() {
super.init(); super.init();
@ -177,6 +190,11 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @return
* @throws SQLException
*/
public boolean checkConnection() throws SQLException { public boolean checkConnection() throws SQLException {
if (connection == null || connection.isClosed()) { if (connection == null || connection.isClosed()) {
connection = getNewConnection(); connection = getNewConnection();
@ -304,13 +322,27 @@ public abstract class SQLDB extends Database {
return true; return true;
} }
/**
*
* @return
*/
protected abstract Connection getNewConnection(); protected abstract Connection getNewConnection();
/**
*
* @param sql
* @return
* @throws SQLException
*/
public boolean query(String sql) throws SQLException { public boolean query(String sql) throws SQLException {
boolean success = connection.createStatement().execute(sql); boolean success = connection.createStatement().execute(sql);
return success; return success;
} }
/**
*
* @throws SQLException
*/
@Override @Override
public void close() throws SQLException { public void close() throws SQLException {
if (connection != null) { if (connection != null) {
@ -318,6 +350,11 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @return
* @throws SQLException
*/
@Override @Override
public int getVersion() throws SQLException { public int getVersion() throws SQLException {
int version = 0; int version = 0;
@ -332,6 +369,11 @@ public abstract class SQLDB extends Database {
return version; return version;
} }
/**
*
* @param version
* @throws SQLException
*/
@Override @Override
public void setVersion(int version) throws SQLException { public void setVersion(int version) throws SQLException {
connection.prepareStatement("DELETE FROM " + versionName).executeUpdate(); connection.prepareStatement("DELETE FROM " + versionName).executeUpdate();
@ -339,6 +381,11 @@ public abstract class SQLDB extends Database {
} }
/**
*
* @param uuid
* @return
*/
@Override @Override
public boolean wasSeenBefore(UUID uuid) { public boolean wasSeenBefore(UUID uuid) {
try { try {
@ -349,6 +396,12 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @param uuid
* @return
* @throws SQLException
*/
@Override @Override
public int getUserId(String uuid) throws SQLException { public int getUserId(String uuid) throws SQLException {
int userId = -1; int userId = -1;
@ -384,6 +437,11 @@ public abstract class SQLDB extends Database {
return uuid; return uuid;
} }
/**
*
* @return
* @throws SQLException
*/
@Override @Override
public Set<UUID> getSavedUUIDs() throws SQLException { public Set<UUID> getSavedUUIDs() throws SQLException {
Set<UUID> uuids = new HashSet<>(); Set<UUID> uuids = new HashSet<>();
@ -400,6 +458,12 @@ public abstract class SQLDB extends Database {
return uuids; return uuids;
} }
/**
*
* @param data
* @throws SQLException
* @throws NullPointerException
*/
@Override @Override
public void saveCommandUse(HashMap<String, Integer> data) throws SQLException, NullPointerException { public void saveCommandUse(HashMap<String, Integer> data) throws SQLException, NullPointerException {
if (data.isEmpty()) { if (data.isEmpty()) {
@ -434,6 +498,11 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @return
* @throws SQLException
*/
@Override @Override
public HashMap<String, Integer> getCommandUse() throws SQLException { public HashMap<String, Integer> getCommandUse() throws SQLException {
HashMap<String, Integer> commandUse = new HashMap<>(); HashMap<String, Integer> commandUse = new HashMap<>();
@ -450,6 +519,12 @@ public abstract class SQLDB extends Database {
return commandUse; return commandUse;
} }
/**
*
* @param uuid
* @return
* @throws SQLException
*/
@Override @Override
public boolean removeAccount(String uuid) throws SQLException { public boolean removeAccount(String uuid) throws SQLException {
try { try {
@ -497,6 +572,12 @@ public abstract class SQLDB extends Database {
return true; return true;
} }
/**
*
* @param uuid
* @param processors
* @throws SQLException
*/
@Override @Override
public void giveUserDataToProcessors(UUID uuid, Collection<DBCallableProcessor> processors) throws SQLException { public void giveUserDataToProcessors(UUID uuid, Collection<DBCallableProcessor> processors) throws SQLException {
try { try {
@ -665,13 +746,18 @@ public abstract class SQLDB extends Database {
return killData; return killData;
} }
/**
*
* @param data
* @throws SQLException
*/
@Override @Override
public void saveMultipleUserData(List<UserData> data) throws SQLException { public void saveMultipleUserData(List<UserData> data) throws SQLException {
checkConnection(); checkConnection();
if (data.isEmpty()) { if (data.isEmpty()) {
return; return;
} }
Set<Exception> exceptions = new HashSet<>(); Set<Throwable> exceptions = new HashSet<>();
List<UserData> saveLast = new ArrayList<>(); List<UserData> saveLast = new ArrayList<>();
String uSQL = "UPDATE " + userName + " SET " String uSQL = "UPDATE " + userName + " SET "
+ userColumnDemAge + "=?, " + userColumnDemAge + "=?, "
@ -778,6 +864,12 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @param uuid
* @param data
* @throws SQLException
*/
@Override @Override
public void saveUserData(UUID uuid, UserData data) throws SQLException { public void saveUserData(UUID uuid, UserData data) throws SQLException {
if (uuid == null) { if (uuid == null) {
@ -866,6 +958,12 @@ public abstract class SQLDB extends Database {
data.stopAccessing(); data.stopAccessing();
} }
/**
*
* @param userId
* @param locations
* @throws SQLException
*/
public void saveAdditionalLocationsList(int userId, List<Location> locations) throws SQLException { public void saveAdditionalLocationsList(int userId, List<Location> locations) throws SQLException {
List<Location> newLocations = new ArrayList<>(); List<Location> newLocations = new ArrayList<>();
newLocations.addAll(locations); newLocations.addAll(locations);
@ -900,6 +998,13 @@ public abstract class SQLDB extends Database {
saveStatement.close(); saveStatement.close();
} }
/**
*
* @param userId
* @param names
* @param lastNick
* @throws SQLException
*/
public void saveNickList(int userId, HashSet<String> names, String lastNick) throws SQLException { public void saveNickList(int userId, HashSet<String> names, String lastNick) throws SQLException {
if (names.isEmpty()) { if (names.isEmpty()) {
return; return;
@ -929,6 +1034,12 @@ public abstract class SQLDB extends Database {
statement.close(); statement.close();
} }
/**
*
* @param userId
* @param sessions
* @throws SQLException
*/
public void saveSessionList(int userId, List<SessionData> sessions) throws SQLException { public void saveSessionList(int userId, List<SessionData> sessions) throws SQLException {
if (sessions.isEmpty()) { if (sessions.isEmpty()) {
return; return;
@ -958,6 +1069,12 @@ public abstract class SQLDB extends Database {
statement.close(); statement.close();
} }
/**
*
* @param userId
* @param kills
* @throws SQLException
*/
public void savePlayerKills(int userId, List<KillData> kills) throws SQLException { public void savePlayerKills(int userId, List<KillData> kills) throws SQLException {
if (kills.isEmpty()) { if (kills.isEmpty()) {
return; return;
@ -989,6 +1106,12 @@ public abstract class SQLDB extends Database {
statement.close(); statement.close();
} }
/**
*
* @param userId
* @param ips
* @throws SQLException
*/
public void saveIPList(int userId, HashSet<InetAddress> ips) throws SQLException { public void saveIPList(int userId, HashSet<InetAddress> ips) throws SQLException {
if (ips.isEmpty()) { if (ips.isEmpty()) {
return; return;
@ -1017,6 +1140,12 @@ public abstract class SQLDB extends Database {
statement.close(); statement.close();
} }
/**
*
* @param userId
* @param gamemodeTimes
* @throws SQLException
*/
public void saveGMTimes(int userId, HashMap<GameMode, Long> gamemodeTimes) throws SQLException { public void saveGMTimes(int userId, HashMap<GameMode, Long> gamemodeTimes) throws SQLException {
if (gamemodeTimes.isEmpty()) { if (gamemodeTimes.isEmpty()) {
return; return;
@ -1054,6 +1183,9 @@ public abstract class SQLDB extends Database {
} }
/**
*
*/
@Override @Override
public void clean() { public void clean() {
try { try {
@ -1064,6 +1196,10 @@ public abstract class SQLDB extends Database {
} }
} }
/**
*
* @return
*/
@Override @Override
public boolean removeAllData() { public boolean removeAllData() {
try { try {
@ -1093,10 +1229,18 @@ public abstract class SQLDB extends Database {
return success; return success;
} }
/**
*
* @return
*/
public boolean supportsModification() { public boolean supportsModification() {
return supportsModification; return supportsModification;
} }
/**
*
* @return
*/
public Connection getConnection() { public Connection getConnection() {
return connection; return connection;
} }

View File

@ -24,6 +24,11 @@ public class SQLiteDB extends SQLDB {
this(plugin, "database"); this(plugin, "database");
} }
/**
*
* @param plugin
* @param dbName
*/
public SQLiteDB(Plan plugin, String dbName) { public SQLiteDB(Plan plugin, String dbName) {
super(plugin, false); super(plugin, false);
@ -41,6 +46,11 @@ public class SQLiteDB extends SQLDB {
return getNewConnection(dbName); return getNewConnection(dbName);
} }
/**
*
* @param dbName
* @return
*/
public Connection getNewConnection(String dbName) { public Connection getNewConnection(String dbName) {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
@ -52,6 +62,10 @@ public class SQLiteDB extends SQLDB {
} }
} }
/**
*
* @return
*/
@Override @Override
public String getName() { public String getName() {
return "SQLite"; return "SQLite";

View File

@ -49,8 +49,8 @@ public enum Html {
OPERATOR(", Operator (Op)"), OPERATOR(", Operator (Op)"),
ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")), ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")),
OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")), OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")),
ACTIVE("| Player is Active"), ACTIVE("Player is Active"),
INACTIVE("| Player is inactive"), INACTIVE("Player is inactive"),
ERROR_LIST("Error Creating List</p>"), ERROR_LIST("Error Creating List</p>"),
HIDDEN("Hidden (config)"), HIDDEN("Hidden (config)"),
ERROR_NOT_SET("Error: Replace rule was not set"), ERROR_NOT_SET("Error: Replace rule was not set"),

View File

@ -15,6 +15,12 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/ */
public class PlayerActivityGraphCreator { public class PlayerActivityGraphCreator {
/**
*
* @param sessionData
* @param scale
* @return
*/
public static String[] generateDataArray(List<SessionData> sessionData, long scale) { public static String[] generateDataArray(List<SessionData> sessionData, long scale) {
Plan plugin = getPlugin(Plan.class); Plan plugin = getPlugin(Plan.class);
int maxPlayers = plugin.getHandler().getMaxPlayers(); int maxPlayers = plugin.getHandler().getMaxPlayers();

View File

@ -14,6 +14,11 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/ */
public class SortableCommandUseTableCreator { public class SortableCommandUseTableCreator {
/**
*
* @param commandUse
* @return
*/
public static String createSortedCommandUseTable(HashMap<String, Integer> commandUse) { public static String createSortedCommandUseTable(HashMap<String, Integer> commandUse) {
List<String[]> sorted = MapComparator.sortByValue(commandUse); List<String[]> sorted = MapComparator.sortByValue(commandUse);
String html = ""; String html = "";

View File

@ -13,6 +13,12 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/ */
public class SortableFactionsTableCreator { public class SortableFactionsTableCreator {
/**
*
* @param factionList
* @param fHook
* @return
*/
public static String createSortableFactionsTable(Collection<String> factionList, FactionsHook fHook) { public static String createSortableFactionsTable(Collection<String> factionList, FactionsHook fHook) {
String html = Html.TABLE_FACTIONS_START.parse(); String html = Html.TABLE_FACTIONS_START.parse();
if (factionList.isEmpty()) { if (factionList.isEmpty()) {

View File

@ -14,6 +14,11 @@ import static org.bukkit.Bukkit.getOfflinePlayer;
*/ */
public class SortableKillsTableCreator { public class SortableKillsTableCreator {
/**
*
* @param killData
* @return
*/
public static String createSortedSessionDataTable10(List<KillData> killData) { public static String createSortedSessionDataTable10(List<KillData> killData) {
String html = Html.TABLE_KILLS_START.parse(); String html = Html.TABLE_KILLS_START.parse();
if (killData.isEmpty()) { if (killData.isEmpty()) {

View File

@ -13,6 +13,11 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/ */
public class SortablePlayersTableCreator { public class SortablePlayersTableCreator {
/**
*
* @param data
* @return
*/
public static String createSortablePlayersTable(Collection<UserData> data) { public static String createSortablePlayersTable(Collection<UserData> data) {
String html = ""; String html = "";
for (UserData uData : data) { for (UserData uData : data) {

View File

@ -13,6 +13,11 @@ import main.java.com.djrapitops.plan.utilities.comparators.SessionDataComparator
*/ */
public class SortableSessionTableCreator { public class SortableSessionTableCreator {
/**
*
* @param sessionData
* @return
*/
public static String createSortedSessionDataTable10(List<SessionData> sessionData) { public static String createSortedSessionDataTable10(List<SessionData> sessionData) {
String html = Html.TABLE_SESSIONS_START.parse(); String html = Html.TABLE_SESSIONS_START.parse();
if (sessionData.isEmpty()) { if (sessionData.isEmpty()) {

View File

@ -13,6 +13,12 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
*/ */
public class SortableTownTableCreator { public class SortableTownTableCreator {
/**
*
* @param townNames
* @param tHook
* @return
*/
public static String createSortableTownsTable(Collection<String> townNames, TownyHook tHook) { public static String createSortableTownsTable(Collection<String> townNames, TownyHook tHook) {
String html = Html.TABLE_TOWNS_START.parse(); String html = Html.TABLE_TOWNS_START.parse();
if (townNames.isEmpty()) { if (townNames.isEmpty()) {

View File

@ -21,9 +21,6 @@ import org.bukkit.GameMode;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask; 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;
import static org.bukkit.Bukkit.getOfflinePlayer;
/** /**
* *
@ -152,6 +149,7 @@ public class Analysis {
long totalPlaytime = sorted.getTotalPlaytime(); long totalPlaytime = sorted.getTotalPlaytime();
analysisData.setTotalPlayTime(totalPlaytime); analysisData.setTotalPlayTime(totalPlaytime);
analysisData.setAveragePlayTime(totalPlaytime / rawData.size()); analysisData.setAveragePlayTime(totalPlaytime / rawData.size());
analysisData.setSessionAverage(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(sorted.getSessiondata())));
analysisData.setTotalLoginTimes(sorted.getTotalLoginTimes()); analysisData.setTotalLoginTimes(sorted.getTotalLoginTimes());
createActivityVisalization(sorted.getTotalBanned(), sorted.getActive(), sorted.getInactive(), sorted.getJoinleaver(), analysisData); createActivityVisalization(sorted.getTotalBanned(), sorted.getActive(), sorted.getInactive(), sorted.getJoinleaver(), analysisData);

View File

@ -1,11 +1,13 @@
package main.java.com.djrapitops.plan.utilities; package main.java.com.djrapitops.plan.utilities;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import main.java.com.djrapitops.plan.Settings; 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.data.UserData;
import main.java.com.djrapitops.plan.ui.Html; import main.java.com.djrapitops.plan.ui.Html;
import main.java.com.djrapitops.plan.ui.tables.SortableCommandUseTableCreator; 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 { public class AnalysisUtils {
/**
*
* @param lastPlayed
* @param playTime
* @param loginTimes
* @return
*/
public static boolean isActive(long lastPlayed, long playTime, int loginTimes) { public static boolean isActive(long lastPlayed, long playTime, int loginTimes) {
int timeToActive = Settings.ANALYSIS_MINUTES_FOR_ACTIVE.getNumber(); int timeToActive = Settings.ANALYSIS_MINUTES_FOR_ACTIVE.getNumber();
if (timeToActive < 0) { if (timeToActive < 0) {
@ -73,4 +82,23 @@ public class AnalysisUtils {
return newPlayers; return newPlayers;
} }
static List<Long> transformSessionDataToLengths(Collection<SessionData> data) {
List<Long> list = new ArrayList<>();
data.stream().forEach((sData) -> {
list.add(sData.getSessionEnd()-sData.getSessionStart());
});
return list;
}
static long average(Collection<Long> list) {
if (list.isEmpty()) {
return 0;
}
long total = 0;
for (Long long1 : list) {
total += long1;
}
return total / list.size();
}
} }

View File

@ -168,6 +168,11 @@ public class FormatUtils {
return string.replaceAll("§r", ""); return string.replaceAll("§r", "");
} }
/**
*
* @param d
* @return
*/
public static String cutDecimals(double d) { public static String cutDecimals(double d) {
DecimalFormat df = new DecimalFormat("#.##"); DecimalFormat df = new DecimalFormat("#.##");
df.setRoundingMode(RoundingMode.CEILING); df.setRoundingMode(RoundingMode.CEILING);

View File

@ -2,7 +2,6 @@ package main.java.com.djrapitops.plan.utilities;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.nio.file.Files;
import java.util.HashMap; import java.util.HashMap;
import java.util.Scanner; import java.util.Scanner;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
@ -15,6 +14,12 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
*/ */
public class HtmlUtils { public class HtmlUtils {
/**
*
* @param fileName
* @return
* @throws FileNotFoundException
*/
public static String getHtmlStringFromResource(String fileName) throws FileNotFoundException { public static String getHtmlStringFromResource(String fileName) throws FileNotFoundException {
Plan plugin = getPlugin(Plan.class); Plan plugin = getPlugin(Plan.class);
File localFile = new File(plugin.getDataFolder(), fileName); File localFile = new File(plugin.getDataFolder(), fileName);
@ -30,6 +35,12 @@ public class HtmlUtils {
return html; return html;
} }
/**
*
* @param html
* @param replaceMap
* @return
*/
public static String replacePlaceholders(String html, HashMap<String, String> replaceMap) { public static String replacePlaceholders(String html, HashMap<String, String> replaceMap) {
for (String key : replaceMap.keySet()) { for (String key : replaceMap.keySet()) {
html = html.replaceAll(key, replaceMap.get(key)); html = html.replaceAll(key, replaceMap.get(key));
@ -37,6 +48,10 @@ public class HtmlUtils {
return html; return html;
} }
/**
*
* @return
*/
public static String getServerAnalysisUrl() { public static String getServerAnalysisUrl() {
int port = Settings.WEBSERVER_PORT.getNumber(); int port = Settings.WEBSERVER_PORT.getNumber();
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port; String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
@ -49,6 +64,11 @@ public class HtmlUtils {
return url; return url;
} }
/**
*
* @param playerName
* @return
*/
public static String getInspectUrl(String playerName) { public static String getInspectUrl(String playerName) {
int port = Settings.WEBSERVER_PORT.getNumber(); int port = Settings.WEBSERVER_PORT.getNumber();
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port; String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
@ -60,4 +80,11 @@ public class HtmlUtils {
String url = "http://" + ip + "/" + securityCode + "/player/" + playerName; String url = "http://" + ip + "/" + securityCode + "/player/" + playerName;
return url; return url;
} }
static String removeXSS(String string) {
return string.replaceAll("<!--", "")
.replaceAll("-->", "")
.replaceAll("<script>", "")
.replaceAll("</script>", "");
}
} }

View File

@ -43,7 +43,7 @@ public class PlaceholderUtils {
replaceMap.put("%npday%", data.getNewPlayersDay() + ""); replaceMap.put("%npday%", data.getNewPlayersDay() + "");
replaceMap.put("%npweek%", data.getNewPlayersWeek() + ""); replaceMap.put("%npweek%", data.getNewPlayersWeek() + "");
replaceMap.put("%npmonth%", data.getNewPlayersMonth() + ""); replaceMap.put("%npmonth%", data.getNewPlayersMonth() + "");
replaceMap.put("%commanduse%", data.getTop50CommandsListHtml()); replaceMap.put("%commanduse%", HtmlUtils.removeXSS(data.getCommandUseListHtml()));
replaceMap.put("%totalcommands%", data.getTotalCommands()+""); replaceMap.put("%totalcommands%", data.getTotalCommands()+"");
replaceMap.put("%avgage%", (data.getAverageAge() != -1) ? "" + data.getAverageAge() : Phrase.DEM_UNKNOWN + ""); replaceMap.put("%avgage%", (data.getAverageAge() != -1) ? "" + data.getAverageAge() : Phrase.DEM_UNKNOWN + "");
replaceMap.put("%avgplaytime%", FormatUtils.formatTimeAmount("" + data.getAveragePlayTime())); 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 replaceMap.put("%gmcolors%", "\"#" + Settings.HCOLOR_GMP_0 + "\",\"#" + Settings.HCOLOR_GMP_1
+ "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\""); + "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\"");
replaceMap.putAll(plugin.getHookHandler().getAdditionalAnalysisReplaceRules()); replaceMap.putAll(plugin.getHookHandler().getAdditionalAnalysisReplaceRules());
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(data.getSessionAverage()+""));
return replaceMap; return replaceMap;
} }
@ -143,13 +144,9 @@ public class PlaceholderUtils {
replaceMap.put("%gm1%", FormatUtils.formatTimeAmount("" + gmData[1])); replaceMap.put("%gm1%", FormatUtils.formatTimeAmount("" + gmData[1]));
replaceMap.put("%gm2%", FormatUtils.formatTimeAmount("" + gmData[2])); replaceMap.put("%gm2%", FormatUtils.formatTimeAmount("" + gmData[2]));
replaceMap.put("%gm3%", FormatUtils.formatTimeAmount("" + gmData[3])); 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("%gmtotal%", FormatUtils.formatTimeAmount("" + total));
replaceMap.put("%ips%", (showIPandUUID ? data.getIps().toString() : Html.HIDDEN.parse())); 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("%name%", data.getName());
replaceMap.put("%registered%", FormatUtils.formatTimeStamp("" + data.getRegistered())); replaceMap.put("%registered%", FormatUtils.formatTimeStamp("" + data.getRegistered()));
replaceMap.put("%timeskicked%", "" + data.getTimesKicked()); replaceMap.put("%timeskicked%", "" + data.getTimesKicked());
@ -162,6 +159,7 @@ public class PlaceholderUtils {
replaceMap.put("%playerkills%", data.getPlayerKills().size() + ""); replaceMap.put("%playerkills%", data.getPlayerKills().size() + "");
replaceMap.put("%mobkills%", data.getMobKills() + ""); replaceMap.put("%mobkills%", data.getMobKills() + "");
replaceMap.put("%sessionstable%", SortableSessionTableCreator.createSortedSessionDataTable10(data.getSessions())); 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())); replaceMap.put("%killstable%", SortableKillsTableCreator.createSortedSessionDataTable10(data.getPlayerKills()));
Plan plugin = getPlugin(Plan.class); Plan plugin = getPlugin(Plan.class);
replaceMap.put("%version%", plugin.getDescription().getVersion()); replaceMap.put("%version%", plugin.getDescription().getVersion());
@ -171,6 +169,10 @@ public class PlaceholderUtils {
replaceMap.put("%labelsweek%", playersDataArray[1]); replaceMap.put("%labelsweek%", playersDataArray[1]);
replaceMap.put("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL + ""); replaceMap.put("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL + "");
replaceMap.put("%playersgraphfill%", Settings.HCOLOR_ACT_ONL_FILL + ""); 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.put("%inaccuratedatawarning%", (new Date().getTime() - data.getRegistered() < 180000) ? Html.WARN_INACCURATE.parse() : "");
replaceMap.putAll(plugin.getHookHandler().getAdditionalInspectReplaceRules(uuid)); replaceMap.putAll(plugin.getHookHandler().getAdditionalInspectReplaceRules(uuid));
return replaceMap; return replaceMap;

View File

@ -27,6 +27,11 @@ public class MapComparator {
return sortedList; return sortedList;
} }
/**
*
* @param hashMap
* @return
*/
public static List<String[]> sortByValueLong(HashMap<String, Long> hashMap) { public static List<String[]> sortByValueLong(HashMap<String, Long> hashMap) {
List<String[]> sortedList = new ArrayList<>(); List<String[]> sortedList = new ArrayList<>();
hashMap.keySet().stream().forEach((key) -> { hashMap.keySet().stream().forEach((key) -> {

View File

@ -200,7 +200,7 @@
<div class="clearfix"> <div class="clearfix">
<div id="navLinks"> <div id="navLinks">
<ul> <ul>
<li class="itemLinks" data-pos="0px"><i class="fa fa-info" aria-hidden="true"></i> Information</li> <li class="itemLinks" data-pos="0px"><i class="fa fa-info-circle" aria-hidden="true"></i> Information</li>
<li class="itemLinks" data-pos="-25%"><i class="fa fa-bar-chart" aria-hidden="true"></i> Online Activity</li> <li class="itemLinks" data-pos="-25%"><i class="fa fa-bar-chart" aria-hidden="true"></i> Online Activity</li>
<li class="itemLinks" data-pos="-50%"><i class="fa fa-list-alt" aria-hidden="true"></i> Playerlist</li> <li class="itemLinks" data-pos="-50%"><i class="fa fa-list-alt" aria-hidden="true"></i> Playerlist</li>
<li class="itemLinks" data-pos="-75%"><i class="fa fa-terminal" aria-hidden="true"></i> Command usage</li> <li class="itemLinks" data-pos="-75%"><i class="fa fa-terminal" aria-hidden="true"></i> Command usage</li>
@ -228,9 +228,10 @@
</div> </div>
</div> </div>
</div> </div>
<canvas id="playerChartDay" width="1000" height="350" style="width: 95%;"></canvas> <canvas id="playerChartDay" width="1000" height="350" style="width: 95%;"></canvas><br/>
<div class="buttons"> <p class="header-label" style="color: #267F00; "><i class="fa fa-calendar-check-o" aria-hidden="true"></i><span class="header-text"> Recent Logins</span></p>
<p><b>Most recent logins</b>: %recentlogins%</p> <div class="buttons">
%recentlogins%
</div> </div>
%towntable%<br/> %towntable%<br/>
%factionstable% %factionstable%
@ -238,7 +239,7 @@
<div class="column" style="width: 40%;"> <div class="column" style="width: 40%;">
<div class="headerbox"> <div class="headerbox">
<div class="header-icon"> <div class="header-icon">
<div class="header-label"><i class="fa fa-info" aria-hidden="true"></i><span class="header-text"> Information</span></div> <div class="header-label"><i class="fa fa-info-circle" aria-hidden="true"></i><span class="header-text"> Information</span></div>
</div> </div>
<div class="infobox" style="float: right;"> <div class="infobox" style="float: right;">
<div class="info-icon"> <div class="info-icon">
@ -254,11 +255,11 @@
</div> </div>
</div> </div>
</div> </div>
<p>A Total of %totalplaytime% has been played with the average of %avgplaytime%<br/> <p><i class="fa fa-clock-o" aria-hidden="true"></i> Total Playtime: %totalplaytime% | <i class="fa fa-clock-o" aria-hidden="true"></i> Player Average: %avgplaytime%<br/>
Players have joined %totallogins% times.<br/> <i class="fa fa-clock-o" aria-hidden="true"></i> Average Session Length: %sessionaverage%<br/>
Players have died %deaths% times, of which %playerkills% were caused by another Player.<br/> <i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Total Login times: %totallogins%<br/>
A Total of %mobkills% mobs have been slain.<br/> <b><i class="fa fa-crosshairs" aria-hidden="true"></i></b> Player kills: %playerkills% | <i class="fa fa-crosshairs" aria-hidden="true"></i> Mob kills: %mobkills% | <i class="fa fa-meh-o" aria-hidden="true"></i> Deaths: %deaths%<br/>
The average of known player ages is %avgage%.
%essentialswarps%</p> %essentialswarps%</p>
<p class="header-label" style="color: #267F00; "><i class="fa fa-pie-chart" aria-hidden="true"></i><span class="header-text"> Gamemode Usage</span></p><br/> <p class="header-label" style="color: #267F00; "><i class="fa fa-pie-chart" aria-hidden="true"></i><span class="header-text"> Gamemode Usage</span></p><br/>
<div class="box-area"> <div class="box-area">
@ -451,9 +452,10 @@
</div> </div>
</div> </div>
</div><br/> </div><br/>
<canvas id="activityPie" width="1000" height="600" style="width: 95%;"></canvas> <canvas id="activityPie" width="1000" height="600" style="width: 95%;"></canvas><br/>
<p class="header-label" style="color: #267F00; "><i class="fa fa-calendar-check-o" aria-hidden="true"></i><span class="header-text"> Recent Logins</span></p>
<div class="buttons"> <div class="buttons">
<p><b>Most recent logins</b>: %recentlogins%</p> %recentlogins%
</div> </div>
</div> </div>
</div> </div>
@ -507,7 +509,7 @@
%totalcommands% %totalcommands%
</div> </div>
<div class="info-label"> <div class="info-label">
Commands Unique
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,6 +7,10 @@ Settings:
LogProgressOnConsole: false LogProgressOnConsole: false
MinutesPlayedUntilConsidiredActive: 10 MinutesPlayedUntilConsidiredActive: 10
Cache: Cache:
Processing:
GetLimit: 2000
SaveLimit: 1000
ClearLimit: 1000
AnalysisCache: AnalysisCache:
RefreshAnalysisCacheOnEnable: true RefreshAnalysisCacheOnEnable: true
RefreshEveryXMinutes: -1 RefreshEveryXMinutes: -1

View File

@ -6,6 +6,7 @@
<meta name="description" content="Player inspect window"> <meta name="description" content="Player inspect window">
<meta name="author" content="Rsl1122"> <meta name="author" content="Rsl1122">
<link rel="icon" href="https://puu.sh/tK0KL/6aa2ba141b.ico" type="image/x-icon" /> <link rel="icon" href="https://puu.sh/tK0KL/6aa2ba141b.ico" type="image/x-icon" />
<script src="https://use.fontawesome.com/df48eb908b.js"></script>
<style> <style>
* { * {
box-sizing: border-box; box-sizing: border-box;
@ -65,6 +66,59 @@
table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after { table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after {
content: " \25B4\25BE" content: " \25B4\25BE"
} }
.box-area {
width: 100%;
text-align: center;
margin: 0px;
padding: 0px;
}
.infobox {
color: white;
display: inline-block;
background-color: #267F00;
padding: 8px 14px;
border-radius: 10px;
}
.info-text {
float: right;
width: 80%;
text-align: right;
}
.info-number {
font-size: x-large;
float: right;
}
.info-label {
float: right;
font-size: medium;
}
.info-icon {
font-size: xx-large;
float: left;
width: 10%;
}
.headerbox {
color: #267F00;
display: inline-block;
border-style: solid;
border-color: #267F00;
padding: 8px 14px;
border-radius: 10px;
width: 100%;
}
.header-icon {
font-size: xx-large;
float: left;
width: 40%;
}
.header-text {
font-size: x-large;
}
.header-label {
padding: 0px;
margin: 0px;
border: 0px;
}
.black { .black {
color: #000000; color: #000000;
} }
@ -121,33 +175,179 @@
<img style="float: right; padding: 5px" src="http://puu.sh/tJZUb/c2e0ab220f.png" alt="Player Analytics | Inspect %name%"> <img style="float: right; padding: 5px" src="http://puu.sh/tJZUb/c2e0ab220f.png" alt="Player Analytics | Inspect %name%">
<p style="float: right; text-align: right;">Player Analytics v.%version%</p> <p style="float: right; text-align: right;">Player Analytics v.%version%</p>
<h1>Plan | Inspect Player %name%</h1> <h1>Plan | Inspect Player %name%</h1>
<h4>Registered: %registered% %banned%%op%</h4> <h4>Has Connected from ips: %ips%</h4>
</header> </header>
<div class="clearfix"> %inaccuratedatawarning%
%inaccuratedatawarning% <div style="opacity: 0;">
<ul>
<li></li>
</ul>
</div>
<div class="clearfix">
<div class="column info"> <div class="column info">
<h4>Information</h4> <img style="float: right; padding: 5px" alt="%name%" src="http://cravatar.eu/head/%name%/128.png"> <div class="headerbox">
<p>Last seen: %lastseen% %active% %isonline% %essentials%<br/> <div class="header-icon">
Nicknames: %nicknames% | Has connected from ips: %ips%<br/> <div class="header-label"><i class="fa fa-info-circle" aria-hidden="true"></i><span class="header-text"> Information</span></div>
Geolocation: %geoloc%<br/> </div>
Playtime: %playtime%<br/> <div class="infobox" style="float: right;">
Has logged in %logintimes% times. | Has been kicked %timeskicked% times.<br/> <div class="info-icon">
Age: %age% | Gender: %gender%<br/> <i class="fa fa-user-plus" aria-hidden="true"></i>
Player kills: %playerkills% | Mob kills: %mobkills% | Deaths: %deaths%<br/> </div>
UUID: %uuid% <div class="info-text">
%achievements%%votes%%faction%%town%</p> <div class="info-number">
<h4>Last 10 Play Sessions</h4> %registered%
%sessionstable% </div>
<h4>Last 10 Player Kills</h4> <div class="info-label">
%killstable% Registered
</div>
</div>
</div>
</div>
<img style="float: right; padding: 5px" alt="%name%" src="http://cravatar.eu/head/%name%/128.png">
<p><i class="fa fa-user" aria-hidden="true"></i> %active% %isonline% %essentials% %banned%%op%<br/>
<i class="fa fa-address-card-o" aria-hidden="true"></i> Nicknames: %nicknames%<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Playtime: %playtime%<br/>
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Login times %logintimes%<br/>
<i class="fa fa-gavel" aria-hidden="true"></i> Times kicked %timeskicked%<br/>
<i class="fa fa-crosshairs" aria-hidden="true"></i> Player kills: %playerkills% | <i class="fa fa-crosshairs" aria-hidden="true"></i> Mob kills: %mobkills% | <i class="fa fa-meh-o" aria-hidden="true"></i> Deaths: %deaths%<br/>
<br/>
<i class="fa fa-globe" aria-hidden="true"></i> Geolocation: %geoloc%<br/>
<i class="fa fa-play" aria-hidden="true"></i> Age: %age% | <i class="fa fa-male" aria-hidden="true"></i><i class="fa fa-female" aria-hidden="true"></i> Gender: %gender%<br/>
<i class="fa fa-tag" aria-hidden="true"></i> UUID: %uuid%<br/>
%achievements%%votes%%faction%%town%</p>
<div class="headerbox">
<div class="header-icon" style="width: 50%">
<div class="header-label"><i class="fa fa-pie-chart" aria-hidden="true"></i><span class="header-text"> Gamemode Usage</span></div>
</div>
<div class="infobox" style="float: right;">
<div class="info-icon">
<i class="fa fa-clock-o" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gmtotal%
</div>
<div class="info-label">
Total
</div>
</div>
</div>
</div>
<div class="box-area">
<div class="infobox" style="background-color: #%gm0col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-fire" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm0%
</div>
<div class="info-label">
Survival
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm1col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-cube" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm1%
</div>
<div class="info-label">
Creative
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm2col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm2%
</div>
<div class="info-label">
Adventure
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm3col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-binoculars" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm3%
</div>
<div class="info-label">
Spectator
</div>
</div>
</div>
</div>
</div> </div>
<div class="column graphs"> <div class="column graphs">
<h4>Player Activity | Last 7 days</h4> <div class="headerbox">
<div class="header-icon">
<div class="header-label"><i class="fa fa-bar-chart" aria-hidden="true"></i><span class="header-text"> Player Activity<br/>Last 7d</span></div>
</div>
<div class="infobox" style="float: right;">
<div class="info-icon">
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%lastseen%
</div>
<div class="info-label">
Last seen
</div>
</div>
</div>
</div>
<canvas id="playerChartWeek" width="1000" height="350" style="width: 95%;"></canvas> <canvas id="playerChartWeek" width="1000" height="350" style="width: 95%;"></canvas>
<h4>Gamemode Usage - Total: %gmtotal%</h4> <br/>
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%</p> <div class="headerbox">
<canvas id="gmPie" width="1000" height="600" style="width: 95%;"></canvas> <div class="header-icon">
<div class="header-label"><i class="fa fa-list" aria-hidden="true"></i><span class="header-text"> Last 10 Sessions</span></div>
</div>
<div class="infobox" style="float: right;">
<div class="info-icon">
<i class="fa fa-clock-o" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%sessionaverage%
</div>
<div class="info-label">
Average Length
</div>
</div>
</div>
</div><br/>
%sessionstable%
<br/>
<div class="headerbox">
<div class="header-icon">
<div class="header-label"><i class="fa fa-crosshairs" aria-hidden="true"></i><span class="header-text"> Last 10 Kills</span></div>
</div>
<div class="infobox" style="float: right;">
<div class="info-icon">
<i class="fa fa-crosshairs" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%playerkills%
</div>
<div class="info-label">
Player Kills
</div>
</div>
</div>
</div><br/>
%killstable%
</div> </div>
</div> </div>
@ -156,30 +356,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<script> <script>
// Script for All charts using Chart.js // Script for All charts using Chart.js
var ctxgmpie = document.getElementById("gmPie"); var ctxweek = document.getElementById("playerChartWeek");
var ctxweek = document.getElementById("playerChartWeek");
var dataGmPie = {
labels: %gmlabels% ,
datasets: [
{
data: %gmdata% ,
backgroundColor: [ %gmcolors% ],
hoverBackgroundColor: [ %gmcolors% ]
}
]
}
var GMPie = new Chart(ctxgmpie, {
type: 'doughnut',
data: dataGmPie,
options: {
legend: {
position: 'right',
labels: {
padding: 7
}
}
}
});
var dataweek = { var dataweek = {
labels: %labelsweek% , labels: %labelsweek% ,
datasets: [ datasets: [