mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-09 20:31:38 +01:00
Fix #228 Fix NPE due to plugin variable not being initialized when SubCommand super constructor is called. (Calls addHelp)
This commit is contained in:
parent
3925a99ead
commit
c8126cf7d3
@ -1,13 +1,13 @@
|
|||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.1">
|
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.2">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.2/abstract-plugin-framework-2.0.2.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.2/abstract-plugin-framework-2.0.2-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.2/abstract-plugin-framework-2.0.2-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
@ -111,105 +111,111 @@ public class Plan extends BukkitPlugin<Plan> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Sets the Required variables for BukkitPlugin instance to function correctly
|
try {
|
||||||
setInstance(this);
|
// Sets the Required variables for BukkitPlugin instance to function correctly
|
||||||
super.setDebugMode(Settings.DEBUG.toString());
|
setInstance(this);
|
||||||
super.setColorScheme(new ColorScheme(Phrase.COLOR_MAIN.color(), Phrase.COLOR_SEC.color(), Phrase.COLOR_TER.color()));
|
super.setDebugMode(Settings.DEBUG.toString());
|
||||||
super.setLogPrefix("[Plan]");
|
super.setColorScheme(new ColorScheme(Phrase.COLOR_MAIN.color(), Phrase.COLOR_SEC.color(), Phrase.COLOR_TER.color()));
|
||||||
super.setUpdateCheckUrl("https://raw.githubusercontent.com/Rsl1122/Plan-PlayerAnalytics/master/Plan/src/main/resources/plugin.yml");
|
super.setLogPrefix("[Plan]");
|
||||||
super.setUpdateUrl("https://www.spigotmc.org/resources/plan-player-analytics.32536/");
|
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/");
|
||||||
|
|
||||||
// Initializes BukkitPlugin variables, Checks version & Logs the debug header
|
// Initializes BukkitPlugin variables, Checks version & Logs the debug header
|
||||||
super.onEnableDefaultTasks();
|
super.onEnableDefaultTasks();
|
||||||
|
|
||||||
Benchmark.start("Enable");
|
Benchmark.start("Enable");
|
||||||
|
|
||||||
initLocale();
|
initLocale();
|
||||||
Benchmark.start("Reading server variables");
|
Benchmark.start("Reading server variables");
|
||||||
serverVariableHolder = new ServerVariableHolder(getServer());
|
serverVariableHolder = new ServerVariableHolder(getServer());
|
||||||
Benchmark.stop("Enable", "Reading server variables");
|
Benchmark.stop("Enable", "Reading server variables");
|
||||||
|
|
||||||
Benchmark.start("Copy default config");
|
Benchmark.start("Copy default config");
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
getConfig().options().header(Phrase.CONFIG_HEADER.toString());
|
getConfig().options().header(Phrase.CONFIG_HEADER.toString());
|
||||||
saveConfig();
|
saveConfig();
|
||||||
Benchmark.stop("Enable", "Copy default config");
|
Benchmark.stop("Enable", "Copy default config");
|
||||||
|
|
||||||
Benchmark.start("Init Database");
|
Benchmark.start("Init Database");
|
||||||
Log.info(Phrase.DB_INIT.toString());
|
Log.info(Phrase.DB_INIT.toString());
|
||||||
if (Check.ErrorIfFalse(initDatabase(), Phrase.DB_FAILURE_DISABLE.toString())) {
|
if (Check.ErrorIfFalse(initDatabase(), Phrase.DB_FAILURE_DISABLE.toString())) {
|
||||||
Log.info(Phrase.DB_ESTABLISHED.parse(db.getConfigName()));
|
Log.info(Phrase.DB_ESTABLISHED.parse(db.getConfigName()));
|
||||||
} else {
|
} else {
|
||||||
disablePlugin();
|
disablePlugin();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
Benchmark.stop("Enable", "Init Database");
|
|
||||||
|
|
||||||
Benchmark.start("Init DataCache");
|
|
||||||
this.handler = new DataCacheHandler(this);
|
|
||||||
this.inspectCache = new InspectCacheHandler(this);
|
|
||||||
this.analysisCache = new AnalysisCacheHandler(this);
|
|
||||||
Benchmark.stop("Enable", "Init DataCache");
|
|
||||||
|
|
||||||
super.getRunnableFactory().createNew(new TPSCountTimer(this)).runTaskTimer(1000, TimeAmount.SECOND.ticks());
|
|
||||||
registerListeners();
|
|
||||||
|
|
||||||
this.api = new API(this);
|
|
||||||
Benchmark.start("Handle Reload");
|
|
||||||
handler.handleReload();
|
|
||||||
Benchmark.stop("Enable", "Handle Reload");
|
|
||||||
|
|
||||||
Benchmark.start("Analysis refresh task registration");
|
|
||||||
// Analysis refresh settings
|
|
||||||
boolean bootAnalysisIsEnabled = Settings.ANALYSIS_REFRESH_ON_ENABLE.isTrue();
|
|
||||||
int analysisRefreshMinutes = Settings.ANALYSIS_AUTO_REFRESH.getNumber();
|
|
||||||
boolean analysisRefreshTaskIsEnabled = analysisRefreshMinutes > 0;
|
|
||||||
|
|
||||||
// Analysis refresh tasks
|
|
||||||
if (bootAnalysisIsEnabled) {
|
|
||||||
startBootAnalysisTask();
|
|
||||||
}
|
|
||||||
if (analysisRefreshTaskIsEnabled) {
|
|
||||||
startAnalysisRefreshTask(analysisRefreshMinutes);
|
|
||||||
}
|
|
||||||
Benchmark.stop("Enable", "Analysis refresh task registration");
|
|
||||||
|
|
||||||
Benchmark.start("WebServer Initialization");
|
|
||||||
// Data view settings
|
|
||||||
boolean webserverIsEnabled = Settings.WEBSERVER_ENABLED.isTrue();
|
|
||||||
boolean usingAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
|
||||||
boolean usingAlternativeUI = Settings.USE_ALTERNATIVE_UI.isTrue();
|
|
||||||
boolean hasDataViewCapability = usingAlternativeIP || usingAlternativeUI || webserverIsEnabled;
|
|
||||||
|
|
||||||
if (webserverIsEnabled) {
|
|
||||||
uiServer = new WebServer(this);
|
|
||||||
uiServer.initServer();
|
|
||||||
|
|
||||||
if (!uiServer.isEnabled()) {
|
|
||||||
Log.error("WebServer was not successfully initialized.");
|
|
||||||
}
|
}
|
||||||
|
Benchmark.stop("Enable", "Init Database");
|
||||||
|
|
||||||
setupFilter();
|
Benchmark.start("Init DataCache");
|
||||||
} else if (!hasDataViewCapability) {
|
this.handler = new DataCacheHandler(this);
|
||||||
Log.infoColor(Phrase.ERROR_NO_DATA_VIEW.toString());
|
this.inspectCache = new InspectCacheHandler(this);
|
||||||
|
this.analysisCache = new AnalysisCacheHandler(this);
|
||||||
|
Benchmark.stop("Enable", "Init DataCache");
|
||||||
|
|
||||||
|
super.getRunnableFactory().createNew(new TPSCountTimer(this)).runTaskTimer(1000, TimeAmount.SECOND.ticks());
|
||||||
|
registerListeners();
|
||||||
|
|
||||||
|
this.api = new API(this);
|
||||||
|
Benchmark.start("Handle Reload");
|
||||||
|
handler.handleReload();
|
||||||
|
Benchmark.stop("Enable", "Handle Reload");
|
||||||
|
|
||||||
|
Benchmark.start("Analysis refresh task registration");
|
||||||
|
// Analysis refresh settings
|
||||||
|
boolean bootAnalysisIsEnabled = Settings.ANALYSIS_REFRESH_ON_ENABLE.isTrue();
|
||||||
|
int analysisRefreshMinutes = Settings.ANALYSIS_AUTO_REFRESH.getNumber();
|
||||||
|
boolean analysisRefreshTaskIsEnabled = analysisRefreshMinutes > 0;
|
||||||
|
|
||||||
|
// Analysis refresh tasks
|
||||||
|
if (bootAnalysisIsEnabled) {
|
||||||
|
startBootAnalysisTask();
|
||||||
|
}
|
||||||
|
if (analysisRefreshTaskIsEnabled) {
|
||||||
|
startAnalysisRefreshTask(analysisRefreshMinutes);
|
||||||
|
}
|
||||||
|
Benchmark.stop("Enable", "Analysis refresh task registration");
|
||||||
|
|
||||||
|
Benchmark.start("WebServer Initialization");
|
||||||
|
// Data view settings
|
||||||
|
boolean webserverIsEnabled = Settings.WEBSERVER_ENABLED.isTrue();
|
||||||
|
boolean usingAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
||||||
|
boolean usingAlternativeUI = Settings.USE_ALTERNATIVE_UI.isTrue();
|
||||||
|
boolean hasDataViewCapability = usingAlternativeIP || usingAlternativeUI || webserverIsEnabled;
|
||||||
|
|
||||||
|
uiServer = new WebServer(this);
|
||||||
|
if (webserverIsEnabled) {
|
||||||
|
uiServer.initServer();
|
||||||
|
|
||||||
|
if (!uiServer.isEnabled()) {
|
||||||
|
Log.error("WebServer was not successfully initialized.");
|
||||||
|
}
|
||||||
|
|
||||||
|
setupFilter();
|
||||||
|
} else if (!hasDataViewCapability) {
|
||||||
|
Log.infoColor(Phrase.ERROR_NO_DATA_VIEW.toString());
|
||||||
|
}
|
||||||
|
if (!usingAlternativeIP && serverVariableHolder.getIp().isEmpty()) {
|
||||||
|
Log.infoColor(Phrase.NOTIFY_EMPTY_IP.toString());
|
||||||
|
}
|
||||||
|
Benchmark.stop("Enable", "WebServer Initialization");
|
||||||
|
|
||||||
|
registerCommand(new PlanCommand(this));
|
||||||
|
|
||||||
|
Benchmark.start("Hook to 3rd party plugins");
|
||||||
|
hookHandler = new HookHandler(this);
|
||||||
|
Benchmark.stop("Enable", "Hook to 3rd party plugins");
|
||||||
|
|
||||||
|
BStats bStats = new BStats(this);
|
||||||
|
bStats.registerMetrics();
|
||||||
|
|
||||||
|
Log.debug("Verbose debug messages are enabled.");
|
||||||
|
Log.logDebug("Enable", Benchmark.stop("Enable", "Enable"));
|
||||||
|
Log.info(Phrase.ENABLED.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("Plugin Failed to Initialize Correctly.");
|
||||||
|
Log.toLog(this.getClass().getName(), e);
|
||||||
|
disablePlugin();
|
||||||
}
|
}
|
||||||
if (!usingAlternativeIP && serverVariableHolder.getIp().isEmpty()) {
|
|
||||||
Log.infoColor(Phrase.NOTIFY_EMPTY_IP.toString());
|
|
||||||
}
|
|
||||||
Benchmark.stop("Enable", "WebServer Initialization");
|
|
||||||
|
|
||||||
registerCommand(new PlanCommand(this));
|
|
||||||
|
|
||||||
Benchmark.start("Hook to 3rd party plugins");
|
|
||||||
hookHandler = new HookHandler(this);
|
|
||||||
Benchmark.stop("Enable", "Hook to 3rd party plugins");
|
|
||||||
|
|
||||||
BStats bStats = new BStats(this);
|
|
||||||
bStats.registerMetrics();
|
|
||||||
|
|
||||||
Log.debug("Verbose debug messages are enabled.");
|
|
||||||
Log.logDebug("Enable", Benchmark.stop("Enable", "Enable"));
|
|
||||||
Log.info(Phrase.ENABLED.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -269,7 +275,7 @@ public class Plan extends BukkitPlugin<Plan> {
|
|||||||
registerListener(new PlanDeathEventListener(this));
|
registerListener(new PlanDeathEventListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
Benchmark.stop("Register Listeners");
|
Benchmark.stop("Enable", "Register Listeners");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ public class PlanCommand extends TreeCommand<Plan> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -40,7 +40,7 @@ public class AnalyzeCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -47,7 +47,7 @@ public class InspectCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -30,7 +30,7 @@ public class ManageCommand extends TreeCommand<Plan> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -42,7 +42,7 @@ public class QuickAnalyzeCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -47,7 +47,7 @@ public class QuickInspectCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -40,7 +40,7 @@ public class RegisterCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -38,7 +38,7 @@ public class SearchCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -26,7 +26,7 @@ public class WebUserCommand extends TreeCommand<Plan> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -38,7 +38,7 @@ public class ManageClearCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -38,7 +38,7 @@ public class ManageHotswapCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -45,7 +45,7 @@ public class ManageImportCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String sCol = colorScheme.getSecondaryColor();
|
String sCol = colorScheme.getSecondaryColor();
|
||||||
|
@ -41,7 +41,7 @@ public class ManageRemoveCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] addHelp() {
|
public String[] addHelp() {
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = Plan.getInstance().getColorScheme();
|
||||||
|
|
||||||
String mCol = colorScheme.getMainColor();
|
String mCol = colorScheme.getMainColor();
|
||||||
String tCol = colorScheme.getTertiaryColor();
|
String tCol = colorScheme.getTertiaryColor();
|
||||||
|
@ -203,6 +203,10 @@ public abstract class PluginData {
|
|||||||
*/
|
*/
|
||||||
public abstract Serializable getValue(UUID uuid);
|
public abstract Serializable getValue(UUID uuid);
|
||||||
|
|
||||||
|
public Map<UUID, Serializable> getValues(Collection<UUID> uuids) throws UnsupportedOperationException {
|
||||||
|
throw new UnsupportedOperationException("Not overridden.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to set the Font Awesome icon.
|
* Used to set the Font Awesome icon.
|
||||||
*
|
*
|
||||||
@ -269,6 +273,11 @@ public abstract class PluginData {
|
|||||||
this.suffix = suffix;
|
this.suffix = suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isBanData() {
|
||||||
|
return placeholder.contains("banned")
|
||||||
|
&& analysisTypes.contains(AnalysisType.BOOLEAN_TOTAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a PluginData object has same placeholder, sourcePlugin and
|
* If a PluginData object has same placeholder, sourcePlugin and
|
||||||
* analysisTypes, it is considered equal.
|
* analysisTypes, it is considered equal.
|
||||||
|
@ -42,7 +42,7 @@ public class WebServer {
|
|||||||
private HttpServer server;
|
private HttpServer server;
|
||||||
private final int port;
|
private final int port;
|
||||||
|
|
||||||
private boolean usingHttps;
|
private boolean usingHttps = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Constructor.
|
* Class Constructor.
|
||||||
|
@ -24,6 +24,7 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
|||||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||||
import main.java.com.djrapitops.plan.utilities.comparators.UserDataLastPlayedComparator;
|
import main.java.com.djrapitops.plan.utilities.comparators.UserDataLastPlayedComparator;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -185,6 +186,7 @@ public class Analysis {
|
|||||||
final Map<String, String> replaceMap = new HashMap<>();
|
final Map<String, String> replaceMap = new HashMap<>();
|
||||||
final HookHandler hookHandler = plugin.getHookHandler();
|
final HookHandler hookHandler = plugin.getHookHandler();
|
||||||
final List<PluginData> sources = hookHandler.getAdditionalDataSources().stream()
|
final List<PluginData> sources = hookHandler.getAdditionalDataSources().stream()
|
||||||
|
.filter(p -> !p.isBanData())
|
||||||
.filter(p -> !p.getAnalysisTypes().isEmpty())
|
.filter(p -> !p.getAnalysisTypes().isEmpty())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
final AnalysisType[] totalTypes = new AnalysisType[]{
|
final AnalysisType[] totalTypes = new AnalysisType[]{
|
||||||
@ -264,6 +266,8 @@ public class Analysis {
|
|||||||
long now = MiscUtils.getTime();
|
long now = MiscUtils.getTime();
|
||||||
|
|
||||||
Benchmark.start("Fill Dataset");
|
Benchmark.start("Fill Dataset");
|
||||||
|
List<PluginData> banSources = plugin.getHookHandler().getAdditionalDataSources()
|
||||||
|
.stream().filter(PluginData::isBanData).collect(Collectors.toList());
|
||||||
rawData.forEach(uData -> {
|
rawData.forEach(uData -> {
|
||||||
uData.access();
|
uData.access();
|
||||||
Map<String, Long> gmTimes = uData.getGmTimes().getTimes();
|
Map<String, Long> gmTimes = uData.getGmTimes().getTimes();
|
||||||
@ -292,7 +296,20 @@ public class Analysis {
|
|||||||
if (uData.isOp()) {
|
if (uData.isOp()) {
|
||||||
playerCount.addOP(uuid);
|
playerCount.addOP(uuid);
|
||||||
}
|
}
|
||||||
if (uData.isBanned()) {
|
|
||||||
|
boolean banned = uData.isBanned();
|
||||||
|
if (!banned) {
|
||||||
|
banned = banSources.stream()
|
||||||
|
.anyMatch(banData -> {
|
||||||
|
Serializable value = banData.getValue(uuid);
|
||||||
|
if (value instanceof Boolean) {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (banned) {
|
||||||
activity.addBan(uuid);
|
activity.addBan(uuid);
|
||||||
} else if (uData.getLoginTimes() == 1) {
|
} else if (uData.getLoginTimes() == 1) {
|
||||||
activity.addJoinedOnce(uuid);
|
activity.addJoinedOnce(uuid);
|
||||||
|
@ -13,7 +13,7 @@ public class BStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerMetrics() {
|
public void registerMetrics() {
|
||||||
Log.debug("Enabling bStats Metrics.");
|
Log.debug("Enable", "Enabling bStats Metrics.");
|
||||||
if (bStats == null) {
|
if (bStats == null) {
|
||||||
bStats = new Metrics(plugin);
|
bStats = new Metrics(plugin);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user