mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-07-02 17:00:57 +00:00
Adding bstats functionality and fixing version
This commit is contained in:
@@ -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 -> {
|
||||
|
||||
Reference in New Issue
Block a user