Skip to content

Commit

Permalink
[3.6.4] Merge pull request #251 from Rsl1122/3.7.0
Browse files Browse the repository at this point in the history
Main PR for 3.6.4
  • Loading branch information
AuroraLS3 authored Aug 18, 2017
2 parents 00c2524 + 3a5226a commit 53734b5
Show file tree
Hide file tree
Showing 187 changed files with 2,345 additions and 2,489 deletions.
13 changes: 0 additions & 13 deletions .idea/libraries/Maven__com_djrapitops_PlanPluginBridge_3_6_0.xml

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 9 additions & 13 deletions Plan/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>
<version>3.6.0</version>
<version>3.6.3</version>
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<testSourceDirectory>${basedir}/test</testSourceDirectory>
<defaultGoal>clean package install</defaultGoal>
<resources>
<resource>
Expand All @@ -16,6 +17,7 @@
<include>*.js</include>
<include>*.yml</include>
<include>*.html</include>
<include>*.txt</include>
</includes>
</resource>
</resources>
Expand Down Expand Up @@ -70,18 +72,9 @@
</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>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down Expand Up @@ -181,6 +174,9 @@
</dependencies>
<properties>
<sonar.language>java</sonar.language>
<sonar.jacoco.reportPaths>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
25 changes: 10 additions & 15 deletions Plan/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<packaging>jar</packaging>
<repositories>
<repository>
Expand All @@ -28,14 +28,14 @@
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>abstract-plugin-framework</artifactId>
<version>2.0.3</version>
<version>2.0.4</version>
<scope>compile</scope>
</dependency>
<!-- SoftDepended Plugins-->
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId>
<version>3.6.0</version>
<version>3.7.0</version>
<scope>compile</scope>
</dependency>
<!-- -->
Expand Down Expand Up @@ -100,6 +100,7 @@
<defaultGoal>clean package install</defaultGoal>
<finalName>${project.name}</finalName>
<sourceDirectory>${basedir}/src</sourceDirectory>
<testSourceDirectory>${basedir}/test</testSourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
Expand Down Expand Up @@ -165,18 +166,9 @@
</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>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -202,5 +194,8 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPaths>
</properties>
</project>
44 changes: 18 additions & 26 deletions Plan/src/main/java/com/djrapitops/plan/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,32 @@ public static void debug(String message) {
Plan.getInstance().getPluginLogger().debug(message);
}


/**
* Used for logging larger debug complexes.
*
* @param task complex this debug message is a part of.
* @param message message
* @param message Single message to add to the debug log.
* @return full debug complex so far.
*/
public static DebugInfo debug(String task, String message) {
return getDebug(task).addLine(message, MiscUtils.getTime());
}

/**
* Used for logging larger debug complexes.
*
* @param task complex this debug message is a part of.
* @param messages All messages to add to the debug log.
* @return full debug complex so far.
*/
@SafeVarargs
public static DebugInfo debug(String task, String... messages) {
DebugInfo debug = getDebug(task);
debug.addLine(message, MiscUtils.getTime());
long time = MiscUtils.getTime();
for (String message : messages) {
debug.addLine(message, time);
}
return debug;
}

Expand Down Expand Up @@ -119,28 +135,4 @@ public static void toLog(String source, Throwable e) {
public static void toLog(String source, Collection<Throwable> e) {
Plan.getInstance().getPluginLogger().toLog(source, e);
}

/**
* Logs a message to the a given file with a timestamp.
*
* @param message Message to log to Errors.txt [timestamp] Message
* @param filename Name of the file to write to.
* @deprecated Should no longer be used, may break other log handling mechanisms.
* If exception requires additional information it should be placed in the source string.
*/
@Deprecated
public static void toLog(String message, String filename) {
Plan.getInstance().getPluginLogger().toLog(message, filename);
}

/**
* Used to get the name for the error log file.
*
* @return Name of the error log file.
* @deprecated Should no longer be used, Errors.txt is handled by a separate class.
*/
@Deprecated
public static String getErrorsFilename() {
return Plan.getInstance().getPluginLogger().getErrorsFilename();
}
}
45 changes: 19 additions & 26 deletions Plan/src/main/java/com/djrapitops/plan/Plan.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Plan extends BukkitPlugin<Plan> {
* Plan and the instance is null.
* @throws NoClassDefFoundError If Plan is not installed.
*/
public static API getPlanAPI() throws IllegalStateException, NoClassDefFoundError {
public static API getPlanAPI() throws NoClassDefFoundError {
Plan instance = getInstance();
if (instance == null) {
throw new IllegalStateException("Plugin not enabled properly, Singleton instance is null.");
Expand Down Expand Up @@ -114,15 +114,7 @@ public void onEnable() {
// Sets the Required variables for BukkitPlugin instance to function correctly
setInstance(this);
super.setDebugMode(Settings.DEBUG.toString());
try {
ChatColor mainColor = ChatColor.getByChar(Settings.COLOR_MAIN.toString().charAt(1));
ChatColor secColor = ChatColor.getByChar(Settings.COLOR_SEC.toString().charAt(1));
ChatColor terColor = ChatColor.getByChar(Settings.COLOR_TER.toString().charAt(1));
super.setColorScheme(new ColorScheme(mainColor, secColor, terColor));
} catch (Exception e) {
Log.infoColor(ChatColor.RED + "Customization, Chat colors set-up wrong, using defaults.");
super.setColorScheme(new ColorScheme(ChatColor.DARK_GREEN, ChatColor.GRAY, ChatColor.WHITE));
}
initColorScheme();
super.setLogPrefix("[Plan]");
super.setUpdateCheckUrl("https://raw.githubusercontent.com/Rsl1122/Plan-PlayerAnalytics/master/Plan/src/main/resources/plugin.yml");
super.setUpdateUrl("https://www.spigotmc.org/resources/plan-player-analytics.32536/");
Expand All @@ -147,7 +139,7 @@ public void onEnable() {

Benchmark.start("Init Database");
Log.info(Locale.get(Msg.ENABLE_DB_INIT).toString());
if (Check.ErrorIfFalse(initDatabase(), Locale.get(Msg.ENABLE_DB_FAIL_DISABLE_INFO).toString())) {
if (Check.errorIfFalse(initDatabase(), Locale.get(Msg.ENABLE_DB_FAIL_DISABLE_INFO).toString())) {
Log.info(Locale.get(Msg.ENABLE_DB_INFO).parse(db.getConfigName()));
} else {
disablePlugin();
Expand Down Expand Up @@ -227,6 +219,18 @@ public void onEnable() {
}
}

private final void initColorScheme() {
try {
ChatColor mainColor = ChatColor.getByChar(Settings.COLOR_MAIN.toString().charAt(1));
ChatColor secColor = ChatColor.getByChar(Settings.COLOR_SEC.toString().charAt(1));
ChatColor terColor = ChatColor.getByChar(Settings.COLOR_TER.toString().charAt(1));
super.setColorScheme(new ColorScheme(mainColor, secColor, terColor));
} catch (Exception e) {
Log.infoColor(ChatColor.RED + "Customization, Chat colors set-up wrong, using defaults.");
super.setColorScheme(new ColorScheme(ChatColor.DARK_GREEN, ChatColor.GRAY, ChatColor.WHITE));
}
}

/**
* Disables the plugin.
* <p>
Expand Down Expand Up @@ -261,7 +265,7 @@ public void onDisable() {

getPluginLogger().endAllDebugs();
Log.info(Locale.get(Msg.DISABLED).toString());
Locale.unload();
// Locale.unload();
}

private void registerListeners() {
Expand Down Expand Up @@ -316,10 +320,10 @@ public boolean initDatabase() {
return false;
}

return Check.ErrorIfFalse(db.init(), Locale.get(Msg.ENABLE_DB_FAIL_DISABLE_INFO).toString());
return Check.errorIfFalse(db.init(), Locale.get(Msg.ENABLE_DB_FAIL_DISABLE_INFO).toString());
}

private void startAnalysisRefreshTask(int everyXMinutes) throws IllegalStateException {
private void startAnalysisRefreshTask(int everyXMinutes) {
Benchmark.start("Schedule PeriodicAnalysisTask");
if (everyXMinutes <= 0) {
return;
Expand All @@ -336,7 +340,7 @@ public void run() {
Benchmark.stop("Schedule PeriodicAnalysisTask");
}

private void startBootAnalysisTask() throws IllegalStateException {
private void startBootAnalysisTask() {
Benchmark.start("Schedule boot analysis task");
String bootAnalysisMsg = Locale.get(Msg.ENABLE_BOOT_ANALYSIS_INFO).toString();
String bootAnalysisRunMsg = Locale.get(Msg.ENABLE_BOOT_ANALYSIS_RUN_INFO).toString();
Expand Down Expand Up @@ -449,15 +453,4 @@ public int getBootAnalysisTaskID() {
public ServerVariableHolder getVariable() {
return serverVariableHolder;
}

/**
* Old method for getting the API.
*
* @return the Plan API.
* @deprecated Use Plan.getPlanAPI() (static method) instead.
*/
@Deprecated
public API getAPI() {
return api;
}
}
5 changes: 5 additions & 0 deletions Plan/src/main/java/com/djrapitops/plan/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public enum Settings {
PROCESS_GET_LIMIT("Settings.Cache.Processing.GetLimit"),
PROCESS_SAVE_LIMIT("Settings.Cache.Processing.SaveLimit"),
PROCESS_CLEAR_LIMIT("Settings.Cache.Processing.ClearLimit"),
TPS_GRAPH_HIGH("Customization.Colors.HTML.TPSGraph.TPSHigh"),
TPS_GRAPH_MED("Customization.Colors.HTML.TPSGraph.TPSMedium"),
// String
DEBUG("Settings.Debug"),
ALTERNATIVE_IP("Settings.WebServer.AlternativeIP"),
Expand Down Expand Up @@ -73,6 +75,9 @@ public enum Settings {
HCOLOR_SEC("Customization.Colors.HTML.UI.Secondary"),
HCOLOR_TER("Customization.Colors.HTML.UI.Tertiary"),
HCOLOR_TER_DARK("Customization.Colors.HTML.UI.TertiaryDark"),
HCOLOR_TPS_HIGH("Customization.Colors.HTML.TPSGraph.TPSHighCol"),
HCOLOR_TPS_MED("Customization.Colors.HTML.TPSGraph.TPSMediumCol"),
HCOLOR_TPS_LOW("Customization.Colors.HTML.TPSGraph.TPSLowCol"),
HCOLOR_ACT_ONL("Customization.Colors.HTML.ActivityGraph.OnlinePlayers"),
HCOLOR_ACTP_ACT("Customization.Colors.HTML.ActivityPie.Active"),
HCOLOR_ACTP_BAN("Customization.Colors.HTML.ActivityPie.Banned"),
Expand Down
Loading

0 comments on commit 53734b5

Please sign in to comment.