Moved to Maven project, added Chart4j to render graphs
- Moved to Maven project to solve dependencies - > Added Chart4j (Google Charts) to render graphs and pie charts. - More AnalysisUtils - Added GMTimesChartCreator
This commit is contained in:
parent
15078df7d3
commit
88283969b1
|
@ -6,4 +6,5 @@
|
|||
/Plan Lite/nbproject/private/
|
||||
/Plan Advanced/build/
|
||||
/Plan Advanced/dist/
|
||||
/Plan Advanced/nbproject/private/
|
||||
/Plan Advanced/nbproject/private/
|
||||
/Plan/target/
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Plan" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Plan.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Plan-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
|
@ -1,2 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +0,0 @@
|
|||
build.xml.data.CRC32=4835e233
|
||||
build.xml.script.CRC32=f09b6a05
|
||||
build.xml.stylesheet.CRC32=8064a381@1.79.1.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=4835e233
|
||||
nbproject/build-impl.xml.script.CRC32=8797a4da
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
|
|
@ -1,80 +0,0 @@
|
|||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=Plan
|
||||
application.vendor=Rsl1122
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Plan.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.craftbukkit-1.11.2.jar=D:\\Minecraft Servers\\Buildtools\\craftbukkit-1.11.2.jar
|
||||
file.reference.PlanLite.jar=..\\Plan Lite\\dist\\PlanLite.jar
|
||||
includes=**
|
||||
jar.compress=true
|
||||
javac.classpath=\
|
||||
${file.reference.craftbukkit-1.11.2.jar}:\
|
||||
${file.reference.PlanLite.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.8
|
||||
javac.target=1.8
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=player.analytics.main.Main
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Plan</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
package com.djrapitops.plan.utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class AnalysisUtils {
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
<?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>2.0.0</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-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.jfree:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.jfree</pattern>
|
||||
<shadedPattern>com.djrapitops.plan.jfree</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>plan.lite</artifactId>
|
||||
<version>1.6.3</version>
|
||||
<scope>provided</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>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>Plan</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>plan.lite</artifactId>
|
||||
<version>1.6.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.charts4j</groupId>
|
||||
<artifactId>charts4j</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<finalName>${project.name}</finalName>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>*.html</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.jfree:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.jfree</pattern>
|
||||
<shadedPattern>com.djrapitops.plan.jfree</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
</project>
|
|
@ -21,6 +21,7 @@ import org.bukkit.OfflinePlayer;
|
|||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
|
||||
public class InspectCommand extends SubCommand {
|
||||
|
|
@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
|
|||
import static org.bukkit.Bukkit.getPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import static org.bukkit.Bukkit.getPlayer;
|
||||
|
||||
/**
|
||||
*
|
|
@ -67,7 +67,7 @@ public class ActivityHandler {
|
|||
Player player = event.getPlayer();
|
||||
data.updateBanned(player);
|
||||
data.setLoginTimes(data.getLoginTimes() + 1);
|
||||
handler.getLocationHandler().addLocation(player.getUniqueId(), player.getLocation());
|
||||
// handler.getLocationHandler().addLocation(player.getUniqueId(), player.getLocation());
|
||||
}
|
||||
|
||||
/**
|
|
@ -49,4 +49,6 @@ public abstract class Database {
|
|||
public abstract ServerData getNewestServerData();
|
||||
|
||||
public abstract void close();
|
||||
|
||||
public abstract HashMap<Long, ServerData> getServerDataHashMap();
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.bukkit.Location;
|
|||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
|
||||
public abstract class SQLDB extends Database {
|
||||
|
||||
|
@ -184,7 +185,7 @@ public abstract class SQLDB extends Database {
|
|||
+ "FOREIGN KEY(" + locationColumnUserID + ") REFERENCES " + userName + "(" + userColumnID + ")"
|
||||
+ ")"
|
||||
);
|
||||
*/
|
||||
*/
|
||||
query("CREATE TABLE IF NOT EXISTS " + gamemodetimesName + " ("
|
||||
+ gamemodetimesColumnUserID + " integer NOT NULL, "
|
||||
+ gamemodetimesColumnSurvivalTime + " bigint NOT NULL, "
|
||||
|
@ -344,12 +345,12 @@ public abstract class SQLDB extends Database {
|
|||
set.close();
|
||||
statement.close();
|
||||
String userId = "" + getUserId(uuid.toString());
|
||||
|
||||
|
||||
/* Locations Removed from Build 2.0.0 for performance reasons.
|
||||
statement = connection.prepareStatement("SELECT * FROM " + locationName + " WHERE UPPER(" + locationColumnUserID + ") LIKE UPPER(?)");
|
||||
statement.setString(1, userId);
|
||||
set = statement.executeQuery();
|
||||
|
||||
/* Locations Removed from Build 2.0.0 for performance reasons.
|
||||
List<Location> locations = new ArrayList<>();
|
||||
while (set.next()) {
|
||||
locations.add(new Location(worlds.get(set.getString(locationColumnWorld)), set.getInt(locationColumnCoordinatesX), 0, set.getInt(locationColumnCoordinatesZ)));
|
||||
|
@ -363,7 +364,7 @@ public abstract class SQLDB extends Database {
|
|||
} else {
|
||||
data.setLocation(locations.get(locations.size() - 1));
|
||||
}
|
||||
*/
|
||||
*/
|
||||
data.setLocation(new Location(defaultWorld, 0, 0, 0));
|
||||
|
||||
statement = connection.prepareStatement("SELECT * FROM " + nicknamesName + " WHERE UPPER(" + nicknamesColumnUserID + ") LIKE UPPER(?)");
|
||||
|
@ -414,6 +415,27 @@ public abstract class SQLDB extends Database {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Long, ServerData> getServerDataHashMap() {
|
||||
HashMap<String, Integer> commandUse = getCommandUse();
|
||||
HashMap<Long, ServerData> rawServerData = new HashMap<>();
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + serverdataName
|
||||
+ " ORDER BY " + serverdataColumnDate + " ASC");
|
||||
|
||||
ResultSet set = statement.executeQuery();
|
||||
while (set.next()) {
|
||||
int newPlayers = set.getInt(serverdataColumnNewPlayers);
|
||||
rawServerData.put(set.getLong(serverdataColumnDate), new ServerData(commandUse, newPlayers));
|
||||
}
|
||||
set.close();
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
plugin.logToFile("DATABASE-SQLDB-GetServerData\n" + e + "\n" + e.getCause());
|
||||
}
|
||||
return rawServerData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerData getNewestServerData() {
|
||||
HashMap<String, Integer> commandUse = getCommandUse();
|
||||
|
@ -521,7 +543,7 @@ public abstract class SQLDB extends Database {
|
|||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
*/
|
||||
*/
|
||||
statement = connection.prepareStatement("DELETE FROM " + nicknamesName + " WHERE UPPER(" + nicknamesColumnUserID + ") LIKE UPPER(?)");
|
||||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
|
@ -653,7 +675,7 @@ public abstract class SQLDB extends Database {
|
|||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
public void saveNickList(int userId, HashSet<String> names) {
|
|
@ -5,10 +5,12 @@ import com.djrapitops.plan.Plan;
|
|||
import com.djrapitops.plan.data.UserData;
|
||||
import com.djrapitops.plan.data.cache.AnalysisCacheHandler;
|
||||
import com.djrapitops.plan.data.cache.InspectCacheHandler;
|
||||
import com.djrapitops.plan.utilities.AnalysisUtils;
|
||||
import com.djrapitops.plan.utilities.FormatUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,7 +50,18 @@ public class DataRequestHandler {
|
|||
int age = data.getDemData().getAge();
|
||||
replaceMap.put("%age%", (age != -1) ? ""+age:"Not known");
|
||||
replaceMap.put("%gender%", ""+data.getDemData().getGender().name().toLowerCase());
|
||||
replaceMap.put("%gmpiechart%", "Piechart soon");
|
||||
HashMap<GameMode, Long> gmTimes = data.getGmTimes();
|
||||
replaceMap.put("%gmpiechart%", AnalysisUtils.createPieChart(gmTimes, data.getUuid().toString()));
|
||||
long gmZero = gmTimes.get(GameMode.SURVIVAL);
|
||||
long gmOne = gmTimes.get(GameMode.CREATIVE);
|
||||
long gmTwo = gmTimes.get(GameMode.ADVENTURE);
|
||||
long gmThree = gmTimes.get(GameMode.SPECTATOR);
|
||||
long total = gmZero + gmOne + gmTwo + gmThree;
|
||||
replaceMap.put("%gm0%", FormatUtils.formatTimeAmount(""+gmZero));
|
||||
replaceMap.put("%gm1%", FormatUtils.formatTimeAmount(""+gmOne));
|
||||
replaceMap.put("%gm2%", FormatUtils.formatTimeAmount(""+gmTwo));
|
||||
replaceMap.put("%gm3%", FormatUtils.formatTimeAmount(""+gmThree));
|
||||
replaceMap.put("%gmtotal%", FormatUtils.formatTimeAmount(""+total));
|
||||
replaceMap.put("%ips%", data.getIps().toString());
|
||||
replaceMap.put("%nicknames%", data.getNicknames().toString());
|
||||
replaceMap.put("%name%", data.getName());
|
|
@ -0,0 +1,37 @@
|
|||
package com.djrapitops.plan.ui.graphs;
|
||||
|
||||
import com.googlecode.charts4j.Color;
|
||||
import com.googlecode.charts4j.GCharts;
|
||||
import com.googlecode.charts4j.PieChart;
|
||||
import com.googlecode.charts4j.Slice;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class GMTimesPieChartCreator {
|
||||
|
||||
public static String createChart(HashMap<GameMode, Long> gmTimes, String uuid) {
|
||||
|
||||
long gmZero = gmTimes.get(GameMode.SURVIVAL);
|
||||
long gmOne = gmTimes.get(GameMode.CREATIVE);
|
||||
long gmTwo = gmTimes.get(GameMode.ADVENTURE);
|
||||
long gmThree = gmTimes.get(GameMode.SPECTATOR);
|
||||
|
||||
long total = gmZero + gmOne + gmTwo + gmThree;
|
||||
|
||||
Slice s1 = Slice.newSlice((int) (gmZero / total), Color.newColor("951800"), "Survival", "Survival");
|
||||
Slice s2 = Slice.newSlice((int) (gmOne / total), Color.newColor("01A1DB"), "Creative", "Creative");
|
||||
Slice s3 = Slice.newSlice((int) (gmThree / total), Color.newColor("FFFF33"), "Adventure", "Adventure");
|
||||
Slice s4 = Slice.newSlice((int) (gmTwo / total), Color.newColor("228B22"), "Spectator", "Spectator");
|
||||
|
||||
PieChart refChart = GCharts.newPieChart(s1, s2, s3, s4);
|
||||
refChart.setSize(500, 150);
|
||||
refChart.setThreeD(true);
|
||||
String refURL = refChart.toURLString();
|
||||
return refURL;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,9 +2,11 @@ package com.djrapitops.plan.utilities;
|
|||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.data.AnalysisData;
|
||||
import com.djrapitops.plan.data.ServerData;
|
||||
import com.djrapitops.plan.data.UserData;
|
||||
import com.djrapitops.plan.data.cache.InspectCacheHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -17,6 +19,7 @@ public class Analysis {
|
|||
private AnalysisData data;
|
||||
private InspectCacheHandler inspectCache;
|
||||
private final List<UserData> rawData;
|
||||
private HashMap<Long, ServerData> rawServerData;
|
||||
private final List<UUID> added;
|
||||
|
||||
public Analysis(Plan plugin) {
|
||||
|
@ -31,7 +34,7 @@ public class Analysis {
|
|||
added.clear();
|
||||
plugin.log("Analysis | Beginning analysis of user data..");
|
||||
OfflinePlayer[] offlinePlayers = Bukkit.getServer().getOfflinePlayers();
|
||||
List<UUID> uuids = new ArrayList<>();
|
||||
final List<UUID> uuids = new ArrayList<>();
|
||||
for (OfflinePlayer p : offlinePlayers) {
|
||||
UUID uuid = p.getUniqueId();
|
||||
if (plugin.getDB().wasSeenBefore(uuid)) {
|
||||
|
@ -60,6 +63,7 @@ public class Analysis {
|
|||
}
|
||||
});
|
||||
}
|
||||
rawServerData = plugin.getDB().getServerDataHashMap();
|
||||
plugin.log("Analysis | Data Fetched, beginning Analysis of data..");
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.djrapitops.plan.utilities;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.ui.graphs.GMTimesPieChartCreator;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.GameMode;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class AnalysisUtils {
|
||||
|
||||
public static String createPieChart(HashMap<GameMode, Long> gmTimes, String uuid) {
|
||||
String url = GMTimesPieChartCreator.createChart(gmTimes, uuid);
|
||||
return "<img src=\"" + url + "\">";
|
||||
}
|
||||
|
||||
}
|
|
@ -78,7 +78,7 @@ public class FormatUtils {
|
|||
returnValue += seconds + "s";
|
||||
}
|
||||
if (returnValue.isEmpty()) {
|
||||
returnValue += "< 1s";
|
||||
returnValue += "0s";
|
||||
}
|
||||
return returnValue;
|
||||
}
|
|
@ -32,7 +32,8 @@
|
|||
<td style="margin-left: 3px; margin-right: auto;
|
||||
border-style: groove; border-width: 3px; border-radius: 12px;
|
||||
box-shadow: 5px 5px 4px 0px #888888;">
|
||||
<p>%gmpiechart%</p>
|
||||
%gmpiechart%
|
||||
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3% | Total: %gmtotal%</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
Loading…
Reference in New Issue