@@ -159,11 +159,6 @@ public void notifyIfUnlinked(Member member) {
159
159
}
160
160
}
161
161
162
- public void updateGuild () {
163
- List <Guild > guilds = this .jda .getGuilds ();
164
- this .guildId = guilds .size () == 1 ? guilds .get (0 ).getId () : null ;
165
- }
166
-
167
162
public void retrieveMutedUsers () {
168
163
UpdateVoiceStateTask .getMutedUsers ().clear ();
169
164
UpdateVoiceStateTask .getMutedUsers ().addAll (this .plugin .getTempYamlFile ().getStringList (TempYamlFile .MUTED_USERS_ID_FIELD ));
@@ -203,46 +198,48 @@ public void updateStatus() {
203
198
}
204
199
205
200
} else {
206
- if (this .guildId == null ) {
207
- List <Guild > guilds = this .jda .getGuilds ();
208
- if (guilds .isEmpty ()) {
209
- this .status = BotStatus .NO_GUILD ;
210
- this .jda .retrieveApplicationInfo ().queue (applicationInfo -> {
211
- applicationInfo .setRequiredScopes ("applications.commands" );
212
- this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-guild" , applicationInfo .getInviteUrl (Permission .ADMINISTRATOR )));
213
- });
214
- } else if (guilds .size () > 1 ) {
215
- this .status = BotStatus .MULTIPLE_GUILDS ;
216
- this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.multiple-guilds" ));
217
- }
218
-
219
- } else if (this .getGuild ().getRequiredMFALevel () == Guild .MFALevel .TWO_FACTOR_AUTH
220
- && !this .jda .getSelfUser ().isMfaEnabled ()) {
221
- this .status = BotStatus .MFA_REQUIRED ;
222
- this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.two-factor-authentication" ));
201
+ List <Guild > guilds = this .jda .getGuilds ();
223
202
224
- } else if (! this . getGuild (). getSelfMember (). hasPermission ( Permission . ADMINISTRATOR )) {
225
- this .status = BotStatus .MISSING_PERMISSION ;
203
+ if (guilds . isEmpty ( )) {
204
+ this .status = BotStatus .NO_GUILD ;
226
205
this .jda .retrieveApplicationInfo ().queue (applicationInfo -> {
227
206
applicationInfo .setRequiredScopes ("applications.commands" );
228
- this .plugin .getLogger ().severe (this .plugin .getLang ().getMessage ("logger.error.missing-permission " , applicationInfo .getInviteUrl (Permission .ADMINISTRATOR )));
207
+ this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-guild " , applicationInfo .getInviteUrl (Permission .ADMINISTRATOR )));
229
208
});
209
+ } else if (guilds .size () > 1 ) {
210
+ this .status = BotStatus .MULTIPLE_GUILDS ;
211
+ this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.multiple-guilds" ));
212
+ } else {
213
+ this .guildId = guilds .get (0 ).getId ();
214
+
215
+ if (this .getGuild ().getRequiredMFALevel () == Guild .MFALevel .TWO_FACTOR_AUTH
216
+ && !this .jda .getSelfUser ().isMfaEnabled ()) {
217
+ this .status = BotStatus .MFA_REQUIRED ;
218
+ this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.two-factor-authentication" ));
219
+
220
+ } else if (!this .getGuild ().getSelfMember ().hasPermission (Permission .ADMINISTRATOR )) {
221
+ this .status = BotStatus .MISSING_PERMISSION ;
222
+ this .jda .retrieveApplicationInfo ().queue (applicationInfo -> {
223
+ applicationInfo .setRequiredScopes ("applications.commands" );
224
+ this .plugin .getLogger ().severe (this .plugin .getLang ().getMessage ("logger.error.missing-permission" , applicationInfo .getInviteUrl (Permission .ADMINISTRATOR )));
225
+ });
230
226
231
- } else if (!this .plugin .getConfigYamlFile ().contains (ConfigField .VOICE_CHANNEL_ID .toString ())) {
232
- this .status = BotStatus .NO_VOICE_CHANNEL ;
233
- this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-voice-channel" ));
227
+ } else if (!this .plugin .getConfigYamlFile ().contains (ConfigField .VOICE_CHANNEL_ID .toString ())) {
228
+ this .status = BotStatus .NO_VOICE_CHANNEL ;
229
+ this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-voice-channel" ));
234
230
235
- } else if (!this .plugin .getConfigYamlFile ().contains (ConfigField .HORIZONTAL_RADIUS .toString ())
236
- || !this .plugin .getConfigYamlFile ().contains (ConfigField .VERTICAL_RADIUS .toString ())) {
237
- this .status = BotStatus .NO_RADIUS ;
238
- this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-radius" ));
231
+ } else if (!this .plugin .getConfigYamlFile ().contains (ConfigField .HORIZONTAL_RADIUS .toString ())
232
+ || !this .plugin .getConfigYamlFile ().contains (ConfigField .VERTICAL_RADIUS .toString ())) {
233
+ this .status = BotStatus .NO_RADIUS ;
234
+ this .plugin .getLogger ().warning (this .plugin .getLang ().getMessage ("logger.warning.no-radius" ));
239
235
240
- } else {
241
- this .status = BotStatus .READY ;
242
- this .plugin .getServer ().getScheduler ().runTask (this .plugin , () -> {
243
- SystemReadyEvent event = new SystemReadyEvent ();
244
- this .plugin .getServer ().getPluginManager ().callEvent (event );
245
- });
236
+ } else {
237
+ this .status = BotStatus .READY ;
238
+ this .plugin .getServer ().getScheduler ().runTask (this .plugin , () -> {
239
+ SystemReadyEvent event = new SystemReadyEvent ();
240
+ this .plugin .getServer ().getPluginManager ().callEvent (event );
241
+ });
242
+ }
246
243
}
247
244
248
245
this .updateActivity ();
0 commit comments