diff --git a/src/main/java/com/hypherionmc/sdlink/core/config/SDLinkConfig.java b/src/main/java/com/hypherionmc/sdlink/core/config/SDLinkConfig.java index 3a6280a..0ce4990 100644 --- a/src/main/java/com/hypherionmc/sdlink/core/config/SDLinkConfig.java +++ b/src/main/java/com/hypherionmc/sdlink/core/config/SDLinkConfig.java @@ -24,7 +24,7 @@ public class SDLinkConfig extends ModuleConfig { // DO NOT REMOVE TRANSIENT HERE... OTHERWISE, THE STUPID CONFIG LIBRARY // WILL TRY TO WRITE THESE TO THE CONFIG public transient static SDLinkConfig INSTANCE; - public transient static int configVer = 13; + public transient static int configVer = 14; public transient static boolean hasConfigLoaded = false; @Path("general") diff --git a/src/main/java/com/hypherionmc/sdlink/core/config/impl/AccessControl.java b/src/main/java/com/hypherionmc/sdlink/core/config/impl/AccessControl.java index 71dd297..7cdffe5 100644 --- a/src/main/java/com/hypherionmc/sdlink/core/config/impl/AccessControl.java +++ b/src/main/java/com/hypherionmc/sdlink/core/config/impl/AccessControl.java @@ -20,6 +20,10 @@ public class AccessControl { @SpecComment("Does the player need to be a member of your discord to join") public boolean requireDiscordMembership = false; + @Path("allowMultipleAccounts") + @SpecComment("Can players verify multiple Minecraft Accounts") + public boolean allowMultipleAccounts = false; + @Path("requiredRoles") @SpecComment("Optional: The player requires any of these roles to be able to join your server") public List requiredRoles = new ArrayList<>(); diff --git a/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/verification/VerifyAccountCommand.java b/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/verification/VerifyAccountCommand.java index 3cea32f..ae417b8 100644 --- a/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/verification/VerifyAccountCommand.java +++ b/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/verification/VerifyAccountCommand.java @@ -5,6 +5,7 @@ package com.hypherionmc.sdlink.core.discord.commands.slash.verification; import com.hypherionmc.sdlink.core.accounts.MinecraftAccount; +import com.hypherionmc.sdlink.core.config.SDLinkConfig; import com.hypherionmc.sdlink.core.database.SDLinkAccount; import com.hypherionmc.sdlink.core.discord.commands.slash.SDLinkSlashCommand; import com.hypherionmc.sdlink.core.messaging.Result; @@ -48,11 +49,17 @@ public class VerifyAccountCommand extends SDLinkSlashCommand { } boolean didVerify = false; + boolean hasRejected = false; for (SDLinkAccount account : accounts) { if (account.getVerifyCode() == null) continue; + if (accounts.stream().anyMatch(a -> a.getDiscordID() != null && a.getDiscordID().equals(event.getMember().getId())) && !SDLinkConfig.INSTANCE.accessControl.allowMultipleAccounts) { + event.getHook().sendMessage("Sorry, you already have a verified account and this server does not allow multiple accounts").queue(); + return; + } + if (account.getVerifyCode().equalsIgnoreCase(String.valueOf(mcCode))) { MinecraftAccount minecraftAccount = MinecraftAccount.of(account.getUsername()); Result result = minecraftAccount.verifyAccount(event.getMember(), event.getGuild());