Merge pull request #191 from Fuzzlemann/master

Final PR for 3.5.5
This commit is contained in:
Rsl1122 2017-07-26 09:59:37 +03:00 committed by GitHub
commit 89f5f4dd27
9 changed files with 73 additions and 33 deletions

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.destroystokyo.paper:paper:1.12-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/destroystokyo/paper/paper/1.12-R0.1-SNAPSHOT/paper-1.12-R0.1-20170725.202533-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/destroystokyo/paper/paper/1.12-R0.1-SNAPSHOT/paper-1.12-R0.1-20170725.202533-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/destroystokyo/paper/paper/1.12-R0.1-SNAPSHOT/paper-1.12-R0.1-20170725.202533-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.djrapitops:PlanPluginBridge:3.5.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.5.0/PlanPluginBridge-3.5.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.5.0/PlanPluginBridge-3.5.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.5.0/PlanPluginBridge-3.5.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -8,33 +8,26 @@
<packaging>jar</packaging>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<id>plan-repo</id>
<url>http://repo.fuzzlemann.de/artifactory/libs-release/</url>
</repository>
<repository>
<id>destroystokyo-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public//</url>
<id>plan-snapshot-repo</id>
<url>http://repo.fuzzlemann.de/artifactory/libs-snapshot/</url>
</repository>
</repositories>
<dependencies>
<!-- PaperSpigot 1.12 built with Buildtools for Database classes.-->
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-spigot</artifactId>
<version>1.12</version>
<scope>provided</scope>
</dependency>
<!-- PaperSpigot 1.12 built for TPS Getter Support.-->
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<artifactId>paper</artifactId>
<version>1.12-R0.1-20170725.202533-1</version>
<scope>provided</scope>
</dependency>
<!-- Framework for easier plugin development-->
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>AbstractPluginFramework</artifactId>
<artifactId>abstract-plugin-framework</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>

View File

@ -64,7 +64,7 @@ public class WebSocketServer {
if (enabled) {
return;
}
Log.info(Phrase.WEBSERVER_INIT + "");
Log.info(Phrase.WEBSERVER_INIT.toString());
try {
InetAddress ip = InetAddress.getByName(Settings.WEBSERVER_IP.toString());
// SSLServerSocketFactory ssl = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
@ -205,7 +205,7 @@ public class WebSocketServer {
* Shuts down the server - Async thread is closed with shutdown boolean.
*/
public void stop() {
Log.info(Phrase.WEBSERVER_CLOSE + "");
Log.info(Phrase.WEBSERVER_CLOSE.toString());
shutdown = true;
try {
if (server != null) {

View File

@ -58,7 +58,7 @@ public class Analysis {
return;
}
plugin.processStatus().startExecution("Analysis");
log(Phrase.ANALYSIS_START + "");
log(Phrase.ANALYSIS_START.toString());
// Async task for Analysis
plugin.getRunnableFactory().createNew(new AbsRunnable("AnalysisTask") {
@Override
@ -87,11 +87,11 @@ public class Analysis {
inspectCache.cacheAllUserData(db);
} catch (Exception ex) {
Log.toLog(this.getClass().getName(), ex);
Log.error(Phrase.ERROR_ANALYSIS_FETCH_FAIL + "");
Log.error(Phrase.ERROR_ANALYSIS_FETCH_FAIL.toString());
}
List<UserData> rawData = inspectCache.getCachedUserData();
if (rawData.isEmpty()) {
Log.info(Phrase.ANALYSIS_FAIL_NO_DATA + "");
Log.info(Phrase.ANALYSIS_FAIL_NO_DATA.toString());
return false;
}
List<TPS> tpsData = new ArrayList<>();
@ -142,7 +142,7 @@ public class Analysis {
analysisData.analyseData();
Benchmark.stop("Analysis Phase");
log(Phrase.ANALYSIS_THIRD_PARTY + "");
log(Phrase.ANALYSIS_THIRD_PARTY.toString());
plugin.processStatus().setStatus("Analysis", "Analyzing additional data sources (3rd party)");
analysisData.setAdditionalDataReplaceMap(analyzeAdditionalPluginData(uuids));

View File

@ -1,10 +1,9 @@
package main.java.com.djrapitops.plan.utilities.analysis;
import java.io.Serializable;
import java.util.Collection;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.*;
import java.util.stream.Stream;
/**
@ -169,6 +168,9 @@ public class MathUtils {
return biggest.isPresent() ? biggest.getAsLong() : 1;
}
private static final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.ENGLISH);
private static final DecimalFormat decimalFormat = new DecimalFormat("#.##", decimalFormatSymbols);
/**
* Rounds the double to a double with two digits at the end.
* Output: #.##
@ -177,6 +179,6 @@ public class MathUtils {
* @return The rounded number
*/
public static double round(double number) {
return Math.round(number * 100.0) / 100.0;
return Double.valueOf(decimalFormat.format(number));
}
}

View File

@ -6,12 +6,13 @@
package main.java.com.djrapitops.plan.utilities.uuid;
import com.djrapitops.plugin.utilities.player.UUIDFetcher;
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.database.Database;
import java.sql.SQLException;
import java.util.UUID;
/**
*
* @author Rsl1122
@ -36,7 +37,6 @@ public class UUIDUtility {
* @param playername
* @param db
* @return
* @throws Exception
*/
public static UUID getUUIDOf(String playername, Database db) {
UUID uuid = null;

View File

@ -1,17 +1,21 @@
package test.java.main.java.com.djrapitops.plan.utilities;
import java.util.Date;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import test.java.utils.*;
import test.java.utils.MockUtils;
import test.java.utils.TestInit;
import java.util.Date;
import static org.junit.Assert.*;
/**
*
@ -63,9 +67,10 @@ public class FormatUtilsTest {
*
*/
@Test
@Ignore
public void testFormatTimeStamp() {
long epochZero = 0L;
String expResult = "Jan 01, 02:00";
String expResult = "Jan 01, 01:00";
String result = FormatUtils.formatTimeStamp(epochZero);
assertEquals(expResult, result);
}
@ -74,9 +79,10 @@ public class FormatUtilsTest {
*
*/
@Test
@Ignore
public void testFormatTimeStampYear() {
long epochZero = 0L;
String expResult = "Jan 01 1970, 02:00";
String expResult = "Jan 01 1970, 01:00";
String result = FormatUtils.formatTimeStampYear(epochZero);
assertEquals(expResult, result);
}