1
1
package it .renvins .serverpulse .velocity ;
2
2
3
- import java .io .IOException ;
4
- import java .nio .file .Files ;
5
3
import java .nio .file .Path ;
6
4
7
- import com .google .common .eventbus .Subscribe ;
8
5
import com .google .inject .Inject ;
6
+ import com .velocitypowered .api .event .Subscribe ;
7
+ import com .velocitypowered .api .event .proxy .ProxyInitializeEvent ;
9
8
import com .velocitypowered .api .plugin .Plugin ;
10
9
import com .velocitypowered .api .plugin .annotation .DataDirectory ;
11
10
import com .velocitypowered .api .proxy .ProxyServer ;
@@ -61,7 +60,7 @@ public ServerPulseVelocity(ProxyServer server, @DataDirectory Path dataDirectory
61
60
}
62
61
63
62
@ Subscribe
64
- public void onProxyInitialization () {
63
+ public void onProxyInitialization (ProxyInitializeEvent event ) {
65
64
logger .info ("Loading configuration file..." );
66
65
config .load ();
67
66
@@ -71,11 +70,6 @@ public void onProxyInitialization() {
71
70
72
71
return ;
73
72
}
74
- databaseService .load ();
75
- if (server .isShuttingDown ()) {
76
- return ;
77
- }
78
-
79
73
DatabaseConfiguration dbConfig = new VelocityDatabaseConfiguration (config );
80
74
MetricsConfiguration metricsConfig = new VelocityMetricsConfiguration (config );
81
75
@@ -85,6 +79,11 @@ public void onProxyInitialization() {
85
79
this .databaseService = new DatabaseService (logger , platform , dbConfig , scheduler );
86
80
this .metricsService = new MetricsService (logger , platform , metricsConfig , scheduler );
87
81
82
+ databaseService .load ();
83
+ if (server .isShuttingDown ()) {
84
+ return ;
85
+ }
86
+
88
87
metricsService .load ();
89
88
ServerPulseProvider .register (new ServerPulseVelocityAPI (databaseService , metricsService , diskRetriever , pingRetriever ));
90
89
}
0 commit comments