1717import com .xinecraft .minetrax .common .interfaces .MinetraxPlugin ;
1818import com .xinecraft .minetrax .common .utils .LoggingUtil ;
1919import com .xinecraft .minetrax .common .webquery .WebQueryServer ;
20+ import com .xinecraft .minetrax .velocity .commands .MinetraxAdminCommand ;
2021import com .xinecraft .minetrax .velocity .hooks .skinsrestorer .SkinsRestorerHook ;
2122import com .xinecraft .minetrax .velocity .listeners .ServerConnectedListener ;
2223import com .xinecraft .minetrax .velocity .logging .VelocityLogger ;
4748import java .util .concurrent .TimeUnit ;
4849
4950@ Getter
50- @ Plugin (
51- id = "minetrax" ,
52- name = "Minetrax" ,
53- authors = {"Xinecraft" },
54- version = BuildConstants .VERSION ,
55- dependencies = {
56- @ Dependency (id = "skinsrestorer" , optional = true )
57- }
58- )
51+ @ Plugin (id = "minetrax" , name = "Minetrax" , authors = {"Xinecraft" }, version = BuildConstants .VERSION , dependencies = {@ Dependency (id = "skinsrestorer" , optional = true )})
5952public class MinetraxVelocity implements MinetraxPlugin {
6053 @ Inject
6154 private Logger logger ;
@@ -108,19 +101,13 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
108101 return ;
109102 }
110103 // Disable plugin if host, key, secret or server-id is not there
111- if (
112- apiHost == null || apiKey == null || apiSecret == null || apiServerId == null ||
113- apiHost .isEmpty () || apiKey .isEmpty () || apiSecret .isEmpty () || apiServerId .isEmpty ()
114- ) {
104+ if (apiHost == null || apiKey == null || apiSecret == null || apiServerId == null || apiHost .isEmpty () || apiKey .isEmpty () || apiSecret .isEmpty () || apiServerId .isEmpty ()) {
115105 logger .error ("Plugin disabled due to no API information" );
116106 return ;
117107 }
118108
119109 // GSON builder
120- gson = new GsonBuilder ()
121- .serializeNulls ()
122- .disableHtmlEscaping ()
123- .create ();
110+ gson = new GsonBuilder ().serializeNulls ().disableHtmlEscaping ().create ();
124111
125112 // Setup Common
126113 common = new MinetraxCommon ();
@@ -149,13 +136,12 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
149136 // Register Listeners
150137 proxyServer .getEventManager ().register (this , new ServerConnectedListener ());
151138
139+ // Register Commands
140+ proxyServer .getCommandManager ().register ("minetraxv" , new MinetraxAdminCommand (this ), "mtxv" );
141+
152142 // Register Tasks
153143 if (isServerIntelEnabled ) {
154- proxyServer .getScheduler ()
155- .buildTask (plugin , new ServerIntelReportTask ())
156- .delay (60L , TimeUnit .SECONDS )
157- .repeat (60L , TimeUnit .SECONDS )
158- .schedule ();
144+ proxyServer .getScheduler ().buildTask (plugin , new ServerIntelReportTask ()).delay (60L , TimeUnit .SECONDS ).repeat (60L , TimeUnit .SECONDS ).schedule ();
159145 }
160146 }
161147
@@ -167,9 +153,7 @@ private void startWebQueryServer() {
167153 private void loadConfig () {
168154 // Create and update the file
169155 try {
170- config = YamlDocument .create (new File (getDataPath ().toFile (), "config.yml" ),
171- Objects .requireNonNull (getClass ().getResourceAsStream ("/velocityConfig.yml" )),
172- GeneralSettings .DEFAULT , LoaderSettings .builder ().setAutoUpdate (true ).build (), DumperSettings .DEFAULT , UpdaterSettings .builder ().setVersioning (new BasicVersioning ("file-version" )).build ());
156+ config = YamlDocument .create (new File (getDataPath ().toFile (), "config.yml" ), Objects .requireNonNull (getClass ().getResourceAsStream ("/velocityConfig.yml" )), GeneralSettings .DEFAULT , LoaderSettings .builder ().setAutoUpdate (true ).build (), DumperSettings .DEFAULT , UpdaterSettings .builder ().setVersioning (new BasicVersioning ("file-version" )).build ());
173157 } catch (IOException ex ) {
174158 LoggingUtil .warntrace (ex );
175159 }
0 commit comments