Added kick method for joinverifier

This commit is contained in:
Deichor 2024-12-10 03:22:39 +03:00
parent e02fa4381c
commit 7ee82882fc
2 changed files with 14 additions and 1 deletions

View File

@ -94,6 +94,18 @@ public class OnJoinVerifier implements Reloadable {
}
}
/**
* Checks whether email verification is required, and if so, whether the email is verified.
*
* @param isAuthAvailable whether or not the player's email is verified
* @throws FailedVerificationException if the email verification is not completed
*/
public void checkKickNotVerified(boolean isAuthAvailable) throws FailedVerificationException {
if (!isAuthAvailable && settings.getProperty(RestrictionSettings.KICK_NOT_VERIFIED)) {
throw new FailedVerificationException(MessageKey.MUST_VERIFIED_MESSAGE);
}
}
/**
* Checks that the name adheres to the configured username restrictions.
*

View File

@ -150,8 +150,9 @@ public class PlayerListener implements Listener {
// Slow, blocking checks
try {
final PlayerAuth auth = dataSource.getAuth(name);
final boolean isAuthAvailable = auth != null;
final boolean isAuthAvailable = auth != null && auth.isEmailVerified();
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
onJoinVerifier.checkKickNotVerified(isAuthAvailable);
onJoinVerifier.checkAntibot(name, isAuthAvailable);
onJoinVerifier.checkNameCasing(name, auth);
final String ip = event.getAddress().getHostAddress();