mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-15 03:51:37 +01:00
Add bStats metrics.
Metrics will greatly help the development process in terms of finding out which server versions people are running, as well as which features they are using. For now, we check to see how widespread Vault is, and how many arenas and classes people have. Advanced bar charts are, at the time of this commit, not supported in the bStats dashboard. When they are supported again, we can look into usage statistics for specific settings and features.
This commit is contained in:
parent
94c1000d73
commit
c325317153
36
pom.xml
36
pom.xml
@ -31,6 +31,30 @@
|
||||
<finalName>MobArena</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>com.garbagemule.MobArena.metrics</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
@ -54,6 +78,11 @@
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -73,6 +102,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Magic Spells (tentative) -->
|
||||
<dependency>
|
||||
<groupId>com.nisovin</groupId>
|
||||
|
@ -5,11 +5,15 @@ import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.framework.ArenaMaster;
|
||||
import com.garbagemule.MobArena.listeners.MAGlobalListener;
|
||||
import com.garbagemule.MobArena.listeners.MagicSpellsListener;
|
||||
import com.garbagemule.MobArena.metrics.ArenaCountChart;
|
||||
import com.garbagemule.MobArena.metrics.ClassCountChart;
|
||||
import com.garbagemule.MobArena.metrics.VaultChart;
|
||||
import com.garbagemule.MobArena.things.ThingManager;
|
||||
import com.garbagemule.MobArena.util.VersionChecker;
|
||||
import com.garbagemule.MobArena.util.config.ConfigUtils;
|
||||
import com.garbagemule.MobArena.waves.ability.AbilityManager;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -87,6 +91,9 @@ public class MobArena extends JavaPlugin
|
||||
// Register event listeners
|
||||
registerListeners();
|
||||
|
||||
// Setup bStats metrics
|
||||
setupMetrics();
|
||||
|
||||
// Announce enable!
|
||||
getLogger().info("v" + this.getDescription().getVersion() + " enabled.");
|
||||
|
||||
@ -224,6 +231,13 @@ public class MobArena extends JavaPlugin
|
||||
getLogger().info("MagicSpells found, loading config-file.");
|
||||
this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this);
|
||||
}
|
||||
|
||||
private void setupMetrics() {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.addCustomChart(new VaultChart(this));
|
||||
metrics.addCustomChart(new ArenaCountChart(this));
|
||||
metrics.addCustomChart(new ClassCountChart(this));
|
||||
}
|
||||
|
||||
private void loadAbilities() {
|
||||
File dir = new File(this.getDataFolder(), "abilities");
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.garbagemule.MobArena.metrics;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
|
||||
public class ArenaCountChart extends Metrics.SimplePie {
|
||||
|
||||
public ArenaCountChart(MobArena plugin) {
|
||||
super("arena_count", () -> {
|
||||
int count = plugin.getArenaMaster().getArenas().size();
|
||||
if (count < 10) {
|
||||
return String.valueOf(count);
|
||||
}
|
||||
return "10+";
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.garbagemule.MobArena.metrics;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
|
||||
public class ClassCountChart extends Metrics.SimplePie {
|
||||
|
||||
public ClassCountChart(MobArena plugin) {
|
||||
super("class_count", () -> {
|
||||
// We don't count "My Items", so subtract 1
|
||||
int count = plugin.getArenaMaster().getClasses().size() - 1;
|
||||
if (count < 10) {
|
||||
return String.valueOf(count);
|
||||
}
|
||||
return "10+";
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.garbagemule.MobArena.metrics;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
|
||||
public class VaultChart extends Metrics.SimplePie {
|
||||
|
||||
public VaultChart(MobArena plugin) {
|
||||
super("uses_vault", () -> plugin.getEconomy() != null ? "Yes" : "No");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user