22
33import com .google .inject .Inject ;
44import com .velocitypowered .api .command .CommandManager ;
5+ import com .velocitypowered .api .command .CommandMeta ;
56import com .velocitypowered .api .event .Subscribe ;
67import com .velocitypowered .api .event .proxy .ProxyInitializeEvent ;
78import com .velocitypowered .api .plugin .annotation .DataDirectory ;
@@ -25,7 +26,7 @@ public class Main {
2526 private ServerListListener serverListListener ;
2627
2728 private ScheduledTask pingTask ;
28- private volatile ServerPing mainPing ; // Cached ping from main server, similar to old mainPing
29+ private volatile ServerPing mainPing ;
2930
3031 @ Inject
3132 public Main (ProxyServer server , Logger logger , @ DataDirectory Path dataDirectory ) {
@@ -38,7 +39,7 @@ public Main(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory
3839 public void onProxyInitialize (ProxyInitializeEvent event ) {
3940 logger .info ("ServerPingPlayerList is starting up..." );
4041
41- config = new Config (dataDirectory , logger );
42+ config = new Config (this , dataDirectory , logger );
4243
4344 // Register Event Listeners
4445 serverListListener = new ServerListListener (this , config );
@@ -51,7 +52,7 @@ public void onProxyInitialize(ProxyInitializeEvent event) {
5152 startPingTask ();
5253
5354 // Some output to the console ;)
54- logConfig ();
55+ config . logConfig ();
5556
5657 // TODO Load Plugin Metrics
5758 if (config .getBoolean ("bStats" )) {
@@ -62,7 +63,8 @@ public void onProxyInitialize(ProxyInitializeEvent event) {
6263
6364 private void registerCommands () {
6465 CommandManager commandManager = server .getCommandManager ();
65- commandManager .register ("spplreload" , new ReloadCommand (this , logger ));
66+ CommandMeta commandMeta = commandManager .metaBuilder ("spplreload" ).plugin (this ).build ();
67+ commandManager .register (commandMeta , new ReloadCommand (this , logger ));
6668 }
6769
6870 public ProxyServer getServer () {
@@ -75,7 +77,7 @@ public ServerPing getMainPing() {
7577
7678 public void reloadConfig () {
7779 logger .info ("Reloading configuration..." );
78- Config newConfig = new Config (dataDirectory , logger );
80+ Config newConfig = new Config (this , dataDirectory , logger );
7981 this .config = newConfig ;
8082 serverListListener .setConfig (newConfig );
8183 startPingTask ();
@@ -106,16 +108,4 @@ public void startPingTask() {
106108 })).repeat (5 , TimeUnit .SECONDS ).schedule ();
107109 }
108110 }
109-
110- private void logConfig () {
111- logger .info ("[config] Version Name: {}" , config .getString ("versionName" ));
112- logger .info ("[config] Version Minimum Protocol: {}" , config .getString ("versionMinProtocol" ));
113- logger .info ("[config] Set Hover Info: {}" , config .getString ("setHoverInfo" ));
114- if (config .getBoolean ("messageOfTheDayOverride" )) {
115- logger .info ("[config] Message Of The Day: {}" , config .getString ("messageOfTheDay" ));
116- }
117- if (config .getBoolean ("useMainServer" )) {
118- logger .info ("[config] Ping Pass-Through-Server: {}" , config .getString ("mainServer" ));
119- }
120- }
121111}
0 commit comments