Skip to content

Commit 0d85d40

Browse files
committed
Update Velocity integration: add annotation processor and adjust server tag
1 parent 8effed8 commit 0d85d40

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

velocity/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323
implementation("com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4")
2424

2525
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
26+
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
2627
}
2728

2829
java {

velocity/src/main/java/it/renvins/serverpulse/velocity/ServerPulseVelocity.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package it.renvins.serverpulse.velocity;
22

3-
import java.io.IOException;
4-
import java.nio.file.Files;
53
import java.nio.file.Path;
64

7-
import com.google.common.eventbus.Subscribe;
85
import com.google.inject.Inject;
6+
import com.velocitypowered.api.event.Subscribe;
7+
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
98
import com.velocitypowered.api.plugin.Plugin;
109
import com.velocitypowered.api.plugin.annotation.DataDirectory;
1110
import com.velocitypowered.api.proxy.ProxyServer;
@@ -61,7 +60,7 @@ public ServerPulseVelocity(ProxyServer server, @DataDirectory Path dataDirectory
6160
}
6261

6362
@Subscribe
64-
public void onProxyInitialization() {
63+
public void onProxyInitialization(ProxyInitializeEvent event) {
6564
logger.info("Loading configuration file...");
6665
config.load();
6766

@@ -71,11 +70,6 @@ public void onProxyInitialization() {
7170

7271
return;
7372
}
74-
databaseService.load();
75-
if (server.isShuttingDown()) {
76-
return;
77-
}
78-
7973
DatabaseConfiguration dbConfig = new VelocityDatabaseConfiguration(config);
8074
MetricsConfiguration metricsConfig = new VelocityMetricsConfiguration(config);
8175

@@ -85,6 +79,11 @@ public void onProxyInitialization() {
8579
this.databaseService = new DatabaseService(logger, platform, dbConfig, scheduler);
8680
this.metricsService = new MetricsService(logger, platform, metricsConfig, scheduler);
8781

82+
databaseService.load();
83+
if (server.isShuttingDown()) {
84+
return;
85+
}
86+
8887
metricsService.load();
8988
ServerPulseProvider.register(new ServerPulseVelocityAPI(databaseService, metricsService, diskRetriever, pingRetriever));
9089
}

velocity/src/main/resources/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metrics:
88
token: my-token # The token to access the InfluxDB API (WRITE AND READ ACCESS)
99
table: minecraft_stats # The table where metrics are stored
1010
tags:
11-
server: "bed1"
11+
server: "velocity1"
1212
messages:
1313
noPerms: "&7[&bServer&7Pulse] &7You don't have &bpermission &7to use this &bcommand&7."
1414
reloadConfig: "&7[&bServer&7Pulse] &7Configuration &breloaded&7."

0 commit comments

Comments
 (0)