Reformatted code

This commit is contained in:
Fuzzlemann 2017-07-26 15:46:19 +02:00
parent 2a7ef0ab46
commit 8186f06d96
176 changed files with 2985 additions and 2944 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name='Checker'>
<!-- asetetaan kieliasetukset englanniksi. -->

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>

View File

@ -46,7 +46,9 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath com.djrapitops.nmplayer.NMPlayer</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath
com.djrapitops.nmplayer.NMPlayer
</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>

View File

@ -4,7 +4,7 @@ import java.util.Collection;
/**
* This class manages the messages going to the Console Logger.
*
* <p>
* Methods of Abstract Plugin Framework log utility are used.
*
* @author Rsl1122

View File

@ -44,7 +44,7 @@ public enum Permissions {
/**
* Returns the permission node in plugin.yml.
*
* <p>
* Same as getPermission.
*
* @return permission node eg. plan.inspect

View File

@ -188,6 +188,32 @@ public enum Phrase {
this.text = "";
}
static void loadLocale(File localeFile) {
try {
Scanner localeScanner = new Scanner(localeFile, "UTF-8");
List<String> localeRows = new ArrayList<>();
while (localeScanner.hasNextLine()) {
String line = localeScanner.nextLine();
if (!line.isEmpty()) {
if ("<<<<<<HTML>>>>>>".equals(line)) {
break;
}
localeRows.add(line);
}
}
for (String localeRow : localeRows) {
try {
String[] split = localeRow.split(" <> ");
Phrase.valueOf(split[0]).setText(split[1]);
} catch (IllegalArgumentException e) {
Log.error("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
}
}
} catch (IOException e) {
}
}
@Override
public String toString() {
return text;
@ -242,30 +268,4 @@ public enum Phrase {
public void setColor(char colorCode) {
this.color = ChatColor.getByChar(colorCode);
}
static void loadLocale(File localeFile) {
try {
Scanner localeScanner = new Scanner(localeFile, "UTF-8");
List<String> localeRows = new ArrayList<>();
while (localeScanner.hasNextLine()) {
String line = localeScanner.nextLine();
if (!line.isEmpty()) {
if ("<<<<<<HTML>>>>>>".equals(line)) {
break;
}
localeRows.add(line);
}
}
for (String localeRow : localeRows) {
try {
String[] split = localeRow.split(" <> ");
Phrase.valueOf(split[0]).setText(split[1]);
} catch (IllegalArgumentException e) {
Log.error("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
}
}
} catch (IOException e) {
}
}
}

View File

@ -52,7 +52,7 @@ import java.util.concurrent.ScheduledExecutorService;
/**
* Main class for Bukkit that manages the plugin.
*
* <p>
* Everything can be accessed through this class. Use Plan.getInstance() to get
* the initialised instance of Plan.
*
@ -77,8 +77,32 @@ public class Plan extends BukkitPlugin<Plan> {
private int bootAnalysisTaskID = -1;
/**
* OnEnable method.
* Used to get the PlanAPI. @see API
*
* @return API of the current instance of Plan.
* @throws IllegalStateException If onEnable method has not been called on
* Plan and the instance is null.
*/
public static API getPlanAPI() throws IllegalStateException {
Plan instance = getInstance();
if (instance == null) {
throw new IllegalStateException("Plugin not enabled properly, Singleton instance is null.");
}
return instance.api;
}
/**
* Used to get the plugin-instance singleton.
*
* @return this object.
*/
public static Plan getInstance() {
return (Plan) getPluginInstance(Plan.class);
}
/**
* OnEnable method.
* <p>
* - Enables the plugin's subsystems.
*/
@Override
@ -182,7 +206,7 @@ public class Plan extends BukkitPlugin<Plan> {
/**
* Disables the plugin.
*
* <p>
* Stops the webserver, cancels all tasks and saves cache to the database.
*/
@Override
@ -233,7 +257,7 @@ public class Plan extends BukkitPlugin<Plan> {
/**
* Initializes the database according to settings in the config.
*
* <p>
* If database connection can not be established plugin is disabled.
*
* @return true if init was successful, false if not.
@ -414,7 +438,7 @@ public class Plan extends BukkitPlugin<Plan> {
/**
* Used to get all possible database objects.
*
* <p>
* #init() might need to be called in order for the object to function.
*
* @return Set containing the SqLite and MySQL objects.
@ -446,35 +470,11 @@ public class Plan extends BukkitPlugin<Plan> {
/**
* Old method for getting the API.
*
* @deprecated Use Plan.getPlanAPI() (static method) instead.
* @return the Plan API.
* @deprecated Use Plan.getPlanAPI() (static method) instead.
*/
@Deprecated
public API getAPI() {
return api;
}
/**
* Used to get the PlanAPI. @see API
*
* @return API of the current instance of Plan.
* @throws IllegalStateException If onEnable method has not been called on
* Plan and the instance is null.
*/
public static API getPlanAPI() throws IllegalStateException {
Plan instance = getInstance();
if (instance == null) {
throw new IllegalStateException("Plugin not enabled properly, Singleton instance is null.");
}
return instance.api;
}
/**
* Used to get the plugin-instance singleton.
*
* @return this object.
*/
public static Plan getInstance() {
return (Plan) getPluginInstance(Plan.class);
}
}

View File

@ -25,20 +25,20 @@ import java.util.stream.Collectors;
/**
* This class contains the API methods.
*
* <p>
* Methods can be called from Asynchronous task and are thread safe unless
* otherwise stated.
*
* <p>
* Use Plan.getPlanAPI() to get the API.
*
* <p>
* More information about API methods can be found on GitHub.
*
* @author Rsl1122
* @since 2.0.0
* @see PluginData
* @see AnalysisType
* @see DBCallableProcessor
* @see HandlingInfo
* @since 2.0.0
*/
public class API {
@ -65,7 +65,7 @@ public class API {
/**
* Add a source of plugin data to the Plugins tab on Analysis and/or Inspect
* page.
*
* <p>
* Refer to documentation on GitHub or Javadoc of PluginData to set-up a
* data source that extends PluginData correctly.
*
@ -81,10 +81,10 @@ public class API {
/**
* Used to get the link to InspectPage of a player.
*
* <p>
* This method is useful if you have a table and want to link to the inspect
* page.
*
* <p>
* Html.LINK.parse("Link", "Playername") can be used to get a link
* {@code <a href="Link">Playername</a>}
*
@ -98,7 +98,7 @@ public class API {
/**
* Schedule a UserData object to be fetched from the database or cache if
* the player is online.
*
* <p>
* The data will not be cached if it is not already cached.
*
* @param uuid UUID of the player.
@ -111,7 +111,7 @@ public class API {
/**
* Schedule a HandlingInfo object to be processed.
*
* <p>
* UserData associated with the UUID of the HandlingInfo object will be
* cached.
*
@ -123,7 +123,7 @@ public class API {
/**
* Used to cache a UserData object.
*
* <p>
* If data is already cached it will be overridden.
*
* @param data UserData object. Will be placed to the data.getUuid() key in
@ -135,7 +135,7 @@ public class API {
/**
* Used to save the cached data to the database.
*
* <p>
* Should be only called from an Asynchronous thread.
*/
public void saveCachedData() {
@ -154,7 +154,7 @@ public class API {
/**
* Cache the UserData to InspectCache.
*
* <p>
* Uses cache if data is cached or database if not. Call from an Asynchronous
* thread.
*
@ -166,7 +166,7 @@ public class API {
/**
* Used to get the full Html of the Inspect page as a string.
*
* <p>
* Check if the data is cached to InspectCache before calling this.
*
* @param uuid UUID of the player.
@ -193,7 +193,7 @@ public class API {
/**
* Run's the analysis with the current data in the cache and fetches rest
* from the database.
*
* <p>
* Starts a new Asynchronous task to run the analysis.
*/
public void updateAnalysisCache() {
@ -202,7 +202,7 @@ public class API {
/**
* Used to get the full HTML of the Analysis page as a string.
*
* <p>
* Check if the data is cached to AnalysisCache before calling this.
*
* @return analysis.html with all placeholders replaced.
@ -218,7 +218,7 @@ public class API {
/**
* Used to get the AnalysisData object.
*
* <p>
* Check if the data is cached to AnalysisCache before calling this.
*
* @return AnalysisData object.
@ -259,7 +259,7 @@ public class API {
/**
* Get the saved UUIDs in the database.
*
* <p>
* Should be called from async thread.
*
* @return Collection of UUIDs that can be found in the database.
@ -272,9 +272,9 @@ public class API {
/**
* Get the saved UserData in the database for a collection of UUIDs.
*
* <p>
* Will not contain data for UUIDs not found in the database.
*
* <p>
* Should be called from async thread.
*
* @param uuids Collection of UUIDs that can be found in the database.
@ -288,7 +288,7 @@ public class API {
/**
* Get the cached UserData objects in the InspectCache.
*
* <p>
* This can be used with PluginData objects safely to get the data for all
* users in Plan database, because all data is InspectCached before analysis
* begins.
@ -302,7 +302,7 @@ public class API {
/**
* Get the cached UserData objects in the InspectCache in a Map form.
*
* <p>
* This can be used with PluginData objects safely to get the data for all
* users in Plan database, because all data is InspectCached before analysis
* begins.

View File

@ -9,7 +9,7 @@ import main.java.com.djrapitops.plan.command.commands.*;
/**
* TreeCommand for the /plan command, and all subcommands.
*
* <p>
* Uses the Abstract Plugin Framework for easier command management.
*
* @author Rsl1122
@ -19,7 +19,7 @@ public class PlanCommand extends TreeCommand<Plan> {
/**
* CommandExecutor class Constructor.
*
* <p>
* Initializes Subcommands
*
* @param plugin Current instance of Plan

View File

@ -6,11 +6,7 @@ import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.ISender;
import com.djrapitops.plugin.command.SubCommand;
import com.djrapitops.plugin.task.AbsRunnable;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Permissions;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.*;
import main.java.com.djrapitops.plan.command.ConditionUtils;
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
import main.java.com.djrapitops.plan.ui.text.TextUI;
@ -110,7 +106,7 @@ public class AnalyzeCommand extends SubCommand {
/**
* Used to send the message after /plan analysis.
*
* <p>
* Final because
*
* @param sender Command sender.

View File

@ -15,7 +15,7 @@ import org.bukkit.command.CommandException;
/**
* Command used to display link to the player list webpage.
*
* <p>
* Subcommand is not registered if Webserver is not enabled.
*
* @author Rsl1122

View File

@ -9,7 +9,7 @@ import main.java.com.djrapitops.plan.command.commands.manage.*;
/**
* This command is used to manage the database of the plugin.
*
* <p>
* No arguments will run ManageHelpCommand. Contains subcommands.
*
* @author Rsl1122

View File

@ -6,7 +6,6 @@ import com.djrapitops.plugin.command.ISender;
import com.djrapitops.plugin.command.SubCommand;
import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.utilities.Verify;
import java.util.UUID;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Permissions;
import main.java.com.djrapitops.plan.Phrase;
@ -18,6 +17,8 @@ import main.java.com.djrapitops.plan.utilities.Check;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility;
import java.util.UUID;
/**
* This command is used to cache UserData to InspectCache and to view some of
* the data in game.

View File

@ -17,11 +17,11 @@ import org.bukkit.ChatColor;
/**
* Command for registering web users.
*
* <p>
* Registers a new webuser to the database.
*
* <p>
* No permission required for self registration. (Constructor string is empty)
*
* <p>
* plan.webmanage required for registering other users.
*
* @author Rsl1122

View File

@ -21,7 +21,7 @@ import java.util.stream.Collectors;
/**
* This manage subcommand is used to import data from 3rd party plugins.
*
* <p>
* Supported plugins (v3.0.0) : OnTime
*
* @author Rsl1122

View File

@ -18,7 +18,7 @@ import java.util.UUID;
/**
* This manage subcommand is used to move all data from one database to another.
*
* <p>
* Destination database will be cleared.
*
* @author Rsl1122

View File

@ -13,12 +13,12 @@ import java.util.Map;
/**
* Big container object for Data.
*
* <p>
* Contains parts that can be analysed. Each part has their own purpose.
*
* <p>
* Parts contain variables that can be added to. These variables are then
* analysed using the analysis method.
*
* <p>
* After being analysed the ReplaceMap can be retrieved for replacing
* placeholders on the analysis.html file.
*
@ -27,14 +27,6 @@ import java.util.Map;
*/
public class AnalysisData extends RawData<AnalysisData> {
private long refreshDate;
private String planVersion;
private String pluginsTabLayout;
private Map<String, String> additionalDataReplaceMap;
private String playersTable;
private final ActivityPart activityPart;
private final CommandUsagePart commandUsagePart;
private final GamemodePart gamemodePart;
@ -44,6 +36,11 @@ public class AnalysisData extends RawData<AnalysisData> {
private final PlayerCountPart playerCountPart;
private final PlaytimePart playtimePart;
private final TPSPart tpsPart;
private long refreshDate;
private String planVersion;
private String pluginsTabLayout;
private Map<String, String> additionalDataReplaceMap;
private String playersTable;
public AnalysisData(Map<String, Integer> commandUsage, List<TPS> tpsData) {
commandUsagePart = new CommandUsagePart(commandUsage);
@ -125,10 +122,6 @@ public class AnalysisData extends RawData<AnalysisData> {
this.additionalDataReplaceMap = additionalDataReplaceMap;
}
public void setRefreshDate(long refreshDate) {
this.refreshDate = refreshDate;
}
public void setPlayersTable(String playersTable) {
this.playersTable = playersTable;
}
@ -166,4 +159,8 @@ public class AnalysisData extends RawData<AnalysisData> {
public long getRefreshDate() {
return refreshDate;
}
public void setRefreshDate(long refreshDate) {
this.refreshDate = refreshDate;
}
}

View File

@ -44,7 +44,7 @@ public class SessionData {
/**
* Ends the session with given end point.
*
* <p>
* (Changes the end to the parameter.).
*
* @param endOfSession Epoch millisecond the session ended.

View File

@ -16,9 +16,9 @@ import java.util.stream.Collectors;
*/
public class UserData {
private final List<SessionData> sessions;
private int accessing;
private boolean clearAfterSave;
private UUID uuid;
private Set<InetAddress> ips;
private Set<String> nicknames;
@ -34,29 +34,25 @@ public class UserData {
private boolean isOp;
private boolean isBanned;
private String geolocation;
private int mobKills;
private List<KillData> playerKills;
private int deaths;
private String name;
private boolean isOnline;
private SessionData currentSession;
private final List<SessionData> sessions;
/**
* Creates a new UserData object with given values and default values.
*
* <p>
* Some variables are left uninitialized: isBanned, lastPlayed, playTime,
* loginTimes, timesKicked, lastGmSwapTime, mobKills, deaths and
* currentSession.
*
* <p>
* These variables need to be set with setters.
*
* <p>
* All Collections are left empty: locations, nicknames, ips, sessions,
* playerKills. Because nicknames is empty, lastNick is an empty string.
*
* <p>
* gmTimes HashMap will contain 4 '0L' values: SURVIVAL, CREATIVE,
* ADVENTURE, SPECTATOR
*
@ -90,15 +86,15 @@ public class UserData {
/**
* Creates a new UserData object with the variables inside a Player object.
*
* <p>
* Some variables are left uninitialized: lastPlayed, playTime, loginTimes,
* timesKicked, lastGmSwapTime, mobKills, deaths and currentSession.
*
* <p>
* These variables need to be set with setters.
*
* <p>
* All Collections are left empty: locations, nicknames, ips, sessions,
* playerKills. Because nicknames is empty, lastNick is an empty string.
*
* <p>
* gmTimes HashMap will contain 4 '0L' values: SURVIVAL, CREATIVE,
* ADVENTURE, SPECTATOR
*
@ -118,19 +114,19 @@ public class UserData {
/**
* Creates a new UserData object with the variables inside a OfflinePlayer
* object.
*
* <p>
* Some variables are left uninitialized: location, lastPlayed, playTime,
* loginTimes, timesKicked, lastGmSwapTime, mobKills, deaths and
* currentSession.
*
* <p>
* These variables need to be set with setters.
*
* <p>
* All Collections are left empty: locations, nicknames, ips, sessions,
* playerKills. Because nicknames is empty, lastNick is an empty string.
*
* <p>
* gmTimes HashMap will contain 4 '0L' values: SURVIVAL, CREATIVE,
* ADVENTURE, SPECTATOR
*
* <p>
* lastGM will be set as SURVIVAL
*
* @param player IOfflinePlayer object.
@ -215,9 +211,9 @@ public class UserData {
/**
* Adds a nickname to the nicknames Set.
*
* <p>
* null or empty values filtered.
*
* <p>
* lastNick will be set as the given parameter, if accepted.
*
* @param nick Displayname of the player.
@ -237,7 +233,7 @@ public class UserData {
/**
* Adds nicknames to the nicknames Set.
*
* <p>
* null or empty values filtered.
*
* @param addNicks Collection of nicknames.
@ -279,7 +275,7 @@ public class UserData {
/**
* Adds a new SessionData to the sessions list.
*
* <p>
* null and invalid sessions filtered.
*
* @param session SessionData object
@ -292,7 +288,7 @@ public class UserData {
/**
* Adds SessionData objects to the sessions list.
*
* <p>
* null and invalid sessions filtered.
*
* @param sessions Collection of SessionData objects.
@ -305,20 +301,9 @@ public class UserData {
this.sessions.addAll(filteredSessions);
}
/**
* Sets the current session.
*
* Currently unused.
*
* @param session SessionData object, no restrictions.
*/
public void setCurrentSession(SessionData session) {
currentSession = session;
}
/**
* Gets the current session.
*
* <p>
* Currently unused.
*
* @return SessionData object with a recent start.
@ -327,6 +312,17 @@ public class UserData {
return currentSession;
}
/**
* Sets the current session.
* <p>
* Currently unused.
*
* @param session SessionData object, no restrictions.
*/
public void setCurrentSession(SessionData session) {
currentSession = session;
}
/**
* Changes the value of isBanned.
*
@ -369,6 +365,15 @@ public class UserData {
return uuid;
}
/**
* Set the UUID.
*
* @param uuid UUID
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* Get the InetAddress Set.
*
@ -378,6 +383,17 @@ public class UserData {
return ips;
}
/**
* Set the ips set.
*
* @param ips ips of the user.
*/
public void setIps(Set<InetAddress> ips) {
if (Verify.notNull(ips)) {
this.ips = ips;
}
}
/**
* Get the nickname String Set.
*
@ -387,6 +403,17 @@ public class UserData {
return nicknames;
}
/**
* Set the nicknames set.
*
* @param nicknames nicknames of the user.
*/
public void setNicknames(Set<String> nicknames) {
if (Verify.notNull(nicknames)) {
this.nicknames = nicknames;
}
}
/**
* Get the Epoch millisecond the player registered.
*
@ -397,8 +424,17 @@ public class UserData {
}
/**
* Get the Epoch millisecond the player was last seen.
* Set the time the user was registered.
*
* @param registered Epoch millisecond of register time.
*/
public void setRegistered(long registered) {
this.registered = registered;
}
/**
* Get the Epoch millisecond the player was last seen.
* <p>
* NOT INITIALIZED BY CONSTRUCTORS. Value is updated periodically by cache
* if the player is online.
*
@ -409,8 +445,20 @@ public class UserData {
}
/**
* Get the playtime in milliseconds.
* Set the time the user was last seen.
* <p>
* Affects playtime calculation, playtime should be updated before updating
* this value.
*
* @param lastPlayed Epoch millisecond of last seen moment.
*/
public void setLastPlayed(long lastPlayed) {
this.lastPlayed = lastPlayed;
}
/**
* Get the playtime in milliseconds.
* <p>
* NOT INITIALIZED BY CONSTRUCTORS. Value is updated periodically by cache
* if the player is online.
*
@ -421,8 +469,17 @@ public class UserData {
}
/**
* Get how many times the player has logged in.
* Set the time the user has been playing.
*
* @param playTime Time in ms.
*/
public void setPlayTime(long playTime) {
this.playTime = playTime;
}
/**
* Get how many times the player has logged in.
* <p>
* NOT INITIALIZED BY CONSTRUCTORS.
*
* @return 0 to Integer.MAX
@ -432,8 +489,19 @@ public class UserData {
}
/**
* Get how many times the player has been kicked.
* Set how many times the user has logged in.
* <p>
* No check for input.
*
* @param loginTimes 0 to Int.MAX
*/
public void setLoginTimes(int loginTimes) {
this.loginTimes = loginTimes;
}
/**
* Get how many times the player has been kicked.
* <p>
* NOT INITIALIZED BY CONSTRUCTORS.
*
* @return 0 to Integer.MAX
@ -442,6 +510,17 @@ public class UserData {
return timesKicked;
}
/**
* Set how many times the user has been kicked.
* <p>
* No check for input.
*
* @param timesKicked 0 to Int.MAX
*/
public void setTimesKicked(int timesKicked) {
this.timesKicked = timesKicked;
}
/**
* Get the GMTimes Map.
*
@ -455,6 +534,18 @@ public class UserData {
return gmTimes;
}
/**
* Set the GM Times map containing playtime in each gamemode.
*
* @param gmTimes Map containing SURVIVAL, CREATIVE, ADVENTURE and SPECTATOR
* (After 1.8) keys.
*/
public void setGmTimes(Map<String, Long> gmTimes) {
if (Verify.notNull(gmTimes)) {
this.gmTimes = gmTimes;
}
}
/**
* Get the last time a Gamemode time was updated.
*
@ -465,8 +556,17 @@ public class UserData {
}
/**
* Get the last Gamemode that the user was seen in.
* Set the last time a Gamemode time was updated.
*
* @param lastGmSwapTime Epoch millisecond a gm time was updated.
*/
public void setLastGmSwapTime(long lastGmSwapTime) {
this.lastGmSwapTime = lastGmSwapTime;
}
/**
* Get the last Gamemode that the user was seen in.
* <p>
* When player changes to SURVIVAL this is set to SURVIVAL.
*
* @return Gamemode.
@ -475,6 +575,15 @@ public class UserData {
return lastGamemode;
}
/**
* Set the last gamemode the user was seen in.
*
* @param lastGamemode gamemode.
*/
public void setLastGamemode(String lastGamemode) {
this.lastGamemode = lastGamemode;
}
/**
* Is the user Operator?
*
@ -493,6 +602,15 @@ public class UserData {
return isBanned;
}
/**
* Set the banned value.
*
* @param isBanned true/false
*/
public void setBanned(boolean isBanned) {
this.isBanned = isBanned;
}
/**
* Get the username of the player.
*
@ -502,132 +620,6 @@ public class UserData {
return name;
}
/**
* Set the UUID.
*
* @param uuid UUID
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* Set the ips set.
*
* @param ips ips of the user.
*/
public void setIps(Set<InetAddress> ips) {
if (Verify.notNull(ips)) {
this.ips = ips;
}
}
/**
* Set the nicknames set.
*
* @param nicknames nicknames of the user.
*/
public void setNicknames(Set<String> nicknames) {
if (Verify.notNull(nicknames)) {
this.nicknames = nicknames;
}
}
/**
* Set the time the user was registered.
*
* @param registered Epoch millisecond of register time.
*/
public void setRegistered(long registered) {
this.registered = registered;
}
/**
* Set the time the user was last seen.
*
* Affects playtime calculation, playtime should be updated before updating
* this value.
*
* @param lastPlayed Epoch millisecond of last seen moment.
*/
public void setLastPlayed(long lastPlayed) {
this.lastPlayed = lastPlayed;
}
/**
* Set the time the user has been playing.
*
* @param playTime Time in ms.
*/
public void setPlayTime(long playTime) {
this.playTime = playTime;
}
/**
* Set how many times the user has logged in.
*
* No check for input.
*
* @param loginTimes 0 to Int.MAX
*/
public void setLoginTimes(int loginTimes) {
this.loginTimes = loginTimes;
}
/**
* Set how many times the user has been kicked.
*
* No check for input.
*
* @param timesKicked 0 to Int.MAX
*/
public void setTimesKicked(int timesKicked) {
this.timesKicked = timesKicked;
}
/**
* Set the GM Times map containing playtime in each gamemode.
*
* @param gmTimes Map containing SURVIVAL, CREATIVE, ADVENTURE and SPECTATOR
* (After 1.8) keys.
*/
public void setGmTimes(Map<String, Long> gmTimes) {
if (Verify.notNull(gmTimes)) {
this.gmTimes = gmTimes;
}
}
/**
* Set the last time a Gamemode time was updated.
*
* @param lastGmSwapTime Epoch millisecond a gm time was updated.
*/
public void setLastGmSwapTime(long lastGmSwapTime) {
this.lastGmSwapTime = lastGmSwapTime;
}
/**
* Set the last gamemode the user was seen in.
*
* @param lastGamemode gamemode.
*/
public void setLastGamemode(String lastGamemode) {
this.lastGamemode = lastGamemode;
}
/**
* Set whether or not player is op.
*
* @param isOp operator?
*/
public void setIsOp(boolean isOp) {
this.isOp = isOp;
}
public void setGeolocation(String geolocation) {
this.geolocation = geolocation;
}
/**
* Set the username of the user.
*
@ -637,6 +629,15 @@ public class UserData {
this.name = name;
}
/**
* Set whether or not player is op.
*
* @param isOp operator?
*/
public void setIsOp(boolean isOp) {
this.isOp = isOp;
}
/**
* Is the player online?
*
@ -646,6 +647,15 @@ public class UserData {
return isOnline;
}
/**
* Set the online value.
*
* @param isOnline true/false
*/
public void setOnline(boolean isOnline) {
this.isOnline = isOnline;
}
/**
* Get how many mob kills the player has.
*
@ -722,7 +732,7 @@ public class UserData {
/**
* Get the last nickname the user has set.
*
* <p>
* Set when using addNickname(String)
*
* @return last nickname used.
@ -733,7 +743,7 @@ public class UserData {
/**
* Set the last nickname the user has set.
*
* <p>
* Also set when using addNickname(String)
*
* @param lastNick last nickname used.
@ -797,25 +807,11 @@ public class UserData {
this.clearAfterSave = clearAfterSave;
}
/**
* Set the banned value.
*
* @param isBanned true/false
*/
public void setBanned(boolean isBanned) {
this.isBanned = isBanned;
}
/**
* Set the online value.
*
* @param isOnline true/false
*/
public void setOnline(boolean isOnline) {
this.isOnline = isOnline;
}
public String getGeolocation() {
return geolocation;
}
public void setGeolocation(String geolocation) {
this.geolocation = geolocation;
}
}

View File

@ -3,10 +3,10 @@ package main.java.com.djrapitops.plan.data.additional;
/**
* This class contains Enum values for different types of Analysis that can be
* performed on values of PluginData.
*
* <p>
* The enum determines what should be done to the return value of
* PluginData.getValue() method when the analysis is run.
*
* <p>
* Refer to the documentation on GitHub for additional information.
*
* @author Rsl1122
@ -17,56 +17,56 @@ public enum AnalysisType {
/**
* Used when the getValue() method returns an integer and average should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
INT_AVG("avgInt_", "Average "),
/**
* Used when the getValue() method returns a long and average should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
LONG_AVG("avgLong_", "Average "),
/**
* Used when the getValue() method returns double and average should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
DOUBLE_AVG("avgDouble_", "Average "),
/**
* Used when the getValue() method returns an integer and total should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
INT_TOTAL("totalInt_", "Total "),
/**
* Used when the getValue() method returns a long and total should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
LONG_TOTAL("totalLong_", "Total "),
/**
* Used when the getValue() method returns a double and total should be
* calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
DOUBLE_TOTAL("totalDouble_", "Total "),
/**
* Used when the getValue() method returns an amount of milliseconds as long
* and average should be calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
LONG_TIME_MS_AVG("avgTimeMs_", "Average "),
/**
* Used when the getValue() method returns an amount of milliseconds as long
* and total should be calculated.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
LONG_TIME_MS_TOTAL("totalTimeMs_"),
@ -74,11 +74,11 @@ public enum AnalysisType {
* Used when the getValue() method returns an Epoch Millisecond as long and
* average of differences between the millisecond and current millisecond
* should be calculated.
*
* <p>
* For example if a player has dropped a Foo on epoch ms 1494486504000 and
* that was 5s (5000ms) ago. Now you want to calculate the average
* time-since for all players. Then you use this one.
*
* <p>
* -1 values will be disregarded from the calculation (size will not grow).
*/
LONG_EPOCH_MS_MINUS_NOW_AVG("avgEpochMsMinusNow_", "Average "),
@ -89,13 +89,13 @@ public enum AnalysisType {
/**
* Used to calculate number of true values for the returned boolean values
* of getValue().
*
* <p>
* Will be presented as "n / total".
*/
BOOLEAN_TOTAL("totalBool_"),
/**
* Used to add html tags to the plugins tab.
*
* <p>
* Can be used to add Tables, Images (for example maps) and other html
* elements.
*/
@ -121,7 +121,7 @@ public enum AnalysisType {
/**
* Used to get the modifier for the Prefix of the value.
*
* <p>
* For example: "Average Votes" when INT_AVG is used and Prefix is set as
* "Votes".
*

View File

@ -38,10 +38,10 @@ public class HookHandler {
/**
* Adds a new PluginData source to the list.
*
* <p>
* The plugin data will appear on Analysis and/or Inspect pages depending on
* how the extending object is set up.
*
* <p>
* Refer to documentation on GitHub for more information.
*
* @param dataSource an object extending the PluginData class.

View File

@ -8,7 +8,7 @@ import java.util.*;
/**
* This is an abstract class that can be used to add data from a plugin to the
* "Plugins"-tab of Analysis and Inspect pages.
*
* <p>
* API-section of documentation has examples on the usage of this class and how
* to register objects extending this class.
*
@ -17,65 +17,59 @@ import java.util.*;
*/
public abstract class PluginData {
/**
* A list containing the AnalysisType enums that determine what should be
* done with the data on the analysis page.
*/
protected final List<AnalysisType> analysisTypes;
/**
* Placeholder string, for example "stepsTaken". This will be used when
* building the structure of the Plugins tab.
*
* <p>
* The complete placeholder also includes the plugin name and if analysis is
* run, a modifier.
*
* <p>
* Second parameter of any super constructor.
*/
protected String placeholder;
/**
* Name of the plugin the data is coming from.
*
* <p>
* All sources of data with the same sourcePlugin will be placed in the same
* "box" in the "Plugins" tab.
*
* <p>
* A box has a max height of 600px, and higher than that will add a
* scrollbar.
*
* <p>
* First parameter of any super constructor.
*/
protected String sourcePlugin;
/**
* Determines if the datapoint should only be used for the analysis page.
*
* <p>
* If set to false, the datapoint will be added to the inspect page as well.
*/
protected boolean analysisOnly;
/**
* Font Awesome icon name.
*
* <p>
* http://fontawesome.io/icons/
*/
protected String icon;
/**
* Prefix shown before the data, for example "Steps taken: ".
*/
protected String prefix;
/**
* Suffix shown after the data, for example " steps".
*/
protected String suffix;
/**
* A list containing the AnalysisType enums that determine what should be
* done with the data on the analysis page.
*/
protected final List<AnalysisType> analysisTypes;
/**
* Main constructor.
*
* <p>
* Defaults analysisOnly to true.
*
* <p>
* Defaults icon, prefix and suffix to "".
*
* @param sourcePlugin Name of the plugin the data is coming from
@ -107,7 +101,7 @@ public abstract class PluginData {
/**
* Constructor for Inspect-page only data point.
*
* <p>
* analysisOnly will be set to false.
*
* @param sourcePlugin Name of the plugin the data is coming from
@ -120,7 +114,7 @@ public abstract class PluginData {
/**
* Returns the list of AnalysisTypes.
*
* <p>
* Used by Analysis
*
* @return a list.
@ -132,7 +126,7 @@ public abstract class PluginData {
/**
* This method should be used with the return values of
* getHtmlReplaceValue(String, UUID).
*
* <p>
* It will add the div, icon, modifier, prefix and suffix to the value.
* Modifier is for example, if calculating AnalysisType.INT_AVG "Average ",
* it is a text that helps user understand that a calculation has been made.
@ -150,7 +144,7 @@ public abstract class PluginData {
/**
* Used to get the full placeholder.
*
* <p>
* Used to avoid conflicts with existing placeholders and placeholders of
* other plugins.
*
@ -174,13 +168,13 @@ public abstract class PluginData {
/**
* Used to get the string for the html page.
*
* <p>
* parseContainer(modifierPrefix, value); should be used for all return
* values so that div, icon, prefix and suffix are added.
*
* <p>
* This method is used when AnalysisType.HTML is set, or while getting the
* value for the inspect page.
*
* <p>
* When using AnalysisType.HTML a random UUID is given, so it should be
* disregarded. modifierPrefix is empty in that case.
*
@ -196,10 +190,10 @@ public abstract class PluginData {
* Used to get the value for analysis. The return value is determined by
* AnalysisType you have specified. If the AnalysisType's name has a BOOLEAN
* in it, Analysis will expect boolean values etc.
*
* <p>
* If the Type and return value mismatch, exception is thrown and the result
* on the analysis page will say that error occurred as the value.
*
* <p>
* If a player has no value a -1 should be returned in the case of a Number.
* -1 is excluded from the Average calculation's size and total.
*
@ -209,24 +203,6 @@ public abstract class PluginData {
*/
public abstract Serializable getValue(UUID uuid);
/**
* Used to set the prefix.
*
* @param prefix for example "Steps Taken: " or a Html start tag.
*/
public final void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* Used to set the suffix.
*
* @param suffix for example " steps" or a html end tag.
*/
public final void setSuffix(String suffix) {
this.suffix = suffix;
}
/**
* Used to set the Font Awesome icon.
*
@ -238,7 +214,7 @@ public abstract class PluginData {
/**
* Used to set the analysisOnly parameter.
*
* <p>
* true: only used for Analysis page false: used for both if AnalysisTypes
* specified, if no AnalysisTypes are specified only used for Inspect page.
*
@ -266,6 +242,15 @@ public abstract class PluginData {
return prefix;
}
/**
* Used to set the prefix.
*
* @param prefix for example "Steps Taken: " or a Html start tag.
*/
public final void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* Used to get the suffix.
*
@ -275,6 +260,15 @@ public abstract class PluginData {
return suffix;
}
/**
* Used to set the suffix.
*
* @param suffix for example " steps" or a html end tag.
*/
public final void setSuffix(String suffix) {
this.suffix = suffix;
}
/**
* If a PluginData object has same placeholder, sourcePlugin and
* analysisTypes, it is considered equal.

View File

@ -2,13 +2,6 @@ package main.java.com.djrapitops.plan.data.analysis;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.utilities.Verify;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.SessionData;
import main.java.com.djrapitops.plan.data.TPS;
@ -22,14 +15,17 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* Part responsible for all Player Activity related analysis.
*
* <p>
* Online Graphs, Player-base pie-chart, Recent Players and Session
* visualisation.
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: recentlogins, sessionaverage,
* datapunchcard, datasessiondistribution, labelssessiondistribution,
* datascatterday, datascatterweek, datascattermonth, playersonlinecolor,
@ -44,14 +40,12 @@ public class ActivityPart extends RawData<ActivityPart> {
private final JoinInfoPart joins;
private final TPSPart tpsPart;
private List<String> recentPlayers;
private List<UUID> recentPlayersUUIDs;
private final Set<UUID> bans;
private final Set<UUID> active;
private final Set<UUID> inactive;
private final Set<UUID> joinedOnce;
private List<String> recentPlayers;
private List<UUID> recentPlayersUUIDs;
public ActivityPart(JoinInfoPart joins, TPSPart tps) {
this.joins = joins;
@ -149,14 +143,6 @@ public class ActivityPart extends RawData<ActivityPart> {
joinedOnce.add(uuid);
}
public void setRecentPlayers(List<String> recentPlayers) {
this.recentPlayers = recentPlayers;
}
public void setRecentPlayersUUIDs(List<UUID> recentPlayersUUIDs) {
this.recentPlayersUUIDs = recentPlayersUUIDs;
}
public Map<Long, Integer> getPlayersOnline() {
return tpsPart.getTpsData().stream().collect(Collectors.toMap(TPS::getDate, TPS::getPlayers));
}
@ -165,10 +151,18 @@ public class ActivityPart extends RawData<ActivityPart> {
return recentPlayers;
}
public void setRecentPlayers(List<String> recentPlayers) {
this.recentPlayers = recentPlayers;
}
public List<UUID> getRecentPlayersUUIDs() {
return recentPlayersUUIDs;
}
public void setRecentPlayersUUIDs(List<UUID> recentPlayersUUIDs) {
this.recentPlayersUUIDs = recentPlayersUUIDs;
}
public Set<UUID> getBans() {
return bans;
}

View File

@ -5,17 +5,18 @@
*/
package main.java.com.djrapitops.plan.data.analysis;
import java.util.Map;
import main.java.com.djrapitops.plan.ui.html.tables.CommandUseTableCreator;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import java.util.Map;
/**
* Part responsible for all CommandUsage related analysis.
*
* <p>
* Command Usage Table.
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: uniquecommands, totalcommands, commanduse
*
* @author Rsl1122

View File

@ -9,11 +9,11 @@ import java.util.Arrays;
/**
* Part responsible for all Gamemode usage related analysis.
*
* <p>
* Gamemode Piechart, Percentages and Totals.
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: gmtotal, gm0col-gm3col, gmcolors, gmlabels,
* gm0-gm3, gmdata, gm0total-gm3total
*

View File

@ -5,11 +5,11 @@ import java.util.Map;
/**
* Part responsible for all Geolocation related analysis.
*
* <p>
* Player location World Chloropleth map.
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: geomapz, geomapcountries, geomapcodes
*
* @author Rsl1122

View File

@ -11,11 +11,11 @@ import java.util.stream.Collectors;
/**
* Part responsible for all Player login related analysis.
*
* <p>
* Unique per Day, Unique, New Players, Logins
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: totallogins, uniquejoinsday,
* uniquejoinsweek, uniquejoinsmonth, avguniquejoins, avguniquejoinsday,
* avguniquejoinsweek, avguniquejoinsmonth, npday, npweek, npmonth

View File

@ -11,11 +11,11 @@ import java.util.UUID;
/**
* Part responsible for all Death related analysis.
*
* <p>
* Totals
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: deaths, mobkills, playerkilss
*
* @author Rsl1122

View File

@ -1,6 +1,7 @@
package main.java.com.djrapitops.plan.data.analysis;
import com.djrapitops.plugin.utilities.Verify;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@ -8,11 +9,11 @@ import java.util.UUID;
/**
* Part responsible for counting players.
*
* <p>
* Total player count, op count
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: activitytotal, ops
*
* @author Rsl1122

View File

@ -5,9 +5,9 @@ import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
/**
* Part responsible for all Playtime related analysis.
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: totalplaytime, avgplaytime
*
* @author Rsl1122
@ -15,8 +15,8 @@ import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
*/
public class PlaytimePart extends RawData<PlaytimePart> {
private long totalPlaytime;
private final PlayerCountPart playerCount;
private long totalPlaytime;
public PlaytimePart(PlayerCountPart part) {
playerCount = part;

View File

@ -1,6 +1,7 @@
package main.java.com.djrapitops.plan.data.analysis;
import com.djrapitops.plugin.utilities.Verify;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@ -8,8 +9,8 @@ import java.util.Map;
/**
* Extending objects should represent, add together and analyse data.
*
* @author Rsl1122
* @param <T> The extending class, return value for get method.
* @author Rsl1122
* @since 3.5.2
*/
public abstract class RawData<T extends RawData> {
@ -40,7 +41,7 @@ public abstract class RawData<T extends RawData> {
/**
* Analyses the data added together.
*
* <p>
* Places place-holders to the replace map.
*/
public void analyseData() {
@ -50,7 +51,7 @@ public abstract class RawData<T extends RawData> {
/**
* Subclasses should analyse the data added together.
*
* <p>
* Place-holders should be added to the replace map.
*/
protected abstract void analyse();

View File

@ -12,11 +12,11 @@ import java.util.List;
/**
* Part responsible for all TPS related analysis.
*
* <p>
* Ticks Per Second Graphs
*
* <p>
* Placeholder values can be retrieved using the get method.
*
* <p>
* Contains following place-holders: tpsscatterday, tpsscatterweek, cpuscatterday, cpuscatterweek, averagetps,
* averagetpsday
*

View File

@ -13,13 +13,13 @@ import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
*/
public class AnalysisCacheHandler {
private AnalysisData cache;
private final Analysis analysis;
private AnalysisData cache;
private boolean analysisEnabled;
/**
* Class Constructor.
*
* <p>
* Initializes Analysis
*
* @param plugin Current instance of Plan
@ -64,7 +64,6 @@ public class AnalysisCacheHandler {
}
/**
*
* @return
*/
public boolean isAnalysisBeingRun() {

View File

@ -5,7 +5,7 @@ import main.java.com.djrapitops.plan.data.UserData;
/**
* This abstract class can be extended with anything as the process method and
* given to the Database.
*
* <p>
* The process method will be called with the UserData object fetched from the
* database.
*

View File

@ -27,13 +27,13 @@ import java.util.*;
/**
* This Class contains the Cache.
*
* <p>
* This class is the main processing class that initialises Save, Clear, Process
* and Get queue and Starts the asynchronous save task.
*
* <p>
* It is used to store command use, locations, active sessions and UserData
* objects in memory.
*
* <p>
* Its methods can be used to access all the data it stores and to clear them.
*
* @author Rsl1122
@ -43,13 +43,11 @@ public class DataCacheHandler extends SessionCache {
// Cache
private final HashMap<UUID, UserData> dataCache;
private Map<String, Integer> commandUse;
private List<List<TPS>> unsavedTPSHistory;
// Plan
private final Plan plugin;
private final Database db;
private Map<String, Integer> commandUse;
private List<List<TPS>> unsavedTPSHistory;
// Queues
private DataCacheSaveQueue saveTask;
private DataCacheClearQueue clearTask;
@ -61,7 +59,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Class Constructor.
*
* <p>
* Gets the Database from the plugin. Starts the queues. Registers
* Asynchronous Periodic Save Task
*
@ -160,7 +158,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Uses Database or Cache to retrieve the UserData of a matching player.
*
* <p>
* Caches the data to the Cache if cache-parameter is true.
*
* @param processor DBCallableProcessor Object used to process the data
@ -191,7 +189,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Used to Cache a UserData object to the Cache.
*
* <p>
* If a object already exists it will be replaced.
*
* @param data UserData object with the UUID inside used as key.
@ -204,7 +202,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Uses Database or Cache to retrieve the UserData of a matching player.
*
* <p>
* Always Caches the data after retrieval (unless already cached)
*
* @param processor DBCallableProcessor Object used to process the data
@ -217,9 +215,9 @@ public class DataCacheHandler extends SessionCache {
/**
* Saves all UserData in the cache to Database.
*
* <p>
* ATTENTION: TODO - Doesn't save the Locations in the locationCache.
*
* <p>
* Should only be called from Async thread
*/
public void saveCachedUserData() {
@ -234,7 +232,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Used to add event HandlingInfo to the processTask's pool.
*
* <p>
* Given HandlingInfo object's process method will be called.
*
* @param i Object that extends HandlingInfo.
@ -249,9 +247,9 @@ public class DataCacheHandler extends SessionCache {
/**
* Saves all data in the cache to Database and closes the database down.
*
* <p>
* Stops all tasks.
*
* <p>
* If processTask has unprocessed information, it will be processed.
*/
public void saveCacheOnDisable() {
@ -334,7 +332,7 @@ public class DataCacheHandler extends SessionCache {
/**
* Saves the cached CommandUse.
*
* <p>
* Should be only called from an Asynchronous Thread.
*/
public void saveCommandUse() {
@ -491,7 +489,7 @@ public class DataCacheHandler extends SessionCache {
/**
* If /reload is run this treats every online player as a new login.
*
* <p>
* Calls all the methods that are ran when PlayerJoinEvent is fired
*/
public void handleReload() {
@ -525,7 +523,6 @@ public class DataCacheHandler extends SessionCache {
}
/**
*
* @return
*/
public DataCacheSaveQueue getSaveTask() {
@ -533,7 +530,6 @@ public class DataCacheHandler extends SessionCache {
}
/**
*
* @return
*/
public DataCacheClearQueue getClearTask() {
@ -541,7 +537,6 @@ public class DataCacheHandler extends SessionCache {
}
/**
*
* @return
*/
public DataCacheProcessQueue getProcessTask() {
@ -549,7 +544,6 @@ public class DataCacheHandler extends SessionCache {
}
/**
*
* @return
*/
public DataCacheGetQueue getGetTask() {

View File

@ -36,7 +36,7 @@ public class InspectCacheHandler {
/**
* Caches the UserData object to InspectCache.
*
* <p>
* If the Userdata is cached in DataCache it will be used. Otherwise the Get
* Queue will handle the DBCallableProcessor.
*

View File

@ -1,13 +1,14 @@
package main.java.com.djrapitops.plan.data.cache;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.data.SessionData;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* This class is used to store active sessions of players in memory.
*
@ -78,7 +79,7 @@ public class SessionCache {
/**
* Used to get the Map of active sessions.
*
* <p>
* Used for testing.
*
* @return key:value UUID:SessionData

View File

@ -1,18 +1,19 @@
package main.java.com.djrapitops.plan.data.cache.queue;
import com.djrapitops.plugin.task.AbsRunnable;
import java.util.concurrent.BlockingQueue;
/**
* Abstract class representing a queue consumer.
*
* @author Rsl1122
* @param <T>
* @author Rsl1122
*/
public abstract class Consumer<T> extends AbsRunnable {
boolean run;
final BlockingQueue<T> queue;
boolean run;
/**
* Constructor, defines queue.

View File

@ -7,8 +7,8 @@ import java.util.concurrent.BlockingQueue;
/**
* Abstract implementation of a Queue.
*
* @author Rsl1122
* @param <T> Object this queue consumes
* @author Rsl1122
*/
public abstract class Queue<T> {

View File

@ -5,8 +5,8 @@ import main.java.com.djrapitops.plan.Plan;
/**
* Abstract representation of a queue setup.
*
* @author Rsl1122
* @param <T> Object this queue consumes.
* @author Rsl1122
*/
public abstract class Setup<T> {

View File

@ -1,7 +1,5 @@
package main.java.com.djrapitops.plan.data.handling;
import java.sql.SQLException;
import java.util.UUID;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.KillData;
@ -9,6 +7,9 @@ import main.java.com.djrapitops.plan.data.UserData;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.sql.SQLException;
import java.util.UUID;
/**
* Class containing static methods for processing information contained in a
* DeathEvent when the killer is a player.

View File

@ -36,7 +36,7 @@ public class LoginHandling {
/**
* Updates the geolocation of the player.
*
* <p>
* Uses free service of freegeoip.net. 15000 requests can be sent per hour.
*
* @param ip InetAddress used for location.

View File

@ -1,9 +1,11 @@
package main.java.com.djrapitops.plan.data.handling.importing;
import com.djrapitops.pluginbridge.plan.importing.OnTimeImporter;
import main.java.com.djrapitops.plan.Log;
import java.util.HashMap;
import java.util.Map;
import main.java.com.djrapitops.plan.Log;
import static org.bukkit.Bukkit.getPluginManager;
/**

View File

@ -2,15 +2,6 @@ package main.java.com.djrapitops.plan.data.handling.importing;
import com.djrapitops.plugin.utilities.player.Fetch;
import com.djrapitops.plugin.utilities.player.IOfflinePlayer;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData;
@ -21,6 +12,11 @@ import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
import java.sql.SQLException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* Abstract class used for importing data from other plugins.
*
@ -52,7 +48,7 @@ public abstract class Importer {
/**
* Method used for the import.
*
* <p>
* Creates UserData for players that have not been saved to the database.
*
* @param uuids UUIDs to be imported

View File

@ -1,8 +1,9 @@
package main.java.com.djrapitops.plan.data.handling.importing;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
import java.util.UUID;
/**
* Imports all players who have not joined since Plan was installed.
*

View File

@ -1,8 +1,9 @@
package main.java.com.djrapitops.plan.data.handling.info;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.UUID;
/**
* HandlingInfo Class for DeathEvent information.
*

View File

@ -1,10 +1,11 @@
package main.java.com.djrapitops.plan.data.handling.info;
import com.djrapitops.plugin.utilities.player.Gamemode;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.handling.GamemodeHandling;
import java.util.UUID;
/**
* HandlingInfo Class for GamemodeChangeEvent information.
*

View File

@ -60,7 +60,7 @@ public abstract class HandlingInfo {
/**
* Process the info and modify the UserData object accordingly.
*
* <p>
* If the UUIDs don't match no change should occur.
*
* @param uData UserData object to modify.

View File

@ -2,9 +2,9 @@ package main.java.com.djrapitops.plan.data.handling.info;
/**
* Enum class for the types of HandlingInfo to be processed.
*
* <p>
* Type is only used for debugging.
*
* <p>
* OTHER should be used when
*
* @author Rsl1122

View File

@ -1,8 +1,9 @@
package main.java.com.djrapitops.plan.data.handling.info;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.UserData;
import java.util.UUID;
/**
* HandlingInfo Class for KickEvent information.
*

View File

@ -34,7 +34,7 @@ public class PlanPlayerListener implements Listener {
/**
* Class Constructor.
*
* <p>
* Copies the references to multiple handlers from Current instance of
* handler.
*
@ -47,7 +47,7 @@ public class PlanPlayerListener implements Listener {
/**
* PlayerJoinEvent Listener.
*
* <p>
* If player is a new player, creates a new data in the database for the
* player. Retrieves the UserData, updates and then saves it to the Cache.
*
@ -80,7 +80,7 @@ public class PlanPlayerListener implements Listener {
/**
* PlayerQuitEvent Listener.
*
* <p>
* Retrieves the current UserData for the Player, updates it, saves the data
* to Database and clears it from cache.
*
@ -99,7 +99,7 @@ public class PlanPlayerListener implements Listener {
/**
* PlayerKickEvent Listener.
*
* <p>
* Updates current playerdata and saves it to the Database.
*
* @param event Fired event

View File

@ -21,10 +21,10 @@ import java.util.List;
*/
public class TPSCountTimer extends AbsRunnable {
private long lastCheckNano;
private final Plan plugin;
private final DataCacheHandler handler;
private final List<TPS> history;
private long lastCheckNano;
public TPSCountTimer(Plan plugin) {
super("TPSCountTimer");

View File

@ -3,9 +3,9 @@ package main.java.com.djrapitops.plan.database;
/**
* Class to contain objects in the batches.
*
* @param <T> Object stored.
* @author Rsl1122
* @since 3.4.3
* @param <T> Object stored.
*/
public class Container<T> {

View File

@ -50,7 +50,6 @@ public class DBUtils {
}
/**
*
* @param <T>
* @param objects
* @return

View File

@ -10,7 +10,7 @@ import java.util.*;
/**
* Abstract class representing a Database.
*
* <p>
* All methods should be only called from an asynchronous thread, unless stated
* otherwise.
*
@ -91,7 +91,7 @@ public abstract class Database {
/**
* Initiates the database.
*
* <p>
* Default method returns false.
*
* @return Was the initiation successful?
@ -103,7 +103,7 @@ public abstract class Database {
/**
* Used to give Database processors to call with UserData after they have
* been fetched from the database.
*
* <p>
* This method is a shortcut method for multiple parameters.
*
* @param uuid UUID of the player.
@ -128,7 +128,7 @@ public abstract class Database {
/**
* Used to get all UserData for multiple UUIDs.
*
* <p>
* Should only be called from async thread.
*
* @param uuids UUIDs to fetch data for.
@ -168,7 +168,7 @@ public abstract class Database {
/**
* Used to get the name of the database type.
*
* <p>
* Thread safe.
*
* @return SQLite/MySQL
@ -177,7 +177,7 @@ public abstract class Database {
/**
* Used to get the config name of the database type.
*
* <p>
* Thread safe.
*
* @return sqlite/mysql
@ -222,7 +222,7 @@ public abstract class Database {
/**
* Used to clear all data from the database.
*
* <p>
* Uses DELETE * FROM table.
*
* @return Success of removal.

View File

@ -1,15 +1,15 @@
package main.java.com.djrapitops.plan.database.databases;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan;
import org.bukkit.configuration.file.FileConfiguration;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Rsl1122
*/
public class MySQLDB extends SQLDB {
@ -45,7 +45,6 @@ public class MySQLDB extends SQLDB {
}
/**
*
* @return
*/
@Override

View File

@ -20,7 +20,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public abstract class SQLDB extends Database {
@ -30,7 +29,6 @@ public abstract class SQLDB extends Database {
private Connection connection;
/**
*
* @param plugin
* @param supportsModification
*/
@ -75,7 +73,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
@Override
@ -99,7 +96,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return @throws SQLException
*/
public boolean checkConnection() throws SQLException {
@ -178,7 +174,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
public Table[] getAllTables() {
@ -186,7 +181,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
public Table[] getAllTablesInRemoveOrder() {
@ -194,13 +188,11 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
public abstract Connection getNewConnection();
/**
*
* @throws SQLException
*/
@Override
@ -212,7 +204,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return @throws SQLException
*/
@Override
@ -221,7 +212,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param version
* @throws SQLException
*/
@ -231,7 +221,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param uuid
* @return
*/
@ -252,7 +241,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param uuid
* @return
* @throws SQLException
@ -281,7 +269,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param uuid
* @param processors
* @throws SQLException
@ -325,7 +312,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param uuidsCol
* @return
* @throws SQLException
@ -374,7 +360,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param data
* @throws SQLException
*/
@ -430,7 +415,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @param data
* @throws SQLException
*/
@ -476,7 +460,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
@Override
@ -492,7 +475,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
public boolean supportsModification() {
@ -500,7 +482,6 @@ public abstract class SQLDB extends Database {
}
/**
*
* @return
*/
public Connection getConnection() {

View File

@ -1,13 +1,13 @@
package main.java.com.djrapitops.plan.database.databases;
import main.java.com.djrapitops.plan.Plan;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import main.java.com.djrapitops.plan.Plan;
/**
*
* @author Rsl1122
*/
public class SQLiteDB extends SQLDB {
@ -24,7 +24,6 @@ public class SQLiteDB extends SQLDB {
}
/**
*
* @param plugin
* @param dbName
*/
@ -44,7 +43,6 @@ public class SQLiteDB extends SQLDB {
}
/**
*
* @param dbName
* @return
*/
@ -59,7 +57,6 @@ public class SQLiteDB extends SQLDB {
}
/**
*
* @return
*/
@Override

View File

@ -1,16 +1,16 @@
package main.java.com.djrapitops.plan.database.tables;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
/**
*
* @author Rsl1122
*/
public class CommandUseTable extends Table {
@ -19,7 +19,6 @@ public class CommandUseTable extends Table {
private final String columnTimesUsed;
/**
*
* @param db
* @param usingMySQL
*/
@ -30,7 +29,6 @@ public class CommandUseTable extends Table {
}
/**
*
* @return
*/
@Override
@ -49,7 +47,6 @@ public class CommandUseTable extends Table {
}
/**
*
* @return @throws SQLException
*/
public Map<String, Integer> getCommandUse() throws SQLException {
@ -78,7 +75,6 @@ public class CommandUseTable extends Table {
}
/**
*
* @param data
* @throws SQLException
* @throws NullPointerException

View File

@ -10,7 +10,6 @@ import java.sql.SQLException;
import java.util.*;
/**
*
* @author Rsl1122
*/
public class GMTimesTable extends Table {
@ -22,7 +21,6 @@ public class GMTimesTable extends Table {
private final String columnSpectatorTime;
/**
*
* @param db
* @param usingMySQL
*/
@ -40,7 +38,6 @@ public class GMTimesTable extends Table {
}
/**
*
* @return
*/
@Override
@ -64,7 +61,6 @@ public class GMTimesTable extends Table {
}
/**
*
* @param userId
* @return
*/
@ -84,7 +80,6 @@ public class GMTimesTable extends Table {
}
/**
*
* @param userId
* @return
* @throws SQLException
@ -137,7 +132,6 @@ public class GMTimesTable extends Table {
}
/**
*
* @param userId
* @param gamemodeTimes
* @throws SQLException

View File

@ -1,23 +1,17 @@
package main.java.com.djrapitops.plan.database.tables;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.util.*;
/**
*
* @author Rsl1122
*/
public class IPsTable extends Table {
@ -26,7 +20,6 @@ public class IPsTable extends Table {
private final String columnIP;
/**
*
* @param db
* @param usingMySQL
*/
@ -37,7 +30,6 @@ public class IPsTable extends Table {
}
/**
*
* @return
*/
@Override
@ -58,7 +50,6 @@ public class IPsTable extends Table {
}
/**
*
* @param userId
* @return
*/
@ -78,7 +69,6 @@ public class IPsTable extends Table {
}
/**
*
* @param userId
* @return
* @throws SQLException
@ -107,7 +97,6 @@ public class IPsTable extends Table {
}
/**
*
* @param userId
* @param ips
* @throws SQLException
@ -147,7 +136,6 @@ public class IPsTable extends Table {
}
/**
*
* @param ids
* @return
* @throws SQLException
@ -185,7 +173,6 @@ public class IPsTable extends Table {
}
/**
*
* @param ips
* @throws SQLException
*/

View File

@ -1,22 +1,17 @@
package main.java.com.djrapitops.plan.database.tables;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.data.KillData;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class KillsTable extends Table {
@ -27,7 +22,6 @@ public class KillsTable extends Table {
private final String columnDate;
/**
*
* @param db
* @param usingMySQL
*/
@ -40,7 +34,6 @@ public class KillsTable extends Table {
}
/**
*
* @return
*/
@Override
@ -64,7 +57,6 @@ public class KillsTable extends Table {
}
/**
*
* @param userId
* @return
*/
@ -85,7 +77,6 @@ public class KillsTable extends Table {
}
/**
*
* @param userId
* @return
* @throws SQLException
@ -114,7 +105,6 @@ public class KillsTable extends Table {
}
/**
*
* @param userId
* @param kills
* @throws SQLException
@ -165,7 +155,6 @@ public class KillsTable extends Table {
}
/**
*
* @param ids
* @param uuids
* @return
@ -203,7 +192,6 @@ public class KillsTable extends Table {
}
/**
*
* @param kills
* @param uuids
* @throws SQLException

View File

@ -1,12 +1,12 @@
package main.java.com.djrapitops.plan.database.tables;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
*
* @author Rsl1122
*/
@Deprecated
@ -18,18 +18,7 @@ public class LocationsTable extends Table {
private final String columnCoordinatesZ;
private final String columnWorld;
@Override
@Deprecated
public boolean removeAllData() {
try {
execute("DELETE FROM " + tableName);
} catch (Exception e) {
}
return true;
}
/**
*
* @param db
* @param usingMySQL
*/
@ -43,8 +32,17 @@ public class LocationsTable extends Table {
columnWorld = "world_name";
}
@Override
@Deprecated
public boolean removeAllData() {
try {
execute("DELETE FROM " + tableName);
} catch (Exception e) {
}
return true;
}
/**
*
* @return
*/
@Override
@ -70,7 +68,6 @@ public class LocationsTable extends Table {
}
/**
*
* @param userId
* @return
*/

View File

@ -1,20 +1,15 @@
package main.java.com.djrapitops.plan.database.tables;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
/**
*
* @author Rsl1122
*/
public class NicknamesTable extends Table {
@ -24,7 +19,6 @@ public class NicknamesTable extends Table {
private final String columnCurrent;
/**
*
* @param db
* @param usingMySQL
*/
@ -36,7 +30,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @return
*/
@Override
@ -75,7 +68,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @param userId
* @return
*/
@ -95,7 +87,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @param userId
* @return
* @throws SQLException
@ -133,7 +124,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @param userId
* @param names
* @param lastNick
@ -177,7 +167,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @param ids
* @return
* @throws SQLException
@ -228,7 +217,6 @@ public class NicknamesTable extends Table {
}
/**
*
* @param nicknames
* @param lastNicks
* @throws SQLException

View File

@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List;
/**
*
* @author Rsl1122
*/
public class SecurityTable extends Table {

View File

@ -14,7 +14,6 @@ import java.sql.SQLException;
import java.util.*;
/**
*
* @author Rsl1122
*/
public class SessionsTable extends Table {
@ -24,7 +23,6 @@ public class SessionsTable extends Table {
private final String columnSessionEnd;
/**
*
* @param db
* @param usingMySQL
*/
@ -36,7 +34,6 @@ public class SessionsTable extends Table {
}
/**
*
* @return
*/
@Override
@ -58,7 +55,6 @@ public class SessionsTable extends Table {
}
/**
*
* @param userId
* @return
* @throws SQLException
@ -86,7 +82,6 @@ public class SessionsTable extends Table {
}
/**
*
* @param userId
* @return
*/
@ -106,7 +101,6 @@ public class SessionsTable extends Table {
}
/**
*
* @param userId
* @param sessions
* @throws SQLException
@ -152,7 +146,6 @@ public class SessionsTable extends Table {
}
/**
*
* @param ids
* @return
* @throws SQLException
@ -190,7 +183,6 @@ public class SessionsTable extends Table {
}
/**
*
* @param sessions
* @throws SQLException
*/
@ -255,7 +247,6 @@ public class SessionsTable extends Table {
}
/**
*
* @throws SQLException
*/
public void clean() throws SQLException {

View File

@ -13,7 +13,6 @@ import java.util.List;
import java.util.Map;
/**
*
* @author Rsl1122
*/
public abstract class Table {
@ -34,7 +33,6 @@ public abstract class Table {
protected final boolean usingMySQL;
/**
*
* @param name
* @param db
* @param usingMySQL
@ -46,13 +44,11 @@ public abstract class Table {
}
/**
*
* @return
*/
public abstract boolean createTable();
/**
*
* @return @throws SQLException
*/
protected Connection getConnection() throws SQLException {
@ -64,7 +60,6 @@ public abstract class Table {
}
/**
*
* @return @throws SQLException
*/
public int getVersion() throws SQLException {
@ -72,7 +67,6 @@ public abstract class Table {
}
/**
*
* @param sql
* @return
* @throws SQLException
@ -83,7 +77,6 @@ public abstract class Table {
}
/**
*
* @param sql
* @return
* @throws SQLException
@ -93,7 +86,6 @@ public abstract class Table {
}
/**
*
* @param toClose
*/
protected void close(AutoCloseable... toClose) {
@ -101,7 +93,6 @@ public abstract class Table {
}
/**
*
* @return
*/
public String getTableName() {
@ -109,7 +100,6 @@ public abstract class Table {
}
/**
*
* @return
*/
public boolean removeAllData() {
@ -123,7 +113,6 @@ public abstract class Table {
}
/**
*
* @param <T>
* @param objects
* @return

View File

@ -17,7 +17,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class UsersTable extends Table {
@ -44,7 +43,6 @@ public class UsersTable extends Table {
private final String columnContainsBukkitData;
/**
*
* @param db
* @param usingMySQL
*/
@ -72,7 +70,6 @@ public class UsersTable extends Table {
}
/**
*
* @return
*/
@Override
@ -175,7 +172,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuid
* @return
* @throws SQLException
@ -185,7 +181,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuid
* @return
* @throws SQLException
@ -209,7 +204,6 @@ public class UsersTable extends Table {
}
/**
*
* @param userID
* @return
* @throws SQLException
@ -233,7 +227,6 @@ public class UsersTable extends Table {
}
/**
*
* @return @throws SQLException
*/
public Set<UUID> getSavedUUIDs() throws SQLException {
@ -257,7 +250,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuid
* @return
*/
@ -266,7 +258,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuid
* @return
*/
@ -285,7 +276,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuid
* @return
* @throws SQLException
@ -324,7 +314,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuids
* @return
* @throws SQLException
@ -353,7 +342,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuids
* @return
* @throws SQLException
@ -457,7 +445,6 @@ public class UsersTable extends Table {
}
/**
*
* @param data
* @throws SQLException
*/
@ -487,7 +474,6 @@ public class UsersTable extends Table {
}
/**
*
* @param data
* @throws SQLException
*/
@ -523,7 +509,6 @@ public class UsersTable extends Table {
}
/**
*
* @param data
* @throws SQLException
*/
@ -656,7 +641,6 @@ public class UsersTable extends Table {
}
/**
*
* @param data
* @throws SQLException
*/
@ -782,7 +766,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuids
* @return
* @throws SQLException
@ -812,7 +795,6 @@ public class UsersTable extends Table {
}
/**
*
* @return @throws SQLException
*/
public Map<UUID, Integer> getAllUserIds() throws SQLException {
@ -837,7 +819,6 @@ public class UsersTable extends Table {
}
/**
*
* @return @throws SQLException
*/
public Map<Integer, Integer> getLoginTimes() throws SQLException {
@ -861,7 +842,6 @@ public class UsersTable extends Table {
}
/**
*
* @return
*/
public String getColumnID() {
@ -869,7 +849,6 @@ public class UsersTable extends Table {
}
/**
*
* @param playername
* @return
* @throws SQLException
@ -893,7 +872,6 @@ public class UsersTable extends Table {
}
/**
*
* @param uuids
* @return
*/

View File

@ -1,19 +1,18 @@
package main.java.com.djrapitops.plan.database.tables;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
/**
*
* @author Rsl1122
*/
public class VersionTable extends Table {
/**
*
* @param db
* @param usingMySQL
*/
@ -22,7 +21,6 @@ public class VersionTable extends Table {
}
/**
*
* @return
*/
@Override
@ -40,7 +38,6 @@ public class VersionTable extends Table {
}
/**
*
* @return @throws SQLException
*/
@Override
@ -62,7 +59,6 @@ public class VersionTable extends Table {
}
/**
*
* @param version
* @throws SQLException
*/

View File

@ -11,7 +11,6 @@ import java.io.FileNotFoundException;
import java.util.UUID;
/**
*
* @author Rsl1122
*/
public class DataRequestHandler {

View File

@ -1,15 +1,15 @@
package main.java.com.djrapitops.plan.ui.html;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Log;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import main.java.com.djrapitops.plan.Log;
/**
*
* @author Rsl1122
*/
public enum Html {
@ -112,37 +112,6 @@ public enum Html {
}
/**
*
* @return
*/
public String parse() {
return html;
}
/**
*
* @param p
* @return
*/
public String parse(String... p) {
Verify.nullCheck(p);
String returnValue = this.html;
for (int i = 0; i < p.length; i++) {
returnValue = returnValue.replace("REPLACE" + i, p[i]);
}
return returnValue;
}
/**
*
* @param html
*/
public void setHtml(String html) {
this.html = html;
}
/**
*
* @param localeFile
*/
public static void loadLocale(File localeFile) {
@ -173,4 +142,31 @@ public enum Html {
}
}
/**
* @return
*/
public String parse() {
return html;
}
/**
* @param p
* @return
*/
public String parse(String... p) {
Verify.nullCheck(p);
String returnValue = this.html;
for (int i = 0; i < p.length; i++) {
returnValue = returnValue.replace("REPLACE" + i, p[i]);
}
return returnValue;
}
/**
* @param html
*/
public void setHtml(String html) {
this.html = html;
}
}

View File

@ -5,7 +5,6 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import java.util.List;
/**
*
* @author Rsl1122
*/
public class RecentPlayersButtonsCreator {

View File

@ -17,13 +17,11 @@ import java.util.Objects;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class PunchCardGraphCreator {
/**
*
* @param data
* @return
*/

View File

@ -5,25 +5,20 @@
*/
package main.java.com.djrapitops.plan.ui.html.graphs;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.data.SessionData;
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class SessionLengthDistributionGraphCreator {
/**
*
* @param data
* @return
*/
@ -33,7 +28,6 @@ public class SessionLengthDistributionGraphCreator {
}
/**
*
* @param lengths
* @return
*/

View File

@ -10,7 +10,6 @@ import java.util.Objects;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
* @since 3.5.0
*/

View File

@ -10,13 +10,11 @@ import java.util.List;
import java.util.Map;
/**
*
* @author Rsl1122
*/
public class CommandUseTableCreator {
/**
*
* @param commandUse
* @return
*/

View File

@ -10,13 +10,11 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import java.util.List;
/**
*
* @author Rsl1122
*/
public class KillsTableCreator {
/**
*
* @param killData
* @return
*/

View File

@ -16,13 +16,11 @@ import org.bukkit.ChatColor;
import java.util.UUID;
/**
*
* @author Rsl1122
*/
public class TextUI {
/**
*
* @param uuid
* @return
*/
@ -53,7 +51,6 @@ public class TextUI {
}
/**
*
* @return
*/
public static String[] getAnalysisMessages() {

View File

@ -27,24 +27,21 @@ import java.util.Base64;
import java.util.UUID;
/**
*
* @author Rsl1122
*/
public class WebSocketServer {
private final int PORT;
private final Plan plugin;
private final DataRequestHandler dataReqHandler;
private boolean enabled = false;
private Socket sslServer;
private ServerSocket server;
private final Plan plugin;
private final DataRequestHandler dataReqHandler;
private boolean shutdown;
/**
* Class Constructor.
*
* <p>
* Initializes DataRequestHandler
*
* @param plugin Current instance of Plan
@ -75,7 +72,8 @@ public class WebSocketServer {
@Override
public void run() {
while (!shutdown) {
/*SSL*/Socket socket = null;
/*SSL*/
Socket socket = null;
InputStream input = null;
OutputStream output = null;
Request request = null;
@ -194,7 +192,6 @@ public class WebSocketServer {
}
/**
*
* @return
*/
public boolean isEnabled() {

View File

@ -1,10 +1,10 @@
package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
import main.java.com.djrapitops.plan.ui.html.DataRequestHandler;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -1,11 +1,11 @@
package main.java.com.djrapitops.plan.ui.webserver.response;
import main.java.com.djrapitops.plan.ui.html.DataRequestHandler;
import java.io.OutputStream;
import java.util.UUID;
import main.java.com.djrapitops.plan.ui.html.DataRequestHandler;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -1,10 +1,10 @@
package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
import main.java.com.djrapitops.plan.ui.html.Html;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -10,7 +10,6 @@ import java.io.OutputStream;
import java.util.List;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.ui.webserver.response;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -4,7 +4,6 @@ import java.io.IOException;
import java.io.OutputStream;
/**
*
* @author Rsl1122
* @since 3.5.2
*/

View File

@ -4,13 +4,11 @@ import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Plan;
/**
*
* @author Rsl1122
*/
public class Benchmark {
/**
*
* @param source
*/
public static void start(String source) {
@ -19,7 +17,6 @@ public class Benchmark {
}
/**
*
* @param source
* @return
*/

View File

@ -8,13 +8,11 @@ import org.bukkit.Location;
import java.text.DecimalFormat;
/**
*
* @author Rsl1122
*/
public class FormatUtils {
/**
*
* @param ms
* @return
*/
@ -23,7 +21,6 @@ public class FormatUtils {
}
/**
*
* @param before
* @param after
* @return
@ -33,7 +30,6 @@ public class FormatUtils {
}
/**
*
* @param epochMs
* @return
*/
@ -42,7 +38,6 @@ public class FormatUtils {
}
/**
*
* @param epochMs
* @return
*/
@ -51,7 +46,6 @@ public class FormatUtils {
}
/**
*
* @param epochMs
* @return
*/
@ -74,7 +68,6 @@ public class FormatUtils {
}
/**
*
* @param dataPoint
* @return
*/
@ -173,7 +166,6 @@ public class FormatUtils {
}
/**
*
* @param d
* @return
*/

View File

@ -12,13 +12,11 @@ import java.util.Map;
import java.util.Scanner;
/**
*
* @author Rsl1122
*/
public class HtmlUtils {
/**
*
* @param fileName
* @return
* @throws FileNotFoundException
@ -49,7 +47,6 @@ public class HtmlUtils {
}
/**
*
* @param html
* @param replaceMap
* @return
@ -62,7 +59,6 @@ public class HtmlUtils {
}
/**
*
* @return
*/
public static String getServerAnalysisUrlWithProtocol() {
@ -70,7 +66,6 @@ public class HtmlUtils {
}
/**
*
* @return
*/
public static String getServerAnalysisUrl() {
@ -84,7 +79,6 @@ public class HtmlUtils {
}
/**
*
* @param playerName
* @return
*/
@ -93,7 +87,6 @@ public class HtmlUtils {
}
/**
*
* @param playerName
* @return
*/
@ -112,7 +105,6 @@ public class HtmlUtils {
}
/**
*
* @param string
* @return
*/
@ -124,7 +116,6 @@ public class HtmlUtils {
}
/**
*
* @param pluginNames
* @param placeholders
* @return
@ -170,7 +161,6 @@ public class HtmlUtils {
}
/**
*
* @param string
* @return
*/

View File

@ -14,7 +14,6 @@ import java.util.*;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class ManageUtils {
@ -80,7 +79,6 @@ public class ManageUtils {
}
/**
*
* @param sessions
* @return
*/
@ -98,7 +96,6 @@ public class ManageUtils {
}
/**
*
* @param sessions
* @param loginTimes
* @return

View File

@ -3,6 +3,10 @@ package main.java.com.djrapitops.plan.utilities;
import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.ISender;
import com.djrapitops.plugin.utilities.player.Fetch;
import com.djrapitops.plugin.utilities.player.IOfflinePlayer;
import main.java.com.djrapitops.plan.Permissions;
import main.java.com.djrapitops.plan.Phrase;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
@ -10,10 +14,6 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import com.djrapitops.plugin.utilities.player.IOfflinePlayer;
import main.java.com.djrapitops.plan.Permissions;
import main.java.com.djrapitops.plan.Phrase;
/**
* Utility method class containing various static methods.
*
@ -32,7 +32,6 @@ public class MiscUtils {
}
/**
*
* @param args
* @param sender
* @return

View File

@ -6,7 +6,6 @@ import com.djrapitops.plugin.utilities.player.IPlayer;
import main.java.com.djrapitops.plan.data.UserData;
/**
*
* @author Rsl1122
*/
public class NewPlayerCreator {

View File

@ -9,7 +9,7 @@ import java.security.spec.InvalidKeySpecException;
/**
* Password Encryption utility.
*
* <p>
* https://github.com/defuse/password-hashing/blob/master/PasswordStorage.java
*
* @author Defuse
@ -17,37 +17,11 @@ import java.security.spec.InvalidKeySpecException;
*/
public class PassEncryptUtil {
@SuppressWarnings("serial")
static public class InvalidHashException extends Exception {
public InvalidHashException(String message) {
super(message);
}
public InvalidHashException(String message, Throwable source) {
super(message, source);
}
}
@SuppressWarnings("serial")
static public class CannotPerformOperationException extends Exception {
public CannotPerformOperationException(String message) {
super(message);
}
public CannotPerformOperationException(String message, Throwable source) {
super(message, source);
}
}
public static final String PBKDF2_ALGORITHM = "PBKDF2WithHmacSHA1";
// These constants may be changed without breaking existing hashes.
public static final int SALT_BYTE_SIZE = 24;
public static final int HASH_BYTE_SIZE = 18;
public static final int PBKDF2_ITERATIONS = 64000;
// These constants define the encoding and may not be changed.
public static final int HASH_SECTIONS = 5;
public static final int HASH_ALGORITHM_INDEX = 0;
@ -186,4 +160,28 @@ public class PassEncryptUtil {
return DatatypeConverter.printBase64Binary(array);
}
@SuppressWarnings("serial")
static public class InvalidHashException extends Exception {
public InvalidHashException(String message) {
super(message);
}
public InvalidHashException(String message, Throwable source) {
super(message, source);
}
}
@SuppressWarnings("serial")
static public class CannotPerformOperationException extends Exception {
public CannotPerformOperationException(String message) {
super(message);
}
public CannotPerformOperationException(String message, Throwable source) {
super(message, source);
}
}
}

View File

@ -19,7 +19,6 @@ import java.util.Map;
import java.util.UUID;
/**
*
* @author Rsl1122
*/
public class PlaceholderUtils {

View File

@ -25,7 +25,6 @@ import java.util.*;
import java.util.stream.Collectors;
/**
*
* @author Rsl1122
*/
public class Analysis {
@ -46,7 +45,7 @@ public class Analysis {
/**
* Analyzes the data of all offline players on the server.
*
* <p>
* First retrieves all offline players and checks those that are in the
* database. Then Runs a new Analysis Task Asynchronously. Saves AnalysisData
* to the provided Cache. Saves all UserData to InspectCache for 15 minutes.
@ -105,7 +104,6 @@ public class Analysis {
}
/**
*
* @param rawData
* @param tpsData
* @param analysisCache
@ -222,7 +220,6 @@ public class Analysis {
}
/**
*
* @return
*/
public boolean isAnalysisBeingRun() {

View File

@ -14,13 +14,11 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* @author Rsl1122
*/
public class AnalysisUtils {
/**
*
* @param now
* @param lastPlayed
* @param playTime
@ -44,7 +42,6 @@ public class AnalysisUtils {
}
/**
*
* @param registered
* @param scale
* @param now
@ -63,7 +60,6 @@ public class AnalysisUtils {
}
/**
*
* @param data
* @return
*/
@ -76,7 +72,6 @@ public class AnalysisUtils {
}
/**
*
* @param analysisType
* @param source
* @param uuids
@ -118,7 +113,6 @@ public class AnalysisUtils {
}
/**
*
* @param analysisType
* @param source
* @param uuids
@ -157,7 +151,6 @@ public class AnalysisUtils {
}
/**
*
* @param analysisType
* @param source
* @param uuids
@ -179,7 +172,6 @@ public class AnalysisUtils {
}
/**
*
* @param analysisType
* @param source
* @param uuids
@ -208,7 +200,6 @@ public class AnalysisUtils {
}
/**
*
* @param sessions
* @param scale
* @return
@ -230,7 +221,6 @@ public class AnalysisUtils {
}
/**
*
* @param sessions
* @param scale
* @return
@ -263,7 +253,6 @@ public class AnalysisUtils {
}
/**
*
* @param sessionStarts
* @return
*/

Some files were not shown because too many files have changed in this diff Show More