create parent and remove duplicate code

This commit is contained in:
Xyntexx 2021-04-03 21:42:29 +03:00
parent be0938689f
commit e25cefe956
11 changed files with 227 additions and 442 deletions

View File

@ -139,7 +139,7 @@ public class DiscordClient extends ListenerAdapter
private static void AssignVars()
{
FileConfiguration mainConfig = MainConfig.getMainConfig();
FileConfiguration mainConfig = DiscordWhitelister.mainConfig.getFileConfiguration();
// assign vars here instead of every time a message is received, as they do not change
targetTextChannels = new String[mainConfig.getList("target-text-channels").size()];
@ -281,15 +281,15 @@ public class DiscordClient extends ListenerAdapter
{
String addCommandExample = "!whitelist add";
if(DiscordWhitelister.useCustomPrefixes)
addCommandExample = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-add-prefix").trim();
addCommandExample = DiscordWhitelister.customPrefixConfig.getFileConfiguration().getString("whitelist-add-prefix").trim();
instructionalMessageEmbed = CreateEmbeddedMessage("How to Whitelist", ("Use `" + addCommandExample + " <minecraftUsername>` to whitelist yourself.\n" +
"In the case of whitelisting an incorrect name, please contact a staff member to clear it from the whitelist."), EmbedMessageType.INFO).build();
}
else
{
String customTitle = CustomMessagesConfig.getCustomMessagesConfig().getString("instructional-message-title");
String customMessage = CustomMessagesConfig.getCustomMessagesConfig().getString("instructional-message");
String customTitle = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("instructional-message-title");
String customMessage = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("instructional-message");
instructionalMessageEmbed = CreateEmbeddedMessage(customTitle, customMessage, EmbedMessageType.INFO).build();
}
@ -446,7 +446,7 @@ public class DiscordClient extends ListenerAdapter
if(!DiscordWhitelister.useCustomMessages)
{
if(!MainConfig.getMainConfig().getBoolean("set-removed-message-colour-to-red"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("set-removed-message-colour-to-red"))
embedBuilderSuccess = CreateEmbeddedMessage((finalNameToRemove + " has been removed"), (author.getAsMention() + " has removed `" + finalNameToRemove + "` from the whitelist."), EmbedMessageType.SUCCESS);
else
embedBuilderSuccess = CreateEmbeddedMessage((finalNameToRemove + " has been removed"), (author.getAsMention() + " has removed `" + finalNameToRemove + "` from the whitelist."), EmbedMessageType.FAILURE);
@ -460,7 +460,7 @@ public class DiscordClient extends ListenerAdapter
customMessage = customMessage.replaceAll("\\{Sender}", author.getAsMention());
customMessage = customMessage.replaceAll("\\{MinecraftUsername}", finalNameToRemove);
if(!MainConfig.getMainConfig().getBoolean("set-removed-message-colour-to-red"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("set-removed-message-colour-to-red"))
embedBuilderSuccess = CreateEmbeddedMessage(customTitle, customMessage, EmbedMessageType.SUCCESS);
else
embedBuilderSuccess = CreateEmbeddedMessage(customTitle, customMessage, EmbedMessageType.FAILURE);
@ -470,7 +470,7 @@ public class DiscordClient extends ListenerAdapter
{
String playerUUID = DiscordClient.minecraftUsernameToUUID(finalNameToRemove);
if(!MainConfig.getMainConfig().getBoolean("use-crafatar-for-avatars"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-crafatar-for-avatars"))
embedBuilderSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
else
embedBuilderSuccess.setThumbnail("https://crafatar.com/avatars/" + playerUUID + "?size=100&default=MHF_Steve&overlay.png");
@ -557,7 +557,7 @@ public class DiscordClient extends ListenerAdapter
if (authorPermissions.isUserCanAdd() && !authorPermissions.isUserCanAddRemove())
{
String higherPermRoles = MainConfig.getMainConfig().getList("add-remove-roles").toString();
String higherPermRoles = DiscordWhitelister.mainConfig.getFileConfiguration().getList("add-remove-roles").toString();
higherPermRoles = higherPermRoles.replaceAll("\\[", "");
higherPermRoles = higherPermRoles.replaceAll("]", "");
@ -652,7 +652,7 @@ public class DiscordClient extends ListenerAdapter
UserList.getUserList().set(userid, null);
}
UserList.SaveStore();
if (MainConfig.getMainConfig().getBoolean("unwhitelist-and-clear-perms-on-name-clear")) {
if (DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("unwhitelist-and-clear-perms-on-name-clear")) {
// Remove name from the whitelist
UnWhitelist(splitMessage[userNameIndex]);
}
@ -663,8 +663,8 @@ public class DiscordClient extends ListenerAdapter
if (nameFound) {
// Success message
if (DiscordWhitelister.useCustomMessages) {
String clearNameTitle = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-name-success-title");
String clearNameMessage = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-name-success-message");
String clearNameTitle = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-name-success-title");
String clearNameMessage = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-name-success-message");
clearNameMessage = clearNameMessage.replaceAll("\\{Sender}", author.getAsMention());
clearNameMessage = clearNameMessage.replaceAll("\\{MinecraftUsername}", splitMessage[userNameIndex]);
@ -688,8 +688,8 @@ public class DiscordClient extends ListenerAdapter
(author.getAsMention() + ", could not find name " + splitMessage[userNameIndex] + " to clear in user list."), EmbedMessageType.FAILURE).build();
QueueAndRemoveAfterSeconds(channel, messageEmbed);
} else {
String customTitle = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-name-failure-title");
String customMessage = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-name-failure-message");
String customTitle = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-name-failure-title");
String customMessage = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-name-failure-message");
customMessage = customMessage.replaceAll("\\{Sender}", author.getAsMention());
customMessage = customMessage.replaceAll("\\{MinecraftUsername}", splitMessage[userNameIndex]);
customTitle = customTitle.replaceAll("\\{MinecraftUsername}", splitMessage[userNameIndex]);
@ -706,7 +706,7 @@ public class DiscordClient extends ListenerAdapter
// Clear whitelists for limited-whitelisters
else if (messageContents.toLowerCase().startsWith("!whitelist clear") && !DiscordWhitelister.getUseCustomPrefixes()
|| DiscordWhitelister.getUseCustomPrefixes() && messageContents.toLowerCase().startsWith(customLimitedWhitelistClearPrefix)) {
if (!MainConfig.getMainConfig().getBoolean("allow-limited-whitelisters-to-unwhitelist-self"))
if (!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("allow-limited-whitelisters-to-unwhitelist-self"))
return;
// just inform staff, can add custom messages later if really needed
@ -767,7 +767,7 @@ public class DiscordClient extends ListenerAdapter
QueueAndRemoveAfterSeconds(channel, messageEmbed);
}
if (MainConfig.getMainConfig().getBoolean("whitelisted-role-auto-remove")) {
if (DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("whitelisted-role-auto-remove")) {
// Find all servers bot is in, remove whitelisted roles
for (int i = 0; i < javaDiscordAPI.getGuilds().size(); i++) {
// Remove the whitelisted role(s)
@ -881,8 +881,8 @@ public class DiscordClient extends ListenerAdapter
}
else
{
String customTitle = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-ban-success-title");
String customMessage = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-ban-success-message");
String customTitle = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-ban-success-title");
String customMessage = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-ban-success-message");
customMessage = customMessage.replaceAll("\\{Sender}", author.getAsMention());
customMessage = customMessage.replaceAll("\\{MinecraftUsername}", targetName);
customTitle = customTitle.replaceAll("\\{MinecraftUsername}", targetName);
@ -904,8 +904,8 @@ public class DiscordClient extends ListenerAdapter
}
else
{
String customTitle = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-ban-failure-title");
String customMessage = CustomMessagesConfig.getCustomMessagesConfig().getString("clear-ban-failure-message");
String customTitle = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-ban-failure-title");
String customMessage = DiscordWhitelister.customMessagesConfig.getFileConfiguration().getString("clear-ban-failure-message");
customMessage = customMessage.replaceAll("\\{Sender}", author.getAsMention());
customMessage = customMessage.replaceAll("\\{MinecraftUsername}", targetName);
customTitle = customTitle.replaceAll("\\{MinecraftUsername}", targetName);
@ -943,7 +943,7 @@ public class DiscordClient extends ListenerAdapter
}
// Warn if enabled
if(MainConfig.getMainConfig().getBoolean("show-warning-in-command-channel"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("show-warning-in-command-channel"))
{
if(!DiscordWhitelister.useCustomMessages)
{
@ -968,7 +968,7 @@ public class DiscordClient extends ListenerAdapter
@Override
public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event)
{
if(!MainConfig.getMainConfig().getBoolean("un-whitelist-on-server-leave"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("un-whitelist-on-server-leave"))
return;
String discordUserToRemove = event.getMember().getId();
@ -1287,7 +1287,7 @@ public class DiscordClient extends ListenerAdapter
}
public static void ServerLeaveStartupCheck() {
if (MainConfig.getMainConfig().getBoolean("un-whitelist-on-server-leave")) {
if (DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("un-whitelist-on-server-leave")) {
// Don't attempt to remove members if not connected
if (javaDiscordAPI.getStatus() != JDA.Status.CONNECTED)
@ -1574,13 +1574,13 @@ public class DiscordClient extends ListenerAdapter
public static void AssignPerms(String targetPlayerName){
// For ultra perms:
if(DiscordWhitelister.useLuckPerms){
for (String s : PermissionsConfig.getPermissionsConfig().getStringList("perms-on-whitelist")) {
for (String s : DiscordWhitelister.customPrefixConfig.getFileConfiguration().getStringList("perms-on-whitelist")) {
DiscordClient.ExecuteServerCommand("lp user " + targetPlayerName + " permission set " + s);
}
}
// For LuckPerms:
if(DiscordWhitelister.useUltraPerms){
for (String s : PermissionsConfig.getPermissionsConfig().getStringList("perms-on-whitelist")) {
for (String s : DiscordWhitelister.customPrefixConfig.getFileConfiguration().getStringList("perms-on-whitelist")) {
DiscordClient.ExecuteServerCommand("upc addPlayerPermission " + targetPlayerName + " " + s);
}
}
@ -1589,13 +1589,13 @@ public class DiscordClient extends ListenerAdapter
public static void RemovePerms(String targetPlayerName){
// For ultra perms:
if(DiscordWhitelister.useLuckPerms){
for (String s : PermissionsConfig.getPermissionsConfig().getStringList("perms-on-whitelist")) {
for (String s : DiscordWhitelister.customPrefixConfig.getFileConfiguration().getStringList("perms-on-whitelist")) {
DiscordClient.ExecuteServerCommand("lp user " + targetPlayerName + " permission unset " + s);
}
}
// For LuckPerms:
if(DiscordWhitelister.useUltraPerms){
for (String s : PermissionsConfig.getPermissionsConfig().getStringList("perms-on-whitelist")) {
for (String s : DiscordWhitelister.customPrefixConfig.getFileConfiguration().getStringList("perms-on-whitelist")) {
DiscordClient.ExecuteServerCommand("upc removePlayerPermission " + targetPlayerName + " " + s);
}
}

View File

@ -50,6 +50,14 @@ public class DiscordWhitelister extends JavaPlugin
public static int removeMessageWaitTime = 5;
public static MainConfig mainConfig;
public static CustomPrefixConfig customPrefixConfig;
public static CustomMessagesConfig customMessagesConfig;
public static PermissionsConfig permissionsConfig;
public static OnWhitelistCommandsConfig onWhitelistCommandsConfig;
@Override
public void onEnable()
{
@ -89,7 +97,7 @@ public class DiscordWhitelister extends JavaPlugin
return thisPlugin;
}
public static FileConfiguration getCustomMessagesConfig() { return CustomMessagesConfig.getCustomMessagesConfig(); }
public static FileConfiguration getCustomMessagesConfig() { return customMessagesConfig.getFileConfiguration(); }
public static Logger getPluginLogger() { return pluginLogger; }
@ -110,19 +118,19 @@ public class DiscordWhitelister extends JavaPlugin
ConfigSetup();
botToken = MainConfig.getMainConfig().getString("discord-bot-token");
botEnabled = MainConfig.getMainConfig().getBoolean("bot-enabled");
showPlayerSkin = MainConfig.getMainConfig().getBoolean("show-player-skin-on-whitelist");
configCreated = MainConfig.configCreated;
showVanishedPlayersInCount = MainConfig.getMainConfig().getBoolean("show-vanished-players-in-player-count");
useInGameAddRemoves = MainConfig.getMainConfig().getBoolean("add-in-game-adds-and-removes-to-list");
useOnBanEvents = MainConfig.getMainConfig().getBoolean("use-on-ban-events");
removeUnnecessaryMessages = MainConfig.getMainConfig().getBoolean("remove-unnecessary-messages-from-whitelist-channel");
removeMessageWaitTime = MainConfig.getMainConfig().getInt("seconds-to-remove-message-from-whitelist-channel");
useOnWhitelistCommands = MainConfig.getMainConfig().getBoolean("use-on-whitelist-commands");
botToken = DiscordWhitelister.mainConfig.getFileConfiguration().getString("discord-bot-token");
botEnabled = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("bot-enabled");
showPlayerSkin = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("show-player-skin-on-whitelist");
configCreated = mainConfig.fileCreated;
showVanishedPlayersInCount = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("show-vanished-players-in-player-count");
useInGameAddRemoves = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("add-in-game-adds-and-removes-to-list");
useOnBanEvents = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-on-ban-events");
removeUnnecessaryMessages = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("remove-unnecessary-messages-from-whitelist-channel");
removeMessageWaitTime = DiscordWhitelister.mainConfig.getFileConfiguration().getInt("seconds-to-remove-message-from-whitelist-channel");
useOnWhitelistCommands = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-on-whitelist-commands");
// Check for LuckPerms first
if(MainConfig.getMainConfig().getBoolean("assign-perms-with-luck-perms"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("assign-perms-with-luck-perms"))
{
if(DiscordWhitelister.getPlugin().getServer().getPluginManager().getPlugin("LuckPerms") != null)
{
@ -135,7 +143,7 @@ public class DiscordWhitelister extends JavaPlugin
useLuckPerms = false;
}
}
if(MainConfig.getMainConfig().getBoolean("assign-perms-with-ultra-perms"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("assign-perms-with-ultra-perms"))
{
if(DiscordWhitelister.getPlugin().getServer().getPluginManager().getPlugin("UltraPermissions") != null)
{
@ -150,19 +158,19 @@ public class DiscordWhitelister extends JavaPlugin
}
// TODO: remove in favour of split versions
DiscordClient.customWhitelistAddPrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-add-prefix").toLowerCase();
DiscordClient.customWhitelistRemovePrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-remove-prefix").toLowerCase();
DiscordClient.customClearNamePrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("clear-name-prefix").toLowerCase();
DiscordClient.customLimitedWhitelistClearPrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("limited-whitelist-clear-prefix").toLowerCase();
DiscordClient.customClearBanPrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("clear-ban-prefix").toLowerCase();
DiscordClient.customWhitelistAddPrefix = customPrefixConfig.getFileConfiguration().getString("whitelist-add-prefix").toLowerCase();
DiscordClient.customWhitelistRemovePrefix = customPrefixConfig.getFileConfiguration().getString("whitelist-remove-prefix").toLowerCase();
DiscordClient.customClearNamePrefix = customPrefixConfig.getFileConfiguration().getString("clear-name-prefix").toLowerCase();
DiscordClient.customLimitedWhitelistClearPrefix = customPrefixConfig.getFileConfiguration().getString("limited-whitelist-clear-prefix").toLowerCase();
DiscordClient.customClearBanPrefix = customPrefixConfig.getFileConfiguration().getString("clear-ban-prefix").toLowerCase();
// Split versions
DiscordClient.customWhitelistAddPrefixSplit = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-add-prefix").toLowerCase().trim().split(" ");
DiscordClient.customWhitelistRemovePrefixSplit = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-remove-prefix").toLowerCase().trim().split(" ");
DiscordClient.customClearNamePrefixSplit = CustomPrefixConfig.getCustomPrefixesConfig().getString("clear-name-prefix").toLowerCase().trim().split(" ");
DiscordClient.customLimitedWhitelistClearPrefixSplit = CustomPrefixConfig.getCustomPrefixesConfig().getString("limited-whitelist-clear-prefix").toLowerCase().trim().split(" ");
DiscordClient.customClearBanPrefixSplit = CustomPrefixConfig.getCustomPrefixesConfig().getString("clear-ban-prefix").toLowerCase().trim().split(" ");
DiscordClient.customWhoIsPrefix = CustomPrefixConfig.getCustomPrefixesConfig().getString("whitelist-whois-prefix").toLowerCase().trim().split(" ");
DiscordClient.customWhitelistAddPrefixSplit = customPrefixConfig.getFileConfiguration().getString("whitelist-add-prefix").toLowerCase().trim().split(" ");
DiscordClient.customWhitelistRemovePrefixSplit = customPrefixConfig.getFileConfiguration().getString("whitelist-remove-prefix").toLowerCase().trim().split(" ");
DiscordClient.customClearNamePrefixSplit = customPrefixConfig.getFileConfiguration().getString("clear-name-prefix").toLowerCase().trim().split(" ");
DiscordClient.customLimitedWhitelistClearPrefixSplit = customPrefixConfig.getFileConfiguration().getString("limited-whitelist-clear-prefix").toLowerCase().trim().split(" ");
DiscordClient.customClearBanPrefixSplit = customPrefixConfig.getFileConfiguration().getString("clear-ban-prefix").toLowerCase().trim().split(" ");
DiscordClient.customWhoIsPrefix = customPrefixConfig.getFileConfiguration().getString("whitelist-whois-prefix").toLowerCase().trim().split(" ");
if(!botEnabled)
{
@ -177,33 +185,33 @@ public class DiscordWhitelister extends JavaPlugin
pluginLogger.info("Initializing Discord client...");
// TODO: below role section could be moved to DiscordClient class
useIdForRoles = MainConfig.getMainConfig().getBoolean("use-id-for-roles");
useIdForRoles = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-id-for-roles");
// set add & remove roles
DiscordClient.allowedToAddRemoveRoles = new String[MainConfig.getMainConfig().getList("add-remove-roles").size()];
DiscordClient.allowedToAddRemoveRoles = new String[DiscordWhitelister.mainConfig.getFileConfiguration().getList("add-remove-roles").size()];
for(int roles = 0; roles < DiscordClient.allowedToAddRemoveRoles.length; ++roles)
{
DiscordClient.allowedToAddRemoveRoles[roles] = MainConfig.getMainConfig().getList("add-remove-roles").get(roles).toString();
DiscordClient.allowedToAddRemoveRoles[roles] = DiscordWhitelister.mainConfig.getFileConfiguration().getList("add-remove-roles").get(roles).toString();
}
// set add roles
DiscordClient.allowedToAddRoles = new String[MainConfig.getMainConfig().getList("add-roles").size()];
DiscordClient.allowedToAddRoles = new String[DiscordWhitelister.mainConfig.getFileConfiguration().getList("add-roles").size()];
for(int roles = 0; roles < DiscordClient.allowedToAddRoles.length; ++roles)
{
DiscordClient.allowedToAddRoles[roles] = MainConfig.getMainConfig().getList("add-roles").get(roles).toString();
DiscordClient.allowedToAddRoles[roles] = DiscordWhitelister.mainConfig.getFileConfiguration().getList("add-roles").get(roles).toString();
}
// set limited add roles
DiscordClient.allowedToAddLimitedRoles = new String[MainConfig.getMainConfig().getList("limited-add-roles").size()];
DiscordClient.allowedToAddLimitedRoles = new String[DiscordWhitelister.mainConfig.getFileConfiguration().getList("limited-add-roles").size()];
for(int roles = 0; roles < DiscordClient.allowedToAddLimitedRoles.length; ++roles)
{
DiscordClient.allowedToAddLimitedRoles[roles] = MainConfig.getMainConfig().getList("limited-add-roles").get(roles).toString();
DiscordClient.allowedToAddLimitedRoles[roles] = DiscordWhitelister.mainConfig.getFileConfiguration().getList("limited-add-roles").get(roles).toString();
}
// Get banned roles
if(useOnBanEvents)
{
List<String> tempBannedRoles = MainConfig.getMainConfig().getStringList("banned-roles");
List<String> tempBannedRoles = DiscordWhitelister.mainConfig.getFileConfiguration().getStringList("banned-roles");
bannedRoles = new String[tempBannedRoles.size()];
for(int i = 0; i < tempBannedRoles.size(); i++)
{
@ -212,10 +220,10 @@ public class DiscordWhitelister extends JavaPlugin
}
// Allowed to clear name roles
DiscordClient.allowedToClearNamesRoles = new String[MainConfig.getMainConfig().getStringList("clear-command-roles").size()];
DiscordClient.allowedToClearNamesRoles = new String[DiscordWhitelister.mainConfig.getFileConfiguration().getStringList("clear-command-roles").size()];
for(int roles = 0; roles < DiscordClient.allowedToClearNamesRoles.length; roles++)
{
DiscordClient.allowedToClearNamesRoles[roles] = MainConfig.getMainConfig().getStringList("clear-command-roles").get(roles);
DiscordClient.allowedToClearNamesRoles[roles] = DiscordWhitelister.mainConfig.getFileConfiguration().getStringList("clear-command-roles").get(roles);
}
// All roles combined for role check
@ -224,8 +232,8 @@ public class DiscordWhitelister extends JavaPlugin
.flatMap(Stream::of).toArray(String[]::new);
// Custom messages check
useCustomMessages = MainConfig.getMainConfig().getBoolean("use-custom-messages");
useCustomPrefixes = MainConfig.getMainConfig().getBoolean("use-custom-prefixes");
useCustomMessages = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-custom-messages");
useCustomPrefixes = DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-custom-prefixes");
int initSuccess = DiscordClient.InitializeClient(botToken);
@ -235,7 +243,7 @@ public class DiscordWhitelister extends JavaPlugin
// No need for an if here statement anymore as this code will not run if the client has not been initialized
// Only attempt to set player count if the bot successfully initialized
if(MainConfig.getMainConfig().getBoolean("show-player-count"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("show-player-count"))
{
// Register events if enabled
thisServer.getPluginManager().registerEvents(new JoinLeaveEvents(), thisPlugin);
@ -261,12 +269,11 @@ public class DiscordWhitelister extends JavaPlugin
public static void ConfigSetup()
{
// Run this first, as it creates the root folder if it does not exist
MainConfig.ConfigSetup();
CustomPrefixConfig.ConfigSetup();
CustomMessagesConfig.ConfigSetup();
PermissionsConfig.ConfigSetup();
OnWhitelistCommandsConfig.ConfigSetup();
mainConfig.ConfigSetup();
customPrefixConfig.ConfigSetup();
customMessagesConfig.ConfigSetup();
permissionsConfig.ConfigSetup();
onWhitelistCommandsConfig.ConfigSetup();
// Init Stores
UserList.StoreSetup();

View File

@ -6,9 +6,6 @@ import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import uk.co.angrybee.joe.AuthorPermissions;
import uk.co.angrybee.joe.DiscordClient;
import uk.co.angrybee.joe.DiscordWhitelister;
import uk.co.angrybee.joe.configs.MainConfig;
import uk.co.angrybee.joe.configs.OnWhitelistCommandsConfig;
import uk.co.angrybee.joe.configs.PermissionsConfig;
import uk.co.angrybee.joe.stores.InGameRemovedList;
import uk.co.angrybee.joe.stores.RemovedList;
import uk.co.angrybee.joe.stores.UserList;
@ -17,7 +14,6 @@ import uk.co.angrybee.joe.stores.WhitelistedPlayers;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@ -438,7 +434,7 @@ public class CommandAdd
if(DiscordWhitelister.showPlayerSkin)
{
if(!MainConfig.getMainConfig().getBoolean("use-crafatar-for-avatars"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-crafatar-for-avatars"))
embedBuilderWhitelistSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
else
embedBuilderWhitelistSuccess.setThumbnail("https://crafatar.com/avatars/" + playerUUID + "?size=100&default=MHF_Steve&overlay.png");
@ -474,7 +470,7 @@ public class CommandAdd
if (!WhitelistedPlayers.usingEasyWhitelist && authorPermissions.isUserCanUseCommand())
DiscordClient.ExecuteServerCommand("whitelist add " + finalNameToAdd);
if(MainConfig.getMainConfig().getBoolean("use-geyser/floodgate-compatibility")) {
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-geyser/floodgate-compatibility")) {
addBedrockUser(finalNameToAdd);
}
@ -497,7 +493,7 @@ public class CommandAdd
if(DiscordWhitelister.useOnWhitelistCommands)
{
List<String> commandsToExecute = OnWhitelistCommandsConfig.getPermissionsConfig().getStringList("on-whitelist-commands");
List<String> commandsToExecute = DiscordWhitelister.onWhitelistCommandsConfig.getFileConfiguration().getStringList("on-whitelist-commands");
for (String command : commandsToExecute)
{
DiscordClient.CheckAndExecuteCommand(command, finalNameToAdd);
@ -558,15 +554,15 @@ public class CommandAdd
// Instructional message
if(successfulWhitelist.get())
{
if(MainConfig.getMainConfig().getBoolean("send-instructional-message-on-whitelist"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("send-instructional-message-on-whitelist"))
{
if(!MainConfig.getMainConfig().getBoolean("use-timer-for-instructional-message"))
if(!DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-timer-for-instructional-message"))
{
channel.sendMessage(DiscordClient.CreateInstructionalMessage()).queue();
}
else
{
int waitTime = MainConfig.getMainConfig().getInt("timer-wait-time-in-seconds");
int waitTime = DiscordWhitelister.mainConfig.getFileConfiguration().getInt("timer-wait-time-in-seconds");
// Run on a new thread to not block main thread
Thread whitelisterTimerThread = new Thread(() ->
@ -618,7 +614,7 @@ public class CommandAdd
}
private static void addBedrockUser(String finalNameToAdd) {
String bedrockPrefix = MainConfig.getMainConfig().getString("geyser/floodgate prefix");
String bedrockPrefix = DiscordWhitelister.mainConfig.getFileConfiguration().getString("geyser/floodgate prefix");
String bedrockName = bedrockPrefix + finalNameToAdd;
if(bedrockName.length() > 16) {
bedrockName = bedrockName.substring(0, 16);

View File

@ -0,0 +1,70 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
import java.io.File;
import java.io.IOException;
public class Config {
protected String fileName;
protected File file;
protected FileConfiguration fileConfiguration;
protected boolean fileCreated = false;
public FileConfiguration getFileConfiguration() { return fileConfiguration; }
protected void CreateConfig()
{
try
{
file.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("Created file " + fileName);
fileCreated = true;
}
protected void LoadConfigFile()
{
try
{
fileConfiguration.load(file);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
protected void SaveConfig()
{
try
{
fileConfiguration.save(file.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void CheckEntry(String entryName, Object passedValue)
{
if(fileConfiguration.get(entryName) == null)
{
fileConfiguration.set(entryName, passedValue);
if(!fileCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to "+fileName);
}
}
}

View File

@ -1,29 +1,22 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
import java.io.File;
import java.io.IOException;
// custom-messages.yml
public class CustomMessagesConfig
public class CustomMessagesConfig extends Config
{
private static File customMessagesFile;
private static FileConfiguration customMessagesConfig;
public CustomMessagesConfig(){
fileName = "custom-messages.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();
}
public static FileConfiguration getCustomMessagesConfig() { return customMessagesConfig; }
private static boolean customMessagesFileCreated = false;
public static void ConfigSetup()
public void ConfigSetup()
{
customMessagesFile = new File(DiscordWhitelister.getPlugin().getDataFolder(), "custom-messages.yml");
customMessagesConfig = new YamlConfiguration();
if(!customMessagesFile.exists())
if(!file.exists())
CreateConfig();
LoadConfigFile();
@ -31,34 +24,7 @@ public class CustomMessagesConfig
SaveConfig();
}
private static void CreateConfig()
{
try
{
customMessagesFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("Custom messages file created at: " + customMessagesFile.getPath());
customMessagesFileCreated = true;
}
private static void LoadConfigFile()
{
try
{
customMessagesConfig.load(customMessagesFile);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
private static void CheckEntries()
private void CheckEntries()
{
/* TODO: add a YAML comment (#) explaining the config file params
NOTE: only {params} in the original messages will be evaluated. For example: using {MaxWhitelistAmount} in the "insufficient-permissions" String will not work as it was never in the original message.
@ -66,7 +32,7 @@ public class CustomMessagesConfig
{MinecraftUsername} == finalNameToAdd/Remove, {StaffMember} == DiscordWhitelister.getRemovedList().get(finalNameToAdd), {AddRemoveRoles} = DiscordWhitelister.getWhitelisterBotConfig().getList("add-remove-roles")
Internal error messages & info messages will remain uneditable. No need to add custom remove failure messages as it should never happen */
if(customMessagesFile.exists())
if(file.exists())
{
CheckEntry("insufficient-permissions-title", "Insufficient Permissions");
CheckEntry("insufficient-permissions", "{Sender}, you do not have permission to use this command.");
@ -135,27 +101,4 @@ public class CustomMessagesConfig
CheckEntry("command-channel-message", "{Sender}, this channel is for commands only, please use another channel.");
}
}
private static void SaveConfig()
{
try
{
customMessagesConfig.save(customMessagesFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
private static void CheckEntry(String entryName, Object passedValue)
{
if(customMessagesConfig.get(entryName) == null)
{
customMessagesConfig.set(entryName, passedValue);
if(!customMessagesFileCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to custom-messages.yml...");
}
}
}

View File

@ -1,7 +1,6 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
@ -9,21 +8,18 @@ import java.io.File;
import java.io.IOException;
// custom-prefixes.yml
public class CustomPrefixConfig
public class CustomPrefixConfig extends Config
{
private static File customPrefixesFile;
private static FileConfiguration customPrefixesConfig;
public CustomPrefixConfig() {
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), "custom-prefixes.yml");
fileConfiguration = new YamlConfiguration();
}
public static FileConfiguration getCustomPrefixesConfig() { return customPrefixesConfig; }
private static boolean customPrefixesFileCreated = false;
public static void ConfigSetup()
public void ConfigSetup()
{
customPrefixesFile = new File(DiscordWhitelister.getPlugin().getDataFolder(), "custom-prefixes.yml");
customPrefixesConfig = new YamlConfiguration();
if(!customPrefixesFile.exists())
if(!file.exists())
CreateConfig();
LoadConfigFile();
@ -31,36 +27,9 @@ public class CustomPrefixConfig
SaveConfig();
}
private static void CreateConfig()
private void CheckEntries()
{
try
{
customPrefixesFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("Custom Prefixes file created at: " + customPrefixesFile.getPath());
customPrefixesFileCreated = true;
}
private static void LoadConfigFile()
{
try
{
customPrefixesConfig.load(customPrefixesFile);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
private static void CheckEntries()
{
if(customPrefixesFile.exists())
if(file.exists())
{
CheckEntry("whitelist-add-prefix", "!whitelist add");
@ -75,27 +44,4 @@ public class CustomPrefixConfig
CheckEntry("whitelist-whois-prefix", "!whitelist whois");
}
}
private static void SaveConfig()
{
try
{
customPrefixesConfig.save(customPrefixesFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
private static void CheckEntry(String entryName, Object passedValue)
{
if(customPrefixesConfig.get(entryName) == null)
{
customPrefixesConfig.set(entryName, passedValue);
if(!customPrefixesFileCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to custom-prefixes.yml...");
}
}
}

View File

@ -1,6 +1,5 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
@ -11,66 +10,42 @@ import java.util.Arrays;
import java.util.Collections;
// discord-whitelister.yml
public class MainConfig
{
private static File whitelisterBotConfigFile;
private static FileConfiguration whitelisterBotConfig;
public class MainConfig extends Config {
MainConfig() {
fileName = "discord-whitelister.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();
}
public static FileConfiguration getMainConfig() { return whitelisterBotConfig; }
public FileConfiguration getFileConfiguration() {
return fileConfiguration;
}
public static boolean configCreated = false;
public boolean fileCreated = false;
public void ConfigSetup() {
public static void ConfigSetup()
{
whitelisterBotConfigFile = new File(DiscordWhitelister.getPlugin().getDataFolder(), "discord-whitelister.yml");
whitelisterBotConfig = new YamlConfiguration();
// Create root folder for configs if it does not exist
if(!whitelisterBotConfigFile.getParentFile().exists())
whitelisterBotConfigFile.getParentFile().mkdirs();
if (!file.getParentFile().exists())
file.getParentFile().mkdirs();
if(!whitelisterBotConfigFile.exists())
if (!file.exists()) {
CreateConfig();
DiscordWhitelister.getPluginLogger().info("Configuration file created at: " + file.getPath() +
", please edit this else the plugin will not work!");
}
LoadConfigFile();
CheckEntries();
SaveConfig();
}
private static void CreateConfig()
{
try
{
whitelisterBotConfigFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("Configuration file created at: " + whitelisterBotConfigFile.getPath() +
", please edit this else the plugin will not work!");
configCreated = true;
}
private static void LoadConfigFile()
{
try
{
whitelisterBotConfig.load(whitelisterBotConfigFile);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
private static void CheckEntries()
{
private void CheckEntries() {
CheckEntry("bot-enabled", true);
CheckEntry("discord-bot-token",
"Discord bot token goes here, you can find it here: https://discordapp.com/developers/applications/" );
"Discord bot token goes here, you can find it here: https://discordapp.com/developers/applications/");
CheckEntry("use-id-for-roles", false);
@ -168,45 +143,20 @@ public class MainConfig
CheckEntry("role-to-check-for", "Twitch Subscriber");
// Remove old role entry if found, move role to new array (for people with v1.3.6 or below)
if(whitelisterBotConfig.get("whitelisted-role") != null)
{
if (fileConfiguration.get("whitelisted-role") != null) {
DiscordWhitelister.getPluginLogger().warning("Found whitelisted-role entry, moving over to whitelisted-roles. Please check your config to make sure the change is correct");
// Get the role from the old entry
String whitelistedRoleTemp = whitelisterBotConfig.getString("whitelisted-role");
String whitelistedRoleTemp = fileConfiguration.getString("whitelisted-role");
// Assign role from old entry to new entry as a list
whitelisterBotConfig.set("whitelisted-roles", Collections.singletonList(whitelistedRoleTemp));
fileConfiguration.set("whitelisted-roles", Collections.singletonList(whitelistedRoleTemp));
// Remove now un-used entry
whitelisterBotConfig.set("whitelisted-role", null);
fileConfiguration.set("whitelisted-role", null);
// Note to users that id for roles now affects the new entry
if(whitelisterBotConfig.getBoolean("use-id-for-roles"))
{
if (fileConfiguration.getBoolean("use-id-for-roles")) {
DiscordWhitelister.getPluginLogger().severe("You have 'use-id-for-roles' enabled please change the whitelisted-roles to ids as they now follow this setting");
}
}
}
private static void SaveConfig()
{
try
{
whitelisterBotConfig.save(whitelisterBotConfigFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
private static void CheckEntry(String entryName, Object passedValue)
{
if(whitelisterBotConfig.get(entryName) == null)
{
whitelisterBotConfig.set(entryName, passedValue);
if(!configCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to the config...");
}
}
}

View File

@ -1,7 +1,4 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
@ -10,21 +7,15 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
public class OnWhitelistCommandsConfig
{
private static File onWhitelistCommandsConfigFile;
private static FileConfiguration onWhitelistCommandsConfig;
public class OnWhitelistCommandsConfig extends Config {
OnWhitelistCommandsConfig() {
fileName = "on-whitelist-commands.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();
}
public static FileConfiguration getPermissionsConfig() { return onWhitelistCommandsConfig; }
private static boolean onWhitelistCommandsFileCreated = false;
public static void ConfigSetup()
{
onWhitelistCommandsConfigFile = new File(DiscordWhitelister.getPlugin().getDataFolder(), "on-whitelist-commands.yml");
onWhitelistCommandsConfig = new YamlConfiguration();
if(!onWhitelistCommandsConfigFile.exists())
public void ConfigSetup() {
if (!file.exists())
CreateConfig();
LoadConfigFile();
@ -32,53 +23,20 @@ public class OnWhitelistCommandsConfig
SaveConfig();
}
private static void CreateConfig()
{
try
{
onWhitelistCommandsConfigFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("on whitelist commands file created at: " + onWhitelistCommandsConfigFile.getPath());
onWhitelistCommandsFileCreated = true;
}
private static void LoadConfigFile()
{
try
{
onWhitelistCommandsConfig.load(onWhitelistCommandsConfigFile);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
private static void CheckEntries()
{
if(onWhitelistCommandsConfigFile.exists())
{
private void CheckEntries() {
if (file.exists()) {
// Write comments
if(onWhitelistCommandsFileCreated)
{
if (fileCreated) {
SaveConfig(); // save and load again
try
{
FileWriter fileWriter = new FileWriter(onWhitelistCommandsConfigFile);
try {
FileWriter fileWriter = new FileWriter(file);
fileWriter.write("# The list of commands that will be dispatched when a player gets whitelisted. (Use the following syntax: \n"
+ "# \"%TYPE%:%COMMAND%\", being %TYPE% whether 'CONSOLE' or 'PLAYER' and the command without the slash (/)\n"
+ "# placeholder %PLAYER% is supported here).\n"
+ "# NOTE: The 'PLAYER' type will only work if the target whitelisted player is in the server at the time of command dispatch.");
+ "# \"%TYPE%:%COMMAND%\", being %TYPE% whether 'CONSOLE' or 'PLAYER' and the command without the slash (/)\n"
+ "# placeholder %PLAYER% is supported here).\n"
+ "# NOTE: The 'PLAYER' type will only work if the target whitelisted player is in the server at the time of command dispatch.");
fileWriter.close();
}
catch (IOException e)
{
} catch (IOException e) {
e.printStackTrace();
}
LoadConfigFile();
@ -87,27 +45,4 @@ public class OnWhitelistCommandsConfig
CheckEntry("on-whitelist-commands", Arrays.asList("CONSOLE:gamemode adventure %PLAYER%", "CONSOLE:say hello testing"));
}
}
private static void SaveConfig()
{
try
{
onWhitelistCommandsConfig.save(onWhitelistCommandsConfigFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
private static void CheckEntry(String entryName, Object passedValue)
{
if(onWhitelistCommandsConfig.get(entryName) == null)
{
onWhitelistCommandsConfig.set(entryName, passedValue);
if(!onWhitelistCommandsFileCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to on-whitelist-permissions.yml...");
}
}
}

View File

@ -1,29 +1,19 @@
package uk.co.angrybee.joe.configs;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import uk.co.angrybee.joe.DiscordWhitelister;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
public class PermissionsConfig
{
private static File permissionsConfigFile;
private static FileConfiguration permissionsConfig;
public class PermissionsConfig extends Config {
public PermissionsConfig() {
fileName = "on-whitelist-permissions.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();
}
public static FileConfiguration getPermissionsConfig() { return permissionsConfig; }
private static boolean permissionsFileCreated = false;
public static void ConfigSetup()
{
permissionsConfigFile = new File(DiscordWhitelister.getPlugin().getDataFolder(), "on-whitelist-permissions.yml");
permissionsConfig = new YamlConfiguration();
if(!permissionsConfigFile.exists())
public void ConfigSetup() {
if (!file.exists())
CreateConfig();
LoadConfigFile();
@ -31,62 +21,10 @@ public class PermissionsConfig
SaveConfig();
}
private static void CreateConfig()
{
try
{
permissionsConfigFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
DiscordWhitelister.getPluginLogger().info("on whitelist permissions file created at: " + permissionsConfigFile.getPath());
permissionsFileCreated = true;
}
private static void LoadConfigFile()
{
try
{
permissionsConfig.load(permissionsConfigFile);
}
catch (IOException | InvalidConfigurationException e)
{
e.printStackTrace();
}
}
private static void CheckEntries()
{
if(permissionsConfigFile.exists())
{
private void CheckEntries() {
if (file.exists()) {
// test permission
CheckEntry("perms-on-whitelist", Collections.singletonList("bukkit.command.tps"));
}
}
private static void SaveConfig()
{
try
{
permissionsConfig.save(permissionsConfigFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
}
private static void CheckEntry(String entryName, Object passedValue)
{
if(permissionsConfig.get(entryName) == null)
{
permissionsConfig.set(entryName, passedValue);
if(!permissionsFileCreated)
DiscordWhitelister.getPluginLogger().warning("Entry '" + entryName + "' was not found, adding it to on-whitelist-permissions.yml...");
}
}
}

View File

@ -120,7 +120,7 @@ public class OnBanEvent implements Listener
// Remove the whitelisted role(s)
DiscordClient.RemoveRolesFromUser(guild, discordId, Arrays.asList(DiscordClient.whitelistedRoleNames));
// Add the banned role(s)
DiscordClient.AssignRolesToUser(guild, discordId, (List<String>) MainConfig.getMainConfig().get("banned-roles"));
DiscordClient.AssignRolesToUser(guild, discordId, (List<String>) DiscordWhitelister.mainConfig.getFileConfiguration().get("banned-roles"));
}
idFound = true;
break;

View File

@ -29,7 +29,7 @@ public class WhitelistedPlayers
public static void Setup()
{
// Check if we are using EasyWhitelist
if(MainConfig.getMainConfig().getBoolean("use-easy-whitelist"))
if(DiscordWhitelister.mainConfig.getFileConfiguration().getBoolean("use-easy-whitelist"))
GetEasyWhitelist();
if(usingEasyWhitelist)