mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-04-24 18:40:34 +08:00
Reformatted code
This commit is contained in:
parent
2a7ef0ab46
commit
8186f06d96
Plan
Class Diagram.xmlcheckstyle.xmldependency-reduced-pom.xmlnbactions.xmlpom.xml
src/main/java/com/djrapitops/plan
Log.javaPermissions.javaPhrase.javaPlan.java
api
command
PlanCommand.java
commands
data
AnalysisData.javaKillData.javaSessionData.javaTPS.javaUserData.java
additional
analysis
ActivityPart.javaCommandUsagePart.javaGamemodePart.javaGeolocationPart.javaJoinInfoPart.javaKillPart.javaPlayerCountPart.javaPlaytimePart.javaRawData.javaTPSPart.java
cache
AnalysisCacheHandler.javaDBCallableProcessor.javaDataCacheHandler.javaInspectCacheHandler.javaSessionCache.java
queue
handling
ChatHandling.javaGamemodeHandling.javaKillHandling.javaLoginHandling.javaLogoutHandling.java
importing
info
listeners
database
ui
File diff suppressed because one or more lines are too long
@ -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. -->
|
||||
@ -8,15 +9,15 @@
|
||||
|
||||
<module name='TreeWalker'>
|
||||
|
||||
<property name='tabWidth' value='4' />
|
||||
|
||||
<property name='tabWidth' value='4'/>
|
||||
|
||||
<!-- Block Checks -->
|
||||
|
||||
<module name='EmptyBlock' />
|
||||
<module name='LeftCurly' />
|
||||
<module name='NeedBraces' />
|
||||
<module name='RightCurly' />
|
||||
<module name='AvoidNestedBlocks' />
|
||||
<module name='EmptyBlock'/>
|
||||
<module name='LeftCurly'/>
|
||||
<module name='NeedBraces'/>
|
||||
<module name='RightCurly'/>
|
||||
<module name='AvoidNestedBlocks'/>
|
||||
<module name="NestedIfDepth">
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
@ -26,50 +27,50 @@
|
||||
<module name="NestedTryDepth"/>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<module name='Indentation' />
|
||||
<module name='Indentation'/>
|
||||
<module name="OneStatementPerLine"/>
|
||||
|
||||
<!--- Naming Conventions -->
|
||||
|
||||
<module name='ClassTypeParameterName' />
|
||||
<module name='ConstantName' />
|
||||
<module name='LocalFinalVariableName' />
|
||||
<module name='LocalVariableName' />
|
||||
<module name='MemberName' />
|
||||
<module name='MethodName' />
|
||||
<module name='MethodTypeParameterName' />
|
||||
<module name='ClassTypeParameterName'/>
|
||||
<module name='ConstantName'/>
|
||||
<module name='LocalFinalVariableName'/>
|
||||
<module name='LocalVariableName'/>
|
||||
<module name='MemberName'/>
|
||||
<module name='MethodName'/>
|
||||
<module name='MethodTypeParameterName'/>
|
||||
|
||||
<module name='PackageName'>
|
||||
<property name='format' value='^[a-z]+(\.[a-z][a-z0-9]*)*$' />
|
||||
<property name='format' value='^[a-z]+(\.[a-z][a-z0-9]*)*$'/>
|
||||
</module>
|
||||
|
||||
<module name='ParameterName' />
|
||||
<module name='StaticVariableName' />
|
||||
<module name='TypeName' />
|
||||
<module name='ParameterName'/>
|
||||
<module name='StaticVariableName'/>
|
||||
<module name='TypeName'/>
|
||||
|
||||
<!-- Whitespace -->
|
||||
|
||||
<module name='GenericWhitespace' />
|
||||
<module name='EmptyForInitializerPad' />
|
||||
<module name='EmptyForIteratorPad' />
|
||||
<module name='MethodParamPad' />
|
||||
<module name='GenericWhitespace'/>
|
||||
<module name='EmptyForInitializerPad'/>
|
||||
<module name='EmptyForIteratorPad'/>
|
||||
<module name='MethodParamPad'/>
|
||||
|
||||
<module name='NoWhitespaceAfter'>
|
||||
<property name='tokens' value='BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS' />
|
||||
<property name='tokens' value='BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS'/>
|
||||
</module>
|
||||
|
||||
<module name='NoWhitespaceBefore'>
|
||||
<property name='tokens' value='SEMI, DOT, POST_DEC, POST_INC' />
|
||||
<property name='allowLineBreaks' value='true' />
|
||||
<property name='tokens' value='SEMI, DOT, POST_DEC, POST_INC'/>
|
||||
<property name='allowLineBreaks' value='true'/>
|
||||
</module>
|
||||
|
||||
<module name='ParenPad' />
|
||||
<module name='TypecastParenPad' />
|
||||
<module name='WhitespaceAfter' />
|
||||
<module name='ParenPad'/>
|
||||
<module name='TypecastParenPad'/>
|
||||
<module name='WhitespaceAfter'/>
|
||||
|
||||
<module name='WhitespaceAround'>
|
||||
<property name='allowEmptyConstructors' value='true' />
|
||||
<property name='allowEmptyMethods' value='true' />
|
||||
<property name='allowEmptyConstructors' value='true'/>
|
||||
<property name='allowEmptyMethods' value='true'/>
|
||||
</module>
|
||||
|
||||
<!-- Javadoc -->
|
||||
@ -81,7 +82,7 @@
|
||||
<property name="allowMissingReturnTag" value="false"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
</module>
|
||||
|
||||
|
||||
<module name="JavadocStyle">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="checkEmptyJavadoc" value="true"/>
|
||||
@ -91,7 +92,7 @@
|
||||
<!-- File Length -->
|
||||
|
||||
<module name='FileLength'>
|
||||
<property name='max' value='2000' />
|
||||
<property name='max' value='2000'/>
|
||||
</module>
|
||||
|
||||
</module>
|
@ -1,182 +1,183 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>Plan</artifactId>
|
||||
<version>3.5.4</version>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>*.html</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.name}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.powermock:*</exclude>
|
||||
<exclude>org.javassist:*</exclude>
|
||||
<exclude>com.thoughtworks.xstream:*</exclude>
|
||||
<exclude>xmlpull:*</exclude>
|
||||
<exclude>xpp3:*</exclude>
|
||||
<exclude>org.objenesis:*</exclude>
|
||||
<exclude>cglib:*</exclude>
|
||||
<exclude>org.*:*</exclude>
|
||||
<exclude>org.easymock:*</exclude>
|
||||
<exclude>junit:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/test/*</exclude>
|
||||
<exclude>**/*/test/*</exclude>
|
||||
<exclude>**/*/test.*</exclude>
|
||||
<exclude>**/test/**/*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.pitest</groupId>
|
||||
<artifactId>pitest-maven</artifactId>
|
||||
<version>1.1.8</version>
|
||||
<configuration>
|
||||
<targetClasses>
|
||||
<param>main.java.com.djrapitops.plan.*</param>
|
||||
</targetClasses>
|
||||
<targetTests>
|
||||
<param>test.java.main.java.com.djrapitops.plan.*</param>
|
||||
</targetTests>
|
||||
<timeoutConstant>1000</timeoutConstant>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<configuration>
|
||||
<excludes>**/test/**/*</excludes>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<configuration>
|
||||
<excludePackageNames>test.*</excludePackageNames>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<type>pom</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4-rule</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-classloading-xstream</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.10.19</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-easymock</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<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>
|
||||
<version>3.5.4</version>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>*.html</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.name}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.powermock:*</exclude>
|
||||
<exclude>org.javassist:*</exclude>
|
||||
<exclude>com.thoughtworks.xstream:*</exclude>
|
||||
<exclude>xmlpull:*</exclude>
|
||||
<exclude>xpp3:*</exclude>
|
||||
<exclude>org.objenesis:*</exclude>
|
||||
<exclude>cglib:*</exclude>
|
||||
<exclude>org.*:*</exclude>
|
||||
<exclude>org.easymock:*</exclude>
|
||||
<exclude>junit:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/test/*</exclude>
|
||||
<exclude>**/*/test/*</exclude>
|
||||
<exclude>**/*/test.*</exclude>
|
||||
<exclude>**/test/**/*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.pitest</groupId>
|
||||
<artifactId>pitest-maven</artifactId>
|
||||
<version>1.1.8</version>
|
||||
<configuration>
|
||||
<targetClasses>
|
||||
<param>main.java.com.djrapitops.plan.*</param>
|
||||
</targetClasses>
|
||||
<targetTests>
|
||||
<param>test.java.main.java.com.djrapitops.plan.*</param>
|
||||
</targetTests>
|
||||
<timeoutConstant>1000</timeoutConstant>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<configuration>
|
||||
<excludes>**/test/**/*</excludes>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<configuration>
|
||||
<excludePackageNames>test.*</excludePackageNames>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<type>pom</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4-rule</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-classloading-xstream</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.10.19</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-easymock</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
@ -52,7 +52,7 @@ public class Log {
|
||||
* Logs trace of caught Exception to Errors.txt and notifies on console.
|
||||
*
|
||||
* @param source Class name the exception was caught in.
|
||||
* @param e Throwable, eg NullPointerException
|
||||
* @param e Throwable, eg NullPointerException
|
||||
*/
|
||||
public static void toLog(String source, Throwable e) {
|
||||
Plan.getInstance().getPluginLogger().toLog(source, e);
|
||||
@ -62,7 +62,7 @@ public class Log {
|
||||
* Logs multiple caught Errors to Errors.txt.
|
||||
*
|
||||
* @param source Class name the exception was caught in.
|
||||
* @param e Collection of Throwables, eg NullPointerException
|
||||
* @param e Collection of Throwables, eg NullPointerException
|
||||
*/
|
||||
public static void toLog(String source, Collection<Throwable> e) {
|
||||
Plan.getInstance().getPluginLogger().toLog(source, e);
|
||||
@ -71,7 +71,7 @@ public class Log {
|
||||
/**
|
||||
* Logs a message to the a given file with a timestamp.
|
||||
*
|
||||
* @param message Message to log to Errors.txt [timestamp] Message
|
||||
* @param message Message to log to Errors.txt [timestamp] Message
|
||||
* @param filename Name of the file to write to.
|
||||
*/
|
||||
public static void toLog(String message, String filename) {
|
||||
|
@ -44,7 +44,7 @@ public enum Permissions {
|
||||
|
||||
/**
|
||||
* Returns the permission node in plugin.yml.
|
||||
*
|
||||
* <p>
|
||||
* Same as getPermission.
|
||||
*
|
||||
* @return permission node eg. plan.inspect
|
||||
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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,12 +65,12 @@ 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.
|
||||
*
|
||||
* @param dataSource an object that extends PluginData-object, thus allowing
|
||||
* Analysis and Inspect to manage the data of a plugin correctly.
|
||||
* Analysis and Inspect to manage the data of a plugin correctly.
|
||||
* @see PluginData
|
||||
*/
|
||||
public void addPluginDataSource(PluginData dataSource) {
|
||||
@ -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,12 +98,12 @@ 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.
|
||||
* @param uuid UUID of the player.
|
||||
* @param processor Object implementing DBCallableProcessor, which
|
||||
* process (UserData data) method will be called.
|
||||
* process (UserData data) method will be called.
|
||||
*/
|
||||
public void scheduleForGet(UUID uuid, DBCallableProcessor processor) {
|
||||
plugin.getHandler().getUserDataForProcessing(processor, uuid, false);
|
||||
@ -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,11 +123,11 @@ 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
|
||||
* the cache.
|
||||
* the cache.
|
||||
*/
|
||||
public void placeDataToCache(UserData data) {
|
||||
plugin.getHandler().cache(data);
|
||||
@ -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.
|
||||
@ -234,8 +234,8 @@ public class API {
|
||||
* @param uuid UUID of the player.
|
||||
* @return Playername, eg "Rsl1122"
|
||||
* @throws IllegalArgumentException If uuid is null.
|
||||
* @throws IllegalStateException If the player has not played on the server
|
||||
* before.
|
||||
* @throws IllegalStateException If the player has not played on the server
|
||||
* before.
|
||||
*/
|
||||
public String getPlayerName(UUID uuid) throws IllegalStateException, IllegalArgumentException {
|
||||
Verify.nullCheck(uuid);
|
||||
@ -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.
|
||||
|
@ -9,9 +9,9 @@ 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
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@ -19,7 +19,7 @@ public class PlanCommand extends TreeCommand<Plan> {
|
||||
|
||||
/**
|
||||
* CommandExecutor class Constructor.
|
||||
*
|
||||
* <p>
|
||||
* Initializes Subcommands
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
|
@ -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.
|
||||
@ -140,6 +136,6 @@ public class AnalyzeCommand extends SubCommand {
|
||||
plugin.getServer().dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true,"
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ public class InfoCommand extends SubCommand {
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
ChatColor tColor = Phrase.COLOR_SEC.color();
|
||||
String[] messages = {
|
||||
Phrase.CMD_INFO_HEADER.toString(),
|
||||
Phrase.CMD_INFO_VERSION.parse(plugin.getDescription().getVersion()),
|
||||
Phrase.CMD_BALL.toString() + tColor + " " + Version.checkVersion(plugin),
|
||||
Phrase.CMD_MANAGE_STATUS_ACTIVE_DB.parse(plugin.getDB().getConfigName()),
|
||||
Phrase.CMD_FOOTER.toString()
|
||||
Phrase.CMD_INFO_HEADER.toString(),
|
||||
Phrase.CMD_INFO_VERSION.parse(plugin.getDescription().getVersion()),
|
||||
Phrase.CMD_BALL.toString() + tColor + " " + Version.checkVersion(plugin),
|
||||
Phrase.CMD_MANAGE_STATUS_ACTIVE_DB.parse(plugin.getDB().getConfigName()),
|
||||
Phrase.CMD_FOOTER.toString()
|
||||
};
|
||||
sender.sendMessage(messages);
|
||||
return true;
|
||||
|
@ -141,6 +141,6 @@ public class InspectCommand extends SubCommand {
|
||||
plugin.getServer().dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true,"
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ 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
|
||||
* @since 3.5.2
|
||||
*/
|
||||
@ -66,6 +66,6 @@ public class ListCommand extends SubCommand {
|
||||
plugin.getServer().dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true,"
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,7 @@ import java.util.logging.LogRecord;
|
||||
|
||||
/**
|
||||
* Filters out WebUser registration command logs.
|
||||
*
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
@ -14,10 +14,10 @@ public class RegisterCommandFilter implements Filter {
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
String message = record.getMessage();
|
||||
boolean block = message.contains("command: /plan register")
|
||||
|| message.contains("command: /plan web register")
|
||||
|| message.contains("command: /plan webuser register");
|
||||
boolean block = message.contains("command: /plan register")
|
||||
|| message.contains("command: /plan web register")
|
||||
|| message.contains("command: /plan webuser register");
|
||||
return !block;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -30,13 +30,13 @@ public class ManageStatusCommand extends SubCommand {
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
String[] messages = new String[]{
|
||||
Phrase.CMD_MANAGE_STATUS_HEADER.toString(),
|
||||
Phrase.CMD_MANAGE_STATUS_ACTIVE_DB.parse(plugin.getDB().getConfigName()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_PROCESS.parse("" + plugin.getHandler().getProcessTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_SAVE.parse("" + plugin.getHandler().getSaveTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_GET.parse("" + plugin.getHandler().getGetTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_CLEAR.parse("" + plugin.getHandler().getClearTask().size()),
|
||||
Phrase.CMD_FOOTER.toString()
|
||||
Phrase.CMD_MANAGE_STATUS_HEADER.toString(),
|
||||
Phrase.CMD_MANAGE_STATUS_ACTIVE_DB.parse(plugin.getDB().getConfigName()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_PROCESS.parse("" + plugin.getHandler().getProcessTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_SAVE.parse("" + plugin.getHandler().getSaveTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_GET.parse("" + plugin.getHandler().getGetTask().size()),
|
||||
Phrase.CMD_MANAGE_STATUS_QUEUE_CLEAR.parse("" + plugin.getHandler().getClearTask().size()),
|
||||
Phrase.CMD_FOOTER.toString()
|
||||
};
|
||||
|
||||
sender.sendMessage(messages);
|
||||
|
@ -29,12 +29,12 @@ public class WebLevelCommand extends SubCommand {
|
||||
String sCol = cs.getSecondaryColor();
|
||||
String cmdBall = Phrase.CMD_BALL.parse();
|
||||
String[] messages = new String[]{
|
||||
Phrase.CMD_FOOTER.parse(),
|
||||
cmdBall + sCol + "0: Access all pages",
|
||||
cmdBall + sCol + "1: Access '/players' and all inspect pages",
|
||||
cmdBall + sCol + "2: Access inspect page with the same username as the webuser",
|
||||
cmdBall + sCol + "3+: No permissions",
|
||||
Phrase.CMD_FOOTER.parse()
|
||||
Phrase.CMD_FOOTER.parse(),
|
||||
cmdBall + sCol + "0: Access all pages",
|
||||
cmdBall + sCol + "1: Access '/players' and all inspect pages",
|
||||
cmdBall + sCol + "2: Access inspect page with the same username as the webuser",
|
||||
cmdBall + sCol + "3+: No permissions",
|
||||
Phrase.CMD_FOOTER.parse()
|
||||
};
|
||||
sender.sendMessage(messages);
|
||||
return true;
|
||||
|
@ -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);
|
||||
@ -95,9 +92,9 @@ public class AnalysisData extends RawData<AnalysisData> {
|
||||
|
||||
public List<RawData> getAllParts() {
|
||||
return Arrays.asList(new RawData[]{
|
||||
activityPart, commandUsagePart, gamemodePart,
|
||||
geolocationPart, joinInfoPart, killPart,
|
||||
playerCountPart, playtimePart, tpsPart
|
||||
activityPart, commandUsagePart, gamemodePart,
|
||||
geolocationPart, joinInfoPart, killPart,
|
||||
playerCountPart, playtimePart, tpsPart
|
||||
});
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ public class KillData {
|
||||
/**
|
||||
* Creates a KillData object with given parameters.
|
||||
*
|
||||
* @param victim UUID of the victim.
|
||||
* @param victim UUID of the victim.
|
||||
* @param victimID ID of the victim, get from the database.
|
||||
* @param weapon Weapon used.
|
||||
* @param date Epoch millisecond at which the kill occurred.
|
||||
* @param weapon Weapon used.
|
||||
* @param date Epoch millisecond at which the kill occurred.
|
||||
*/
|
||||
public KillData(UUID victim, int victimID, String weapon, long date) {
|
||||
this.victim = victim;
|
||||
|
@ -25,7 +25,7 @@ public class SessionData {
|
||||
* Creates a new session with given start and end.
|
||||
*
|
||||
* @param sessionStart Epoch millisecond the session was started.
|
||||
* @param sessionEnd Epoch millisecond the session ended.
|
||||
* @param sessionEnd Epoch millisecond the session ended.
|
||||
*/
|
||||
public SessionData(long sessionStart, long sessionEnd) {
|
||||
this.sessionStart = sessionStart;
|
||||
@ -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.
|
||||
|
@ -21,9 +21,9 @@ public class TPS {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param date time of the average calculation.
|
||||
* @param tps average tps for the last minute.
|
||||
* @param players average players for the last minute.
|
||||
* @param date time of the average calculation.
|
||||
* @param tps average tps for the last minute.
|
||||
* @param players average players for the last minute.
|
||||
* @param cpuUsage average CPU usage for the last minute.
|
||||
*/
|
||||
public TPS(long date, double tps, int players, double cpuUsage) {
|
||||
|
@ -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,37 +34,33 @@ 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
|
||||
*
|
||||
* @param uuid UUID of the player
|
||||
* @param reg Epoch millisecond the player registered.
|
||||
* @param op Is the player op? (true/false)
|
||||
* @param uuid UUID of the player
|
||||
* @param reg Epoch millisecond the player registered.
|
||||
* @param op Is the player op? (true/false)
|
||||
* @param lastGM last GameMode the player was seen in.
|
||||
* @param name Name of the player.
|
||||
* @param name Name of the player.
|
||||
* @param online Is the player online?
|
||||
*/
|
||||
public UserData(UUID uuid, long reg, boolean op, String lastGM, String name, boolean online) {
|
||||
@ -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.
|
||||
@ -249,7 +245,7 @@ public class UserData {
|
||||
/**
|
||||
* Set a specific GameMode's millisecond value.
|
||||
*
|
||||
* @param gm Name of Gamemode.
|
||||
* @param gm Name of Gamemode.
|
||||
* @param time Milliseconds spent in the gamemode.
|
||||
*/
|
||||
public void setGMTime(String gm, long time) {
|
||||
@ -264,8 +260,8 @@ public class UserData {
|
||||
/**
|
||||
* Set every GameMode's millisecond value.
|
||||
*
|
||||
* @param survivalTime ms spent in SURVIVAL
|
||||
* @param creativeTime ms spent in CREATIVE
|
||||
* @param survivalTime ms spent in SURVIVAL
|
||||
* @param creativeTime ms spent in CREATIVE
|
||||
* @param adventureTime ms spent in ADVENTURE
|
||||
* @param spectatorTime ms spent in SPECTATOR
|
||||
*/
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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".
|
||||
*
|
||||
|
@ -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.
|
||||
|
@ -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,71 +17,65 @@ 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
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
* @param sourcePlugin Name of the plugin the data is coming from
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
* @param analysisTypes A list containing the AnalysisType enums that
|
||||
* determine what should be done with the data on the analysis page
|
||||
* determine what should be done with the data on the analysis page
|
||||
*/
|
||||
public PluginData(String sourcePlugin, String placeholder, List<AnalysisType> analysisTypes) {
|
||||
this.placeholder = placeholder;
|
||||
@ -96,10 +90,10 @@ public abstract class PluginData {
|
||||
/**
|
||||
* Constructor for accepting single, multiple and arrays of AnalysisType.
|
||||
*
|
||||
* @param sourcePlugin Name of the plugin the data is coming from
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
* @param sourcePlugin Name of the plugin the data is coming from
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
* @param analysisTypes AnalysisType enums that determine what should be
|
||||
* done with the data on the analysis page
|
||||
* done with the data on the analysis page
|
||||
*/
|
||||
public PluginData(String sourcePlugin, String placeholder, AnalysisType... analysisTypes) {
|
||||
this(sourcePlugin, placeholder, Arrays.asList(analysisTypes));
|
||||
@ -107,11 +101,11 @@ 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
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
* @param placeholder Placeholder string, for example "stepsTaken"
|
||||
*/
|
||||
public PluginData(String sourcePlugin, String placeholder) {
|
||||
this(sourcePlugin, placeholder, new ArrayList<>());
|
||||
@ -120,7 +114,7 @@ public abstract class PluginData {
|
||||
|
||||
/**
|
||||
* Returns the list of AnalysisTypes.
|
||||
*
|
||||
* <p>
|
||||
* Used by Analysis
|
||||
*
|
||||
* @return a list.
|
||||
@ -132,15 +126,15 @@ 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.
|
||||
*
|
||||
* @param modifier For example "Average " - Determined by value of
|
||||
* AnalysisType's modifier-variable.
|
||||
* AnalysisType's modifier-variable.
|
||||
* @param contents The data, number/string/html that should be placed on the
|
||||
* page.
|
||||
* page.
|
||||
* @return a proper format for the html.
|
||||
* @see AnalysisType
|
||||
*/
|
||||
@ -150,12 +144,12 @@ public abstract class PluginData {
|
||||
|
||||
/**
|
||||
* Used to get the full placeholder.
|
||||
*
|
||||
* <p>
|
||||
* Used to avoid conflicts with existing placeholders and placeholders of
|
||||
* other plugins.
|
||||
*
|
||||
* @param modifier Modifier determined by AnalysisType's
|
||||
* placeholderModifier-variable.
|
||||
* placeholderModifier-variable.
|
||||
* @return for example "%StepCounter_stepsTaken_total%"
|
||||
* @see AnalysisType
|
||||
*/
|
||||
@ -174,20 +168,20 @@ 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.
|
||||
*
|
||||
* @param modifierPrefix Modifier determined by AnalysisType's
|
||||
* modifier-variable.
|
||||
* @param uuid UUID of the player or random UUID if AnalysisType.HTML is
|
||||
* used.
|
||||
* modifier-variable.
|
||||
* @param uuid UUID of the player or random UUID if AnalysisType.HTML is
|
||||
* used.
|
||||
* @return html for the page.
|
||||
*/
|
||||
public abstract String getHtmlReplaceValue(String modifierPrefix, UUID uuid);
|
||||
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
@ -45,13 +45,13 @@ public class GamemodePart extends RawData<GamemodePart> {
|
||||
addValue("gmtotal", FormatUtils.formatTimeAmount(totalTime));
|
||||
|
||||
double[] percentages = new double[]{
|
||||
(survivalTime * 100.0) / totalTime,
|
||||
(creativeTime * 100.0) / totalTime,
|
||||
(adventureTime * 100.0) / totalTime,
|
||||
(spectatorTime * 100.0) / totalTime
|
||||
(survivalTime * 100.0) / totalTime,
|
||||
(creativeTime * 100.0) / totalTime,
|
||||
(adventureTime * 100.0) / totalTime,
|
||||
(spectatorTime * 100.0) / totalTime
|
||||
};
|
||||
long[] times = new long[]{
|
||||
survivalTime, creativeTime, adventureTime, spectatorTime
|
||||
survivalTime, creativeTime, adventureTime, spectatorTime
|
||||
};
|
||||
String col0 = Settings.HCOLOR_GMP_0 + "";
|
||||
String col1 = Settings.HCOLOR_GMP_1 + "";
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
@ -69,7 +70,7 @@ public abstract class RawData<T extends RawData> {
|
||||
* Adds a placeholder to the replaceMap.
|
||||
*
|
||||
* @param placeholder placeholder, with or without % signs.
|
||||
* @param value Any value the placeholder should be replaced with.
|
||||
* @param value Any value the placeholder should be replaced with.
|
||||
*/
|
||||
public void addValue(String placeholder, Serializable value) {
|
||||
placeholder = addPlaceholderSigns(placeholder);
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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() {
|
||||
|
@ -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.
|
||||
*
|
||||
@ -19,7 +19,7 @@ public abstract class DBCallableProcessor {
|
||||
* changing properties etc.
|
||||
*
|
||||
* @param data UserData object given to the DBCallableProcessor by the
|
||||
* method it was given as parameter to.
|
||||
* method it was given as parameter to.
|
||||
*/
|
||||
public abstract void process(UserData data);
|
||||
}
|
||||
|
@ -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
|
||||
*
|
||||
@ -115,8 +113,8 @@ public class DataCacheHandler extends SessionCache {
|
||||
* Used to start the Asynchronous Save Task.
|
||||
*
|
||||
* @throws IllegalArgumentException BukkitRunnable was given wrong
|
||||
* parameters.
|
||||
* @throws IllegalStateException BukkitScheduler is in a wrong state.
|
||||
* parameters.
|
||||
* @throws IllegalStateException BukkitScheduler is in a wrong state.
|
||||
*/
|
||||
public void startAsyncPeriodicSaveTask() throws IllegalArgumentException, IllegalStateException {
|
||||
int minutes = Settings.SAVE_CACHE_MIN.getNumber();
|
||||
@ -160,14 +158,14 @@ 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
|
||||
* after it was retrieved
|
||||
* @param uuid Player's UUID
|
||||
* @param cache Whether or not the UserData will be Cached in this instance
|
||||
* of DataCacheHandler after it has been fetched (if not already fetched)
|
||||
* after it was retrieved
|
||||
* @param uuid Player's UUID
|
||||
* @param cache Whether or not the UserData will be Cached in this instance
|
||||
* of DataCacheHandler after it has been fetched (if not already fetched)
|
||||
*/
|
||||
public void getUserDataForProcessing(DBCallableProcessor processor, UUID uuid, boolean cache) {
|
||||
Log.debug(uuid + ": HANDLER getForProcess," + " Cache:" + cache);
|
||||
@ -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,12 +202,12 @@ 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
|
||||
* after it was retrieved
|
||||
* @param uuid Player's UUID
|
||||
* after it was retrieved
|
||||
* @param uuid Player's UUID
|
||||
*/
|
||||
public void getUserDataForProcessing(DBCallableProcessor processor, UUID uuid) {
|
||||
getUserDataForProcessing(processor, uuid, true);
|
||||
@ -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() {
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -1,24 +1,25 @@
|
||||
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.
|
||||
*
|
||||
* @param queue Queue to consume from.
|
||||
* @param name Name of the queue.
|
||||
* @param name Name of the queue.
|
||||
*/
|
||||
public Consumer(BlockingQueue<T> queue, String name) {
|
||||
super(name);
|
||||
|
@ -34,9 +34,9 @@ public class DataCacheGetQueue extends Queue<Map<UUID, List<DBCallableProcessor>
|
||||
/**
|
||||
* Schedules UserData objects to be get for the given processors.
|
||||
*
|
||||
* @param uuid UUID of the player whose UserData object is fetched.
|
||||
* @param uuid UUID of the player whose UserData object is fetched.
|
||||
* @param processors Processors which process-method will be called after
|
||||
* fetch is complete, with the UserData object.
|
||||
* fetch is complete, with the UserData object.
|
||||
*/
|
||||
public void scheduleForGet(UUID uuid, DBCallableProcessor... processors) {
|
||||
Log.debug(uuid + ": Scheduling for get");
|
||||
|
@ -27,7 +27,7 @@ public class DataCacheSaveQueue extends Queue<UserData> {
|
||||
/**
|
||||
* Class constructor, starts the new Thread for saving.
|
||||
*
|
||||
* @param plugin current instance of Plan
|
||||
* @param plugin current instance of Plan
|
||||
* @param handler DataCacheHandler
|
||||
*/
|
||||
public DataCacheSaveQueue(Plan plugin, DataCacheHandler handler) {
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -15,9 +15,9 @@ public class ChatHandling {
|
||||
* Processes the information of the Event and changes UserData object
|
||||
* accordingly.
|
||||
*
|
||||
* @param data UserData of the player.
|
||||
* @param data UserData of the player.
|
||||
* @param nickname Nickname of the player during the event.
|
||||
* @param msg Message sent by the player.
|
||||
* @param msg Message sent by the player.
|
||||
*/
|
||||
public static void processChatInfo(UserData data, String nickname, String msg) {
|
||||
data.addNickname(nickname);
|
||||
|
@ -18,8 +18,8 @@ public class GamemodeHandling {
|
||||
* Processes the information of the Event and changes UserData object
|
||||
* accordingly.
|
||||
*
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param newGM The Gamemode the player changed to.
|
||||
*/
|
||||
public static void processGamemodeInfo(UserData data, long time, Gamemode newGM) {
|
||||
|
@ -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.
|
||||
@ -22,9 +23,9 @@ public class KillHandling {
|
||||
* Processes the information of the Event and changes UserData object
|
||||
* accordingly.
|
||||
*
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param dead Mob or a Player the player killed.
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param dead Mob or a Player the player killed.
|
||||
* @param weaponName The name of the Weapon used.
|
||||
*/
|
||||
public static void processKillInfo(UserData data, long time, LivingEntity dead, String weaponName) {
|
||||
|
@ -18,11 +18,11 @@ public class LoginHandling {
|
||||
* Processes the information of the Event and changes UserData object
|
||||
* accordingly.
|
||||
*
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned
|
||||
* @param nickname Nickname of the player
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned
|
||||
* @param nickname Nickname of the player
|
||||
* @param loginTimes amount the loginTimes should be incremented with.
|
||||
*/
|
||||
public static void processLoginInfo(UserData data, long time, InetAddress ip, boolean banned, String nickname, int loginTimes) {
|
||||
@ -36,10 +36,10 @@ 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.
|
||||
* @param ip InetAddress used for location.
|
||||
* @param data UserData of the player.
|
||||
* @see GeolocationCacheHandler
|
||||
*/
|
||||
|
@ -15,8 +15,8 @@ public class LogoutHandling {
|
||||
* Processes the information of the Event and changes UserData object
|
||||
* accordingly.
|
||||
*
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param data UserData of the player.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param banned Is the player banned?
|
||||
*/
|
||||
public static void processLogoutInfo(UserData data, long time, boolean banned) {
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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,11 +48,11 @@ 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
|
||||
* @param args arguments for the import
|
||||
* @param args arguments for the import
|
||||
* @return success
|
||||
*/
|
||||
public boolean importData(Collection<UUID> uuids, String... args) {
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -19,9 +19,9 @@ public class ChatInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param uuid UUID of the player.
|
||||
* @param nickname Nickname of the player.
|
||||
* @param message Message the player sent.
|
||||
* @param message Message the player sent.
|
||||
*/
|
||||
public ChatInfo(UUID uuid, String nickname, String message) {
|
||||
super(uuid, InfoType.CHAT, 0L);
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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.
|
||||
*
|
||||
@ -20,7 +21,7 @@ public class GamemodeInfo extends HandlingInfo {
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param gm Gamemode the player changed to.
|
||||
* @param gm Gamemode the player changed to.
|
||||
*/
|
||||
public GamemodeInfo(UUID uuid, long time, Gamemode gm) {
|
||||
super(uuid, InfoType.GM, time);
|
||||
|
@ -22,7 +22,7 @@ public abstract class HandlingInfo {
|
||||
*
|
||||
* @param uuid UUID of the player
|
||||
* @param type InfoType enum of the event. Only used for debugging different
|
||||
* types.
|
||||
* types.
|
||||
* @param time Epoch ms of the event.
|
||||
*/
|
||||
public HandlingInfo(UUID uuid, InfoType type, long time) {
|
||||
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -21,9 +21,9 @@ public class KillInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the killer.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param dead Dead entity (Mob or Player)
|
||||
* @param uuid UUID of the killer.
|
||||
* @param time Epoch ms the event occurred.
|
||||
* @param dead Dead entity (Mob or Player)
|
||||
* @param weaponName Weapon used.
|
||||
*/
|
||||
public KillInfo(UUID uuid, long time, LivingEntity dead, String weaponName) {
|
||||
|
@ -24,12 +24,12 @@ public class LoginInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
* @param loginTimes number the loginTimes should be incremented with.
|
||||
*/
|
||||
public LoginInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, Gamemode gm, int loginTimes) {
|
||||
@ -44,12 +44,12 @@ public class LoginInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor for not incrementing the loginTimes.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
* @param gm current gamemode of the player
|
||||
*/
|
||||
public LoginInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, Gamemode gm) {
|
||||
this(uuid, time, ip, banned, nickname, gm, 0);
|
||||
|
@ -22,12 +22,12 @@ public class LogoutInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param banned Is the player banned
|
||||
* @param gm current gamemode of the player
|
||||
* @param sData session that has been ended at the moment of the logout
|
||||
* event.
|
||||
* @param gm current gamemode of the player
|
||||
* @param sData session that has been ended at the moment of the logout
|
||||
* event.
|
||||
*/
|
||||
public LogoutInfo(UUID uuid, long time, boolean banned, Gamemode gm, SessionData sData) {
|
||||
super(uuid, InfoType.LOGOUT, time);
|
||||
|
@ -23,12 +23,12 @@ public class ReloadInfo extends HandlingInfo {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
* @param gm current gamemode of the player
|
||||
*/
|
||||
public ReloadInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, Gamemode gm) {
|
||||
super(uuid, InfoType.RELOAD, time);
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
@ -60,7 +60,7 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
* Calculates the TPS
|
||||
*
|
||||
* @param diff The time difference between the last run and the new run
|
||||
* @param now The time right now
|
||||
* @param now The time right now
|
||||
* @return the TPS
|
||||
*/
|
||||
private TPS calculateTPS(long diff, long now) {
|
||||
@ -84,8 +84,8 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
/**
|
||||
* Gets the TPS for Paper
|
||||
*
|
||||
* @param now The time right now
|
||||
* @param cpuUsage The usage of the CPU
|
||||
* @param now The time right now
|
||||
* @param cpuUsage The usage of the CPU
|
||||
* @param playersOnline The amount of players that are online
|
||||
* @return the TPS
|
||||
*/
|
||||
@ -104,9 +104,9 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
/**
|
||||
* Gets the TPS for a Spigot / Bukkit
|
||||
*
|
||||
* @param diff The difference between the last run and this run
|
||||
* @param now The time right now
|
||||
* @param cpuUsage The usage of the CPU
|
||||
* @param diff The difference between the last run and this run
|
||||
* @param now The time right now
|
||||
* @param cpuUsage The usage of the CPU
|
||||
* @param playersOnline The amount of players that are online
|
||||
* @return the TPS
|
||||
*/
|
||||
|
@ -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> {
|
||||
|
||||
@ -16,7 +16,7 @@ public class Container<T> {
|
||||
* Constructor for the object.
|
||||
*
|
||||
* @param object Object to place inside the container.
|
||||
* @param id UserID related to the object.
|
||||
* @param id UserID related to the object.
|
||||
*/
|
||||
public Container(T object, int id) {
|
||||
this.object = object;
|
||||
|
@ -25,9 +25,9 @@ public class DBUtils {
|
||||
* Splits a collection of objects into lists with the size defined by
|
||||
* BATCH_SIZE.
|
||||
*
|
||||
* @param <T> Object type
|
||||
* @param <T> Object type
|
||||
* @param objects Collection of the objects. // * @return Lists with max
|
||||
* size of BATCH_SIZE.
|
||||
* size of BATCH_SIZE.
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<List<T>> splitIntoBatches(Collection<T> objects) {
|
||||
@ -50,7 +50,6 @@ public class DBUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
* @param objects
|
||||
* @return
|
||||
|
@ -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,12 +103,12 @@ 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.
|
||||
* @param uuid UUID of the player.
|
||||
* @param processors Processors to call with the UserData after the fetch is
|
||||
* complete.
|
||||
* complete.
|
||||
* @throws SQLException If a database error occurs.
|
||||
*/
|
||||
public void giveUserDataToProcessors(UUID uuid, DBCallableProcessor... processors) throws SQLException {
|
||||
@ -119,16 +119,16 @@ public abstract class Database {
|
||||
* Used to give Database processors to call with UserData after they have
|
||||
* been fetched from the database.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param uuid UUID of the player.
|
||||
* @param processors Processors to call with the UserData after the fetch is
|
||||
* complete.
|
||||
* complete.
|
||||
* @throws SQLException If a database error occurs.
|
||||
*/
|
||||
public abstract void giveUserDataToProcessors(UUID uuid, Collection<DBCallableProcessor> processors) throws SQLException;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -199,7 +199,7 @@ public abstract class Database {
|
||||
* Used to set the database schema version.
|
||||
*
|
||||
* @param version Integer starting from 0, incremented by one when schema is
|
||||
* updated.
|
||||
* updated.
|
||||
* @throws SQLException If a database error occurs.
|
||||
*/
|
||||
public abstract void setVersion(int version) throws SQLException;
|
||||
@ -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.
|
||||
@ -233,7 +233,7 @@ public abstract class Database {
|
||||
* Used to save CommandUse map.
|
||||
*
|
||||
* @param data String command (key), Integer times used
|
||||
* @throws SQLException If a database error occurs.
|
||||
* @throws SQLException If a database error occurs.
|
||||
* @throws NullPointerException If the database has not initialized tables.
|
||||
*/
|
||||
public void saveCommandUse(Map<String, Integer> data) throws SQLException, NullPointerException {
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -152,11 +146,11 @@ public class GMTimesTable extends Table {
|
||||
try {
|
||||
statement = prepareStatement(
|
||||
"UPDATE " + tableName + " SET "
|
||||
+ columnSurvivalTime + "=?, "
|
||||
+ columnCreativeTime + "=?, "
|
||||
+ columnAdventureTime + "=?, "
|
||||
+ columnSpectatorTime + "=? "
|
||||
+ " WHERE (" + columnUserID + "=?)");
|
||||
+ columnSurvivalTime + "=?, "
|
||||
+ columnCreativeTime + "=?, "
|
||||
+ columnAdventureTime + "=?, "
|
||||
+ columnSpectatorTime + "=? "
|
||||
+ " WHERE (" + columnUserID + "=?)");
|
||||
statement.setInt(5, userId);
|
||||
for (int i = 0; i < gms.length; i++) {
|
||||
try {
|
||||
@ -208,11 +202,11 @@ public class GMTimesTable extends Table {
|
||||
try {
|
||||
statement = prepareStatement(
|
||||
"UPDATE " + tableName + " SET "
|
||||
+ columnSurvivalTime + "=?, "
|
||||
+ columnCreativeTime + "=?, "
|
||||
+ columnAdventureTime + "=?, "
|
||||
+ columnSpectatorTime + "=? "
|
||||
+ " WHERE (" + columnUserID + "=?)");
|
||||
+ columnSurvivalTime + "=?, "
|
||||
+ columnCreativeTime + "=?, "
|
||||
+ columnAdventureTime + "=?, "
|
||||
+ columnSpectatorTime + "=? "
|
||||
+ " WHERE (" + columnUserID + "=?)");
|
||||
boolean commitRequired = false;
|
||||
for (Integer id : gamemodeTimes.keySet()) {
|
||||
if (!savedIDs.contains(id)) {
|
||||
@ -256,12 +250,12 @@ public class GMTimesTable extends Table {
|
||||
try {
|
||||
statement = prepareStatement(
|
||||
"INSERT INTO " + tableName + " ("
|
||||
+ columnUserID + ", "
|
||||
+ columnSurvivalTime + ", "
|
||||
+ columnCreativeTime + ", "
|
||||
+ columnAdventureTime + ", "
|
||||
+ columnSpectatorTime
|
||||
+ ") VALUES (?, ?, ?, ?, ?)");
|
||||
+ columnUserID + ", "
|
||||
+ columnSurvivalTime + ", "
|
||||
+ columnCreativeTime + ", "
|
||||
+ columnAdventureTime + ", "
|
||||
+ columnSpectatorTime
|
||||
+ ") VALUES (?, ?, ?, ?, ?)");
|
||||
boolean commitRequired = false;
|
||||
for (Integer id : gamemodeTimes.keySet()) {
|
||||
statement.setInt(1, id);
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SecurityTable extends Table {
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -129,19 +126,19 @@ public class UsersTable extends Table {
|
||||
String[] queries;
|
||||
if (usingMySQL) {
|
||||
queries = new String[]{
|
||||
"ALTER TABLE " + tableName + " ADD " + columnContainsBukkitData + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnOP + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnBanned + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnName + " varchar(16) NOT NULL DEFAULT \'Unknown\'",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnRegistered + " bigint NOT NULL DEFAULT 0"
|
||||
"ALTER TABLE " + tableName + " ADD " + columnContainsBukkitData + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnOP + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnBanned + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnName + " varchar(16) NOT NULL DEFAULT \'Unknown\'",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnRegistered + " bigint NOT NULL DEFAULT 0"
|
||||
};
|
||||
} else {
|
||||
queries = new String[]{
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnContainsBukkitData + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnOP + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnBanned + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnName + " varchar(16) NOT NULL DEFAULT \'Unknown\'",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnRegistered + " bigint NOT NULL DEFAULT 0"
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnContainsBukkitData + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnOP + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnBanned + " boolean NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnName + " varchar(16) NOT NULL DEFAULT \'Unknown\'",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnRegistered + " bigint NOT NULL DEFAULT 0"
|
||||
};
|
||||
}
|
||||
for (String query : queries) {
|
||||
@ -156,14 +153,14 @@ public class UsersTable extends Table {
|
||||
String[] queries;
|
||||
if (usingMySQL) {
|
||||
queries = new String[]{
|
||||
"ALTER TABLE " + tableName + " ADD " + columnDeaths + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnMobKills + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " DROP INDEX " + columnPlayerKills
|
||||
"ALTER TABLE " + tableName + " ADD " + columnDeaths + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD " + columnMobKills + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " DROP INDEX " + columnPlayerKills
|
||||
};
|
||||
} else {
|
||||
queries = new String[]{
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnDeaths + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnMobKills + " integer NOT NULL DEFAULT 0"
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnDeaths + " integer NOT NULL DEFAULT 0",
|
||||
"ALTER TABLE " + tableName + " ADD COLUMN " + columnMobKills + " integer NOT NULL DEFAULT 0"
|
||||
};
|
||||
}
|
||||
for (String query : queries) {
|
||||
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -11,7 +11,6 @@ import java.io.FileNotFoundException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class DataRequestHandler {
|
||||
@ -43,7 +42,7 @@ public class DataRequestHandler {
|
||||
* Returns the player.html as string with replaced placeholders.
|
||||
*
|
||||
* @param uuid UUID of player, whose UserData is used to replace
|
||||
* placeholders with
|
||||
* placeholders with
|
||||
* @return The html
|
||||
*/
|
||||
public String getInspectHtml(UUID uuid) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RecentPlayersButtonsCreator {
|
||||
|
@ -17,13 +17,11 @@ import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class PunchCardGraphCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -10,12 +10,11 @@ import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class TPSGraphCreator {
|
||||
|
||||
|
||||
public static String buildScatterDataStringTPS(List<TPS> tpsData, long scale) {
|
||||
long now = MiscUtils.getTime();
|
||||
List<Point> points = tpsData.stream()
|
||||
@ -24,7 +23,7 @@ public class TPSGraphCreator {
|
||||
.collect(Collectors.toList());
|
||||
return ScatterGraphCreator.scatterGraph(points, true);
|
||||
}
|
||||
|
||||
|
||||
public static List<TPS> filterTPS(List<TPS> tpsData, long nowMinusScale) {
|
||||
return tpsData.stream()
|
||||
.filter(Objects::nonNull)
|
||||
|
@ -10,13 +10,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class CommandUseTableCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandUse
|
||||
* @return
|
||||
*/
|
||||
|
@ -10,13 +10,11 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class KillsTableCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param killData
|
||||
* @return
|
||||
*/
|
||||
|
@ -16,13 +16,11 @@ import org.bukkit.ChatColor;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class TextUI {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@ -41,19 +39,18 @@ public class TextUI {
|
||||
boolean online = d.isOnline();
|
||||
String ball = sec + " " + Phrase.BALL + main;
|
||||
return new String[]{
|
||||
sec + " " + Phrase.BALL + (banned ? ChatColor.DARK_RED + " Banned" : ter + (active ? " Active" : " Inactive")) + (online ? ChatColor.GREEN + " Online" : ChatColor.RED + " Offline"),
|
||||
ball + " Registered: " + sec + FormatUtils.formatTimeStampYear(d.getRegistered()),
|
||||
ball + " Last seen: " + sec + FormatUtils.formatTimeStamp(d.getLastPlayed()),
|
||||
ball + " Playtime: " + sec + FormatUtils.formatTimeAmount(d.getPlayTime()),
|
||||
ball + " Login times: " + sec + d.getLoginTimes(),
|
||||
ball + " Average session length: " + sec + FormatUtils.formatTimeAmount(MathUtils.averageLong(AnalysisUtils.transformSessionDataToLengths(d.getSessions()))),
|
||||
ball + " Kills: " + sec + d.getPlayerKills().size() + main + " Mobs: " + sec + d.getMobKills() + main + " Deaths: " + sec + d.getDeaths(),
|
||||
ball + " Geolocation: " + sec + d.getGeolocation()
|
||||
sec + " " + Phrase.BALL + (banned ? ChatColor.DARK_RED + " Banned" : ter + (active ? " Active" : " Inactive")) + (online ? ChatColor.GREEN + " Online" : ChatColor.RED + " Offline"),
|
||||
ball + " Registered: " + sec + FormatUtils.formatTimeStampYear(d.getRegistered()),
|
||||
ball + " Last seen: " + sec + FormatUtils.formatTimeStamp(d.getLastPlayed()),
|
||||
ball + " Playtime: " + sec + FormatUtils.formatTimeAmount(d.getPlayTime()),
|
||||
ball + " Login times: " + sec + d.getLoginTimes(),
|
||||
ball + " Average session length: " + sec + FormatUtils.formatTimeAmount(MathUtils.averageLong(AnalysisUtils.transformSessionDataToLengths(d.getSessions()))),
|
||||
ball + " Kills: " + sec + d.getPlayerKills().size() + main + " Mobs: " + sec + d.getMobKills() + main + " Deaths: " + sec + d.getDeaths(),
|
||||
ball + " Geolocation: " + sec + d.getGeolocation()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String[] getAnalysisMessages() {
|
||||
@ -72,21 +69,21 @@ public class TextUI {
|
||||
final PlayerCountPart count = d.getPlayerCountPart();
|
||||
final TPSPart tps = d.getTpsPart();
|
||||
return new String[]{
|
||||
ball + " Total Players: " + sec + count.getPlayerCount(),
|
||||
//
|
||||
ball + " Active: " + sec + activity.getActive().size()
|
||||
+ main + " Inactive: " + sec + activity.getInactive().size()
|
||||
+ main + " Single Join: " + sec + activity.getJoinedOnce().size()
|
||||
+ main + " Banned: " + sec + activity.getBans().size(),
|
||||
//
|
||||
ball + " New Players 24h: " + sec + join.get("npday") + main + " 7d: " + sec + d.get("npweek") + main + " 30d: " + sec + d.get("npmonth"),
|
||||
"",
|
||||
ball + " Total Playtime: " + sec + playtime.get("totalplaytime") + main + " Player Avg: " + sec + playtime.get("avgplaytime"),
|
||||
ball + " Average Session Length: " + sec + activity.get("sessionaverage"),
|
||||
ball + " Total Logintimes: " + sec + join.getLoginTimes(),
|
||||
ball + " Kills: " + sec + kills.getAllPlayerKills().size() + main + " Mobs: " + sec + kills.getMobKills() + main + " Deaths: " + sec + kills.getDeaths(),
|
||||
"",
|
||||
ball + " Average TPS 24h: " + sec + tps.get("averagetpsday")
|
||||
ball + " Total Players: " + sec + count.getPlayerCount(),
|
||||
//
|
||||
ball + " Active: " + sec + activity.getActive().size()
|
||||
+ main + " Inactive: " + sec + activity.getInactive().size()
|
||||
+ main + " Single Join: " + sec + activity.getJoinedOnce().size()
|
||||
+ main + " Banned: " + sec + activity.getBans().size(),
|
||||
//
|
||||
ball + " New Players 24h: " + sec + join.get("npday") + main + " 7d: " + sec + d.get("npweek") + main + " 30d: " + sec + d.get("npmonth"),
|
||||
"",
|
||||
ball + " Total Playtime: " + sec + playtime.get("totalplaytime") + main + " Player Avg: " + sec + playtime.get("avgplaytime"),
|
||||
ball + " Average Session Length: " + sec + activity.get("sessionaverage"),
|
||||
ball + " Total Logintimes: " + sec + join.getLoginTimes(),
|
||||
ball + " Kills: " + sec + kills.getAllPlayerKills().size() + main + " Mobs: " + sec + kills.getMobKills() + main + " Deaths: " + sec + kills.getDeaths(),
|
||||
"",
|
||||
ball + " Average TPS 24h: " + sec + tps.get("averagetpsday")
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.ui.webserver.response;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user