Pass through vanished player count if reloading

This commit is contained in:
Joe Shimell 2020-06-04 13:27:51 +01:00
parent 934707e603
commit 1dfcfb9586
2 changed files with 6 additions and 7 deletions

View File

@ -33,7 +33,7 @@ public class CommandReload implements CommandExecutor
}
// initializes client
int initSuccess = DiscordWhitelister.InitBot();
int initSuccess = DiscordWhitelister.InitBot(false);
if(initSuccess == 1)
{

View File

@ -58,7 +58,7 @@ public class DiscordWhitelister extends JavaPlugin
thisServer = thisPlugin.getServer();
pluginLogger = thisPlugin.getLogger();
int initSuccess = InitBot();
int initSuccess = InitBot(true);
if(initSuccess == 0)
{
@ -137,13 +137,15 @@ public class DiscordWhitelister extends JavaPlugin
public static int getMaximumAllowedPlayers() { return thisPlugin.getServer().getMaxPlayers(); }
public static int InitBot()
public static int InitBot(boolean firstInit)
{
whitelisterBotConfig = new YamlConfiguration();
userList = new YamlConfiguration();
removedList = new YamlConfiguration();
customMessagesConfig = new YamlConfiguration();
vanishedPlayersCount = 0; // TODO: check if this messes up when reloading the bot
if(firstInit)
vanishedPlayersCount = 0;
ConfigSetup();
@ -204,9 +206,7 @@ public class DiscordWhitelister extends JavaPlugin
// Custom messages check
if(getWhitelisterBotConfig().getBoolean("use-custom-messages"))
{
useCustomMessages = true;
}
int initSuccess = DiscordClient.InitializeClient(botToken);
@ -240,7 +240,6 @@ public class DiscordWhitelister extends JavaPlugin
removedListFile = new File(dataFolder, "removed-list.yml");
customMessagesFile = new File(dataFolder, "custom-messages.yml");
if(!whitelisterBotConfigFile.getParentFile().exists())
{
whitelisterBotConfigFile.getParentFile().mkdirs();