Adding bstats functionality and fixing version

This commit is contained in:
Dawson Hessler
2021-09-14 19:05:07 -04:00
parent 256f500dff
commit 2082ad6d8e
2 changed files with 40 additions and 2 deletions
+28
View File
@@ -36,6 +36,12 @@
<version>1.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-velocity</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@@ -50,6 +56,28 @@
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<!-- Replace this with your package! -->
<shadedPattern>dev.brighten.antivpn.velocity.org.bstats</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
@@ -16,6 +16,7 @@ import lombok.val;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bstats.velocity.Metrics;
import java.nio.file.Path;
import java.util.Arrays;
@@ -23,11 +24,13 @@ import java.util.logging.Logger;
import java.util.stream.IntStream;
@Getter
@Plugin(id = "kaurivpn", name = "KauriVPN", version = "${project.version}", authors = {"funkemunky"})
@Plugin(id = "kaurivpn", name = "KauriVPN", version = "1.5.0", authors = {"funkemunky"})
public class VelocityPlugin {
private final ProxyServer server;
private final Logger logger;
private Metrics.Factory metricsFactory;
public static VelocityPlugin INSTANCE;
@Inject
@@ -37,9 +40,10 @@ public class VelocityPlugin {
private Config config;
@Inject
public VelocityPlugin(ProxyServer server, Logger logger) {
public VelocityPlugin(ProxyServer server, Logger logger, Metrics.Factory metricsFactory) {
this.server = server;
this.logger = logger;
this.metricsFactory = metricsFactory;
}
@Subscribe
@@ -52,6 +56,12 @@ public class VelocityPlugin {
logger.info("Starting AntiVPN services...");
AntiVPN.start(new VelocityConfig(), new VelocityListener(), new VelocityPlayerExecutor());
if(AntiVPN.getInstance().getConfig().metrics()) {
logger.info("Starting metrics...");
Metrics metrics = metricsFactory.make(this, 12791);
}
logger.info("Registering commands...");
for (Command command : AntiVPN.getInstance().getCommands()) {
server.getCommandManager().register(server.getCommandManager().metaBuilder(command.name())
.aliases(command.aliases()).build(), (SimpleCommand) invocation -> {