Replace mcstats with bStats (#215)

This commit is contained in:
Gabriele C 2017-01-29 15:48:07 +01:00 committed by ljacqu
parent bba35944b9
commit 6569c275eb
3 changed files with 1046 additions and 61 deletions

33
pom.xml
View File

@ -108,10 +108,6 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<groupId>junit</groupId> <groupId>junit</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>json-simple</artifactId>
<groupId>com.googlecode.json-simple</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>persistence-api</artifactId> <artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId> <groupId>javax.persistence</groupId>
@ -146,10 +142,6 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<groupId>junit</groupId> <groupId>junit</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>json-simple</artifactId>
<groupId>com.googlecode.json-simple</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>persistence-api</artifactId> <artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId> <groupId>javax.persistence</groupId>
@ -276,11 +268,6 @@
<pattern>javax.inject</pattern> <pattern>javax.inject</pattern>
<shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern> <shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern>
</relocation> </relocation>
<!-- MCStats.org metrics -->
<relocation>
<pattern>org.mcstats</pattern>
<shadedPattern>fr.xephi.authme</shadedPattern>
</relocation>
</relocations> </relocations>
<outputFile>target/${project.finalName}-spigot.jar</outputFile> <outputFile>target/${project.finalName}-spigot.jar</outputFile>
</configuration> </configuration>
@ -331,11 +318,6 @@
<pattern>javax.inject</pattern> <pattern>javax.inject</pattern>
<shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern> <shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern>
</relocation> </relocation>
<!-- MCStats.org metrics -->
<relocation>
<pattern>org.mcstats</pattern>
<shadedPattern>fr.xephi.authme</shadedPattern>
</relocation>
</relocations> </relocations>
<outputFile>target/${project.finalName}-legacy.jar</outputFile> <outputFile>target/${project.finalName}-legacy.jar</outputFile>
</configuration> </configuration>
@ -544,21 +526,6 @@
<!-- Bukkit Libraries --> <!-- Bukkit Libraries -->
<!-- Metrics API -->
<dependency>
<groupId>org.mcstats.bukkit</groupId>
<artifactId>metrics</artifactId>
<version>R8-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
<optional>true</optional>
</dependency>
<!-- ProtocolLib --> <!-- ProtocolLib -->
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>

View File

@ -6,6 +6,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages; import fr.xephi.authme.message.Messages;
import fr.xephi.authme.metrics.Metrics;
import fr.xephi.authme.output.ConsoleFilter; import fr.xephi.authme.output.ConsoleFilter;
import fr.xephi.authme.output.Log4JFilter; import fr.xephi.authme.output.Log4JFilter;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
@ -18,10 +19,8 @@ import fr.xephi.authme.util.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.mcstats.Metrics;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.IOException;
import java.util.logging.Logger; import java.util.logging.Logger;
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE; import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
@ -45,40 +44,28 @@ public class OnStartupTasks {
} }
public static void sendMetrics(AuthMe plugin, Settings settings) { public static void sendMetrics(AuthMe plugin, Settings settings) {
try { final Metrics metrics = new Metrics(plugin);
final Metrics metrics = new Metrics(plugin);
final Metrics.Graph languageGraph = metrics.createGraph("Messages Language"); metrics.addCustomChart(new Metrics.SimplePie("messages_language") {
final String messagesLanguage = settings.getProperty(PluginSettings.MESSAGES_LANGUAGE); @Override
languageGraph.addPlotter(new Metrics.Plotter(messagesLanguage) { public String getValue() {
@Override return settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
public int getValue() { }
return 1; });
}
});
final Metrics.Graph databaseBackend = metrics.createGraph("Database Backend"); metrics.addCustomChart(new Metrics.SimplePie("database_backend") {
final String dataSource = settings.getProperty(DatabaseSettings.BACKEND).toString(); @Override
databaseBackend.addPlotter(new Metrics.Plotter(dataSource) { public String getValue() {
@Override return settings.getProperty(DatabaseSettings.BACKEND).toString();
public int getValue() { }
return 1; });
}
});
// Submit metrics
metrics.start();
} catch (IOException e) {
// Failed to submit the metrics data
ConsoleLogger.logException("Can't send Metrics data! The plugin will work anyway...", e);
}
} }
/** /**
* Sets up the console filter if enabled. * Sets up the console filter if enabled.
* *
* @param settings the settings * @param settings the settings
* @param logger the plugin logger * @param logger the plugin logger
*/ */
public static void setupConsoleFilter(Settings settings, Logger logger) { public static void setupConsoleFilter(Settings settings, Logger logger) {
if (!settings.getProperty(SecuritySettings.REMOVE_PASSWORD_FROM_CONSOLE)) { if (!settings.getProperty(SecuritySettings.REMOVE_PASSWORD_FROM_CONSOLE)) {

File diff suppressed because it is too large Load Diff