mirror of
https://github.com/Shimeo98/DiscordWhitelisterSpigot.git
synced 2024-11-28 13:45:18 +01:00
Pass through vanished player count if reloading
This commit is contained in:
parent
934707e603
commit
1dfcfb9586
@ -33,7 +33,7 @@ public class CommandReload implements CommandExecutor
|
||||
}
|
||||
|
||||
// initializes client
|
||||
int initSuccess = DiscordWhitelister.InitBot();
|
||||
int initSuccess = DiscordWhitelister.InitBot(false);
|
||||
|
||||
if(initSuccess == 1)
|
||||
{
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user