@@ -44,39 +44,29 @@ public void onDisable() {
44
44
@ Override
45
45
public void onEnable () {
46
46
if (!this .gitVersion .contains ("GITREVISION" ) || !this .buildVersion .contains ("BUILDVERSION" )) {
47
- this .logger .log ("Using v" + this .getServer ().getVersion () + " git-" + this .gitVersion + " b" + this .buildVersion + "bamboo" );
47
+ this .logger .log ("Initializing v" + this .getServer ().getVersion () + " git-" + this .gitVersion + " b" + this .buildVersion + "bamboo" );
48
48
} else {
49
- this .logger .log ("Using v" + this .getServer ().getVersion ());
49
+ this .logger .log ("Initializing v" + this .getServer ().getVersion ());
50
50
}
51
- this .logger .log ("Please wait.. Starting." );
52
51
53
52
this .pluginManager = this .getServer ().getPluginManager ();
54
53
this .craftServer = (CraftServer ) this .getServer ();
55
54
56
- if (!this .craftServer .getServer ().onlineMode ) {
57
- this .logger .log (MCACLogger .logState .FATAL , "You must be running in online mode!" );
55
+ if (!this .onlineCheck ()){
58
56
return ;
59
57
}
60
58
61
- this .logger .log (MCACLogger .logState .INFO , "Checking Compatibility" );
62
-
63
59
final Plugin noCheatPlug = this .pluginManager .getPlugin ("NoCheat" );
64
60
if (noCheatPlug == null ) {
65
61
this .logger .log (MCACLogger .logState .FATAL , "NoCheat could not be found!" );
66
62
return ;
67
63
}
68
-
69
64
this .noCheat = (NoCheat ) noCheatPlug ;
70
65
71
- this .logger .log (MCACLogger .logState .INFO , "Found NoCheat" );
72
-
73
- this .logger .log (MCACLogger .logState .INFO , "Hooking Listeners" );
74
-
75
66
this .pluginManager .registerEvent (Type .PLAYER_PRELOGIN , new PlayerListener () {
76
67
@ Override
77
68
public void onPlayerPreLogin (PlayerPreLoginEvent event ) {
78
- if (!Main .this .craftServer .getServer ().onlineMode ) {
79
- Main .this .logger .log (MCACLogger .logState .FATAL , "You must be running in online mode!" );
69
+ if (!Main .this .onlineCheck ()){
80
70
return ;
81
71
}
82
72
final String playerName = event .getName ();
@@ -172,8 +162,8 @@ public boolean hasErrored (HashMap<String, String> response) {
172
162
if (error .contains ("Server Disabled" )) {
173
163
this .broadcastView (ChatColor .RED + "MCAC Abuse Detected" );
174
164
this .broadcastView ("Abuse of the MCAC System was detected and resulted in this server being blacklisted." );
175
- this .logger .log (MCACLogger .logState .SEVERE , "The server API key has been disabled by an MCAC " );
176
- this .logger .log (MCACLogger .logState .FATAL , "To appeal this decision, please contact an administrator" );
165
+ this .logger .log (MCACLogger .logState .SEVERE , "The server API key has been disabled by MCAC. " );
166
+ this .logger .log (MCACLogger .logState .FATAL , "To appeal this decision, please contact an administrator. " );
177
167
} else {
178
168
this .broadcastView ( ChatColor .RED + "Unexpected reply from MCAC API!" );
179
169
this .logger .log (MCACLogger .logState .SEVERE , "API returned an invalid error:" );
@@ -193,4 +183,11 @@ public boolean hasErrored (HashMap<String, String> response) {
193
183
public Plugin pluginInterface ( String pluginName ){
194
184
return this .getServer ().getPluginManager ().getPlugin (pluginName );
195
185
}
186
+
187
+ public boolean onlineCheck (){
188
+ if (!this .craftServer .getServer ().onlineMode ) {
189
+ this .logger .log (MCACLogger .logState .FATAL , "You must be running in online mode!" );
190
+ return false ;
191
+ } return true ;
192
+ }
196
193
}
0 commit comments