File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/main/java/ad1tya2/adiauth/Bungee/events Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,18 @@ public void onMessageReceived(MessageReceivedEvent event)
4848 {
4949 String code = event .getMessage ().getContentRaw ();
5050 UserProfile profile = pendingRegistrations .get (code );
51+ UserProfile discordAuthorProfile = storage .getPlayerByDiscord (event .getAuthor ().getId ());
5152 if (profile == null ){
5253 return ;
5354 }
55+
56+ if (profile .discordId != null || discordAuthorProfile != null ){
57+ profile .discordLoginPending = false ;
58+ event .getMessage ().reply ("You can only link one discord account to one minecraft account." ).queue ();
59+ pendingRegistrations .remove (code );
60+ return ;
61+ }
62+
5463 ProxiedPlayer p = ProxyServer .getInstance ().getPlayer (profile .username );
5564 if (profile .discordLoginPending && code .equals (String .valueOf (profile .getTwoFactorCode ())) && p != null ){
5665 profile .loggedInPlayer (p );
@@ -60,6 +69,7 @@ public void onMessageReceived(MessageReceivedEvent event)
6069 event .getGuild ().addRoleToMember (event .getMember (), event .getGuild ().getRoleById (Config .Discord .roleToGive )).queue ();
6170 }
6271 event .getMessage ().reply ("2fa Successfully enabled!" ).queue ();
72+ pendingRegistrations .remove (code );
6373 storage .updatePlayer (profile );
6474 }
6575 }
You can’t perform that action at this time.
0 commit comments