Fixed an error when attempting to assign player count regardless of if the bot was initialized successfully

This commit is contained in:
JoeShimell 2020-04-25 12:32:41 +01:00
parent 6b83b1d2f6
commit e23e4b3f66
3 changed files with 12 additions and 11 deletions

View File

@ -1,5 +1,5 @@
name: DiscordWhitelister
version: 1.3.1
version: 1.3.2
author: Joe Shimell
main: uk.co.angrybee.joe.DiscordWhitelister
description: Discord whitelister bot.

View File

@ -112,21 +112,22 @@ public class DiscordWhitelister extends JavaPlugin
if(initializeSuccess == 0)
{
getLogger().info("Successfully initialized Discord client.");
// Only attempt to set player count if the bot successfully initialized
if(getWhitelisterBotConfig().getBoolean("show-player-count"))
{
// Register events if enabled
getServer().getPluginManager().registerEvents(new JoinLeaveEvents(), this);
// Set initial player count
DiscordClient.SetPlayerCountStatus(getOnlineUsers());
}
}
else if(initializeSuccess == 1)
{
getLogger().severe("Discord Client failed to initialize, please check if your config file is valid.");
}
}
if(getWhitelisterBotConfig().getBoolean("show-player-count"))
{
// Register events if enabled
getServer().getPluginManager().registerEvents(new JoinLeaveEvents(), this);
// Set initial player count
DiscordClient.SetPlayerCountStatus(getOnlineUsers());
}
}
public static JavaPlugin getPlugin()

View File

@ -9,5 +9,5 @@ public class VersionInfo {
return "v." + getVersion();
}
private static String version = "1.3.1";
private static String version = "1.3.2";
}