rip_monsterz

MASTER PROJECT PROMPT — NOVAAUTH

Complete Minecraft Authentication Plugin Inspired by LCAuth

Act as a senior Minecraft plugin developer, Java software architect, cybersecurity engineer, database engineer, and quality assurance engineer.

Build a complete, functional, production-oriented Minecraft authentication plugin called NovaAuth, inspired by the publicly described features of LCAuth/LCAuthMe.

The goal is to create an original authentication plugin with comparable functionality, extensive configuration, secure account management, a polished authentication interface, and support for Minecraft server networks.

Do not copy proprietary source code, branding, or undocumented internal implementations from other plugins. Implement the requested features independently.

Most important requirement: Produce actual, compilable source code. Do not merely describe how to create the plugin, provide pseudocode, or leave major features as TODO comments.

---

  1. Project Requirements and Technology

Use the following defaults:

  • Plugin name: NovaAuth
  • Programming language: Java
  • Java version: Java 21
  • Primary server platform: Paper 1.21.x
  • Additional platforms: Spigot and Purpur where compatible
  • Proxy platforms: Velocity and BungeeCord
  • Build system: Gradle or Maven
  • Configuration format: YAML
  • Default database: SQLite
  • Optional databases: MySQL/MariaDB
  • Text API: Adventure API
  • Message formatting: MiniMessage, with configurable legacy color support
  • Password hashing: BCrypt or another established password-hashing algorithm with secure parameters
  • Permission manager compatibility: LuckPerms and standard Bukkit permissions

Use real, compatible dependency versions and documented platform APIs.

Organize the project into separate modules when necessary. Keep authentication logic independent of platform-specific implementations.

The primary deliverable is a working Paper plugin JAR. Other platforms must have genuine implementations and separate compatible JARs when necessary. Do not claim compatibility with platforms that have not been implemented and tested.

  1. Complete Authentication System

Implement registration, login, account management, and authentication-state tracking.

Player commands

Implement:

  • "/register <password> <confirmPassword>"
  • "/login <password>"
  • "/logout"
  • "/changepassword <oldPassword> <newPassword>"
  • "/unregister"
  • "/auth help"
  • "/auth status"

Support configurable command aliases, syntax, and messages.

Registration features

Include:

  • Registration enable/disable setting.
  • Password confirmation.
  • Configurable minimum password length.
  • Configurable maximum password length.
  • Configurable password strength requirements.
  • Optional uppercase, lowercase, number, and special-character requirements.
  • Optional common-password rejection.
  • Optional banned-password file validation.
  • Configurable maximum registered accounts per IP.
  • Configurable registration cooldown.
  • Configurable registration timeout.
  • Configurable username validation.
  • UUID-based account identification.
  • Username history where appropriate.
  • First-join behavior.
  • Configurable registration messages.
  • Configurable registration spawn.
  • Prevention of duplicate account registration.

Never store passwords in plaintext.

Do not assume IP addresses uniquely identify people or accounts.

Login features

Include:

  • Password verification.
  • Configurable login timeout.
  • Configurable maximum failed attempts.
  • Configurable lockout duration.
  • Optional progressive delays.
  • Per-player and per-IP rate limits.
  • Configurable login messages.
  • Login success and failure sounds.
  • Configurable login title, subtitle, actionbar, and bossbar.
  • Configurable login spawn.
  • Safe session restoration.
  • Duplicate-session protection.
  • Disconnect cleanup.
  • Session invalidation after password changes or account resets.

Handle simultaneous logins, database failures, and disconnects during asynchronous authentication operations safely.

  1. Gameplay Restrictions Before Authentication

Unauthenticated players must not be able to access normal gameplay.

Provide separate configuration options for:

  • Movement.
  • Block breaking.
  • Block placement.
  • Entity interaction.
  • Entity damage.
  • PvP.
  • Item drops.
  • Item pickups.
  • Inventory interaction.
  • Chat.
  • Private messaging.
  • Commands.
  • Teleportation.
  • Hunger changes.
  • Flight.
  • World changes.
  • Game mode changes.
  • Vehicle use.
  • Item consumption.
  • Projectile use.
  • Opening containers.
  • Interacting with NPCs.
  • Other supported gameplay actions.

Allow an administrator to configure an allowlist of commands usable before authentication.

Prevent unauthorized teleportation or escape from the authentication environment.

Optional features:

  • Adventure mode during authentication.
  • Blindness or other configurable visual effects.
  • Authentication spawn.
  • Temporary movement restrictions.
  • Temporary invulnerability where appropriate.

Restore temporary effects and player state correctly after authentication. Avoid accidentally overwriting legitimate inventory, game mode, location, or status changes.

Do not cancel events for authenticated players unnecessarily.

  1. Login Timeout and Sessions

Implement:

  • Configurable login timeout.
  • Configurable registration timeout.
  • Countdown in titles, actionbar, or bossbar.
  • Automatic kick after timeout.
  • Configurable timeout messages.
  • Session expiration.
  • Optional trusted-session auto-login.
  • Configurable session duration.
  • Optional IP-bound sessions.
  • Optional session persistence.
  • Duplicate-session detection.
  • Logout and session invalidation.
  • Session cleanup after disconnect.
  • Session invalidation after password changes.
  • Safe behavior after server restarts.

Never trust an IP address alone as proof of account ownership.

Use secure session identifiers when needed. Never expose session tokens through messages, commands, placeholders, or logs.

  1. Premium Account Authentication

Implement optional premium-account authentication and auto-login.

Include:

  • Configurable premium verification.
  • Optional premium auto-login.
  • Separate settings for premium and non-premium users.
  • Verification-result caching with configurable expiration.
  • Safe handling of verification timeouts.
  • Configurable fallback behavior.
  • Premium-related messages.
  • Proper interaction with online-mode servers and authenticated proxy configurations.

Never trust an unverified client claim as proof of premium ownership.

Do not bypass account security simply because a player claims to own a premium account.

Document limitations on offline-mode servers and proxy networks.

  1. Geyser and Floodgate Support

Provide optional compatibility with Geyser and Floodgate.

Include:

  • Java/Bedrock player detection where supported.
  • Configurable Bedrock authentication requirements.
  • Optional trusted Floodgate authentication bypass.
  • Configurable Bedrock-specific messages.
  • Correct handling of UUIDs and usernames.
  • Separate Java and Bedrock settings.
  • Graceful startup when integrations are absent.

Only trust Floodgate identity information when the server and proxy forwarding configuration is secure.

Do not require Geyser or Floodgate for ordinary Java server operation.

  1. Customizable Branding and Plugin Name

The displayed plugin name must be configurable globally.

In "config.yml", include:

branding: name: "NovaAuth" prefix: "&8[&bNovaAuth&8] " scoreboard-title: "&bNovaAuth"

Requirements:

  • The default displayed name is "NovaAuth".
  • If the administrator changes "branding.name" to "MyAuth", all supported messages and interfaces using the plugin name must display "MyAuth".
  • Use a centralized branding service.
  • Do not hardcode "NovaAuth" throughout Java classes, messages, or interface templates.
  • Provide "{plugin_name}" and "{prefix}" placeholders.
  • Automatically generate the default prefix from the configured name unless a custom prefix is explicitly configured.
  • Allow a custom prefix independent of the plugin name.
  • Make title, subtitle, actionbar, bossbar, kick message, help message, error message, and scoreboard branding configurable.
  • Support RGB colors and HEX formatting where supported.
  • Apply branding changes after "/novaauth reload" wherever possible.
  • Do not change the internal Java package, plugin metadata identity, or JAR filename when the displayed name changes.

The scoreboard title must be configurable independently through "branding.scoreboard-title".

If an authentication scoreboard is implemented, allow its title and displayed content to be customized. Do not claim to support a scoreboard that has not been implemented.

  1. Authentication Interface

Create a polished, customizable authentication interface.

Titles and subtitles

Support:

  • Login title.
  • Login subtitle.
  • Registration title.
  • Registration subtitle.
  • Login success title.
  • Registration success title.
  • Login failure title.
  • Configurable fade-in, stay, and fade-out durations.
  • RGB and HEX colors where supported.

Actionbar

Support:

  • Configurable login instructions.
  • Configurable registration instructions.
  • Animated countdown.
  • Remaining-time placeholders.
  • Authentication-state messages.
  • Configurable refresh interval.

Bossbar

Support:

  • Enable/disable setting.
  • Configurable text.
  • Configurable color.
  • Configurable overlay.
  • Countdown-based progress.
  • Separate login and registration displays.
  • Configurable update interval.

Sounds

Support configurable sounds for:

  • Join.
  • Login success.
  • Registration success.
  • Login failure.
  • Registration failure.
  • Timeout.
  • Password change.
  • Administrative password reset.

Allow individual sounds to be disabled and configure volume and pitch.

Formatting

Use Adventure API and MiniMessage where appropriate.

Support:

  • Legacy Minecraft color codes.
  • HEX colors.
  • Gradients where supported.
  • Placeholders.
  • Custom message prefixes.
  • Configurable interface animations.

Do not hardcode user-facing text.

  1. Authentication Isolation and Limbo

Provide an authentication isolation system that prevents unauthenticated players from accessing normal gameplay.

Include:

  • Optional authentication spawn.
  • Configurable registration and login destinations.
  • Optional blindness.
  • Optional adventure mode.
  • Optional movement restrictions.
  • Countdown display.
  • Automatic cleanup after login or disconnect.

A true proxy-level limbo environment may be implemented as an optional module if the chosen platform APIs support it.

Do not pretend that teleporting a player to a world is the same as implementing a real virtual limbo server.

Document any limitations and provide the closest functional alternative.

  1. Security System

Implement:

  • Secure password hashing.
  • Configurable password rules.
  • Banned-password checking.
  • Maximum failed login attempts.
  • Configurable lockout duration.
  • Per-account rate limiting.
  • Per-IP rate limiting.
  • Registration limits.
  • Anti-bot protections.
  • Session hijacking protection.
  • UUID-based account identification.
  • Prepared SQL statements.
  • SQL injection protection.
  • Secure random tokens where required.
  • Token expiration and one-time-use enforcement.
  • Secure database access.
  • Configurable security notifications.
  • Administrative audit logging.
  • Safe error handling.
  • Protection against concurrent login attempts.
  • Input validation.
  • Protection against denial-of-service attacks through excessive authentication requests.

Do not permanently lock legitimate users out because many players share an IP address.

Never log passwords, password hashes, recovery secrets, or session tokens.

Do not include hardcoded database passwords, API keys, or secrets.

  1. Administrative Commands

Register "/novaauth" as the main administrative command.

All administrative commands must require either:

  1. Minecraft operator status, or
  2. The exact permission node "NovaAuth.admin".

Enforce authorization server-side for every command. Do not rely on hiding commands from tab completion.

Support console execution where applicable. Commands that capture a player's current position must be executed by an authorized in-game player.

Command A: "/novaauth setregisterspawn"

Save the registration spawn.

When executed by an authorized player:

  • Record the current world name.
  • Record exact X, Y, and Z coordinates.
  • Record yaw and pitch.
  • Save the location in "config.yml".
  • Display a configurable success message.
  • Preserve the location after server restart.

When an unregistered player joins or must register again, teleport them to this saved location if configured.

Apply registration restrictions until registration succeeds.

Command B: "/novaauth setloginspawn"

Save the login spawn.

When executed by an authorized player:

  • Record the current world name.
  • Record exact X, Y, and Z coordinates.
  • Record yaw and pitch.
  • Save the location in "config.yml".
  • Display a configurable success message.

When a registered player joins and must log in, teleport them to this location if configured.

Do not unnecessarily teleport authenticated players to the login spawn.

Command C: "/novaauth setspawn"

Save the post-authentication spawn.

When executed by an authorized player:

  • Record the current world name.
  • Record exact X, Y, and Z coordinates.
  • Record yaw and pitch.
  • Save the location in "config.yml".
  • Display a configurable success message.

After successful login or registration, teleport the player to this location when configured.

Avoid duplicate teleportation and teleport loops.

If the location is unset, preserve the existing safe behavior instead of teleporting to invalid coordinates.

Command D: "/novaauth adminchangepassword <player> <password>"

Allow authorized administrators to change the password of an existing account.

Requirements:

  • Require operator status or "NovaAuth.admin".
  • Support online and offline accounts.
  • Do not accidentally create an account if the target does not exist.
  • Validate the new password against all enabled password rules.
  • Check the banned-password list when enabled.
  • Hash the new password securely.
  • Invalidate existing sessions and trusted authentication tokens.
  • Notify the target if online without exposing the password.
  • Notify the administrator of success or failure.
  • Record the administrator UUID, target UUID, timestamp, and outcome in the audit log.
  • Never log the supplied password or its hash.
  • Validate arguments and support permitted special characters.

Warn administrators that command arguments may be recorded by server command logs. Provide a safer password-reset workflow if supported by the platform.

Additional administrative commands

Implement:

  • "/novaauth reload"
  • "/novaauth info <player>"
  • "/novaauth unregister <player>"
  • "/novaauth resetpassword <player>"
  • "/novaauth lock <player>"
  • "/novaauth unlock <player>"
  • "/novaauth sessions <player>"
  • "/novaauth clearsessions <player>"
  • "/novaauth stats"
  • "/novaauth backup"
  • "/novaauth maintenance"
  • "/novaauth help"

Add:

  • Argument validation.
  • Tab completion.
  • Helpful usage messages.
  • Console support where applicable.
  • Permission checks.
  • Audit logging for sensitive administrative actions.
  • No sensitive password or token values in tab completion.

If "/novaauth resetpassword" is included, implement a real, secure reset flow instead of leaving it as a placeholder.

  1. Permissions

Implement and document granular permissions.

Examples:

  • "NovaAuth.admin"
  • "novaauth.login"
  • "novaauth.register"
  • "novaauth.logout"
  • "novaauth.changepassword"
  • "novaauth.reload"
  • "novaauth.info"
  • "novaauth.resetpassword"
  • "novaauth.unregister"
  • "novaauth.lock"
  • "novaauth.unlock"
  • "novaauth.sessions"
  • "novaauth.clearsessions"
  • "novaauth.setspawn"
  • "novaauth.stats"
  • "novaauth.backup"
  • "novaauth.bypass"
  • "novaauth.premium.bypass"

The main admin permission must be exactly "NovaAuth.admin".

Ensure compatibility with LuckPerms and standard server permissions.

Check operator status explicitly if operators must have access even without a separately assigned permission node.

Use secure permission defaults. Ordinary players must never gain administrative access by default.

  1. Spawn Configuration

All three spawn locations must be stored in "config.yml".

Use this structure:

spawns: register: world: "none" x: 0.0 y: 0.0 z: 0.0 yaw: 0.0 pitch: 0.0

login: world: "none" x: 0.0 y: 0.0 z: 0.0 yaw: 0.0 pitch: 0.0

after-authentication: world: "none" x: 0.0 y: 0.0 z: 0.0 yaw: 0.0 pitch: 0.0

Rules:

  • "world: "none"" means that a spawn is not configured.
  • Setting a spawn through an administrative command must update the corresponding section automatically.
  • Preserve world names, coordinates, yaw, and pitch across restarts.
  • Support manual configuration editing.
  • Validate world availability before teleportation.
  • Never teleport to an unset world.
  • If a world is unavailable, log a useful warning and use documented fallback behavior.
  • Support accessible loaded worlds, including worlds managed by supported multiverse plugins.
  • Preserve manually configured valid spawn locations.
  • Reload spawn settings safely.
  • Do not overwrite valid locations with default coordinates.
  1. Banned Password File

Create "banpasswords.txt" in the plugin data directory alongside "config.yml".

Example directory:

plugins/ └── NovaAuth/ ├── config.yml ├── messages.yml ├── titles.yml ├── actionbar.yml ├── bossbar.yml ├── sounds.yml ├── permissions.yml ├── database.yml └── banpasswords.txt

Create the file automatically on first startup.

Example file contents:

One banned password per line.

Blank lines and lines starting with # are ignored.

12345 12345678 password password123 qwerty123 minecraft

Banned-password configuration

Add this section to "config.yml":

password-security: banned-passwords: enabled: true file: "banpasswords.txt" case-insensitive: false trim-whitespace: false reload-on-startup: true

Required behavior

When enabled:

  • Reject registration if the password matches a banned entry.
  • Reject player password changes if the new password matches a banned entry.
  • Reject administrative password changes if the new password matches a banned entry.
  • Return a configurable message such as: "This password is not allowed. Please choose another password."
  • Do not reveal which specific banned password matched.
  • Never log the submitted password.
  • Ignore blank lines and comments.
  • Load the file on startup.
  • Reload the file after "/novaauth reload".
  • Recreate the file with default examples if missing.
  • Handle unreadable or malformed files safely.
  • Do not silently disable password protection if the file cannot be read.
  • Keep the file inside the plugin data directory.
  • Prevent path traversal outside the plugin data directory.
  • Do not automatically trim or alter the actual password unless the administrator explicitly enables that policy.
  • If case-insensitive matching is enabled, compare normalized copies without altering the password stored by the hashing system.
  • If "enabled: false", do not reject passwords solely because they appear in this file. All other enabled password rules remain active.

Validation order

For registration and password changes:

  1. Validate the request.
  2. Check password length and configured password rules.
  3. Check the banned-password list if enabled.
  4. Validate account-specific restrictions.
  5. Hash the accepted password securely.
  6. Save the password hash.
  7. Return a result without revealing the password.
Kodari AI
KodariOct 11 at 8:09 am 2
NovaAuth
NovaAuth is a comprehensive Minecraft authentication plugin providing secure registration, login, and account management systems. It features configurable password policies with banned-password validation, premium account verification, Geyser/Floodgate support, and a polished interface with titles, actionbars, bossbars, and sounds. The plugin implements gameplay restrictions before authentication, login timeouts, session management, and an isolation system with configurable spawns. Administrative tools include password resets, account locking, session management, statistics, backups, and audit logging. Built with Java 21 and Adventure API, it supports SQLite/MySQL databases and offers full branding customization.
  1. Build a Paper 1.21 plugin with SQLite/MySQL persistence, PBKDF2 password hashing, password rules, and banned-password enforcement.

  2. Add player authentication, gameplay isolation, timeout/interface handling, spawn management, and administrative commands.

  3. Create default YAML resources, permissions, build metadata, and the banned-password file; target Paper only rather than claim unimplemented proxy support.

Created the NovaAuth Paper plugin project with Java 21, SQLite/MySQL/MariaDB JDBC configuration, PBKDF2 password hashing, password-policy and banned-password checks, player authentication commands, pre-auth gameplay restrictions, authentication spawns, timeout displays, and administrative account commands with audit logging.

This build targets Paper only. It does not implement Velocity/Bungee limbo, premium-account verification, Floodgate identity integration, or persistent trusted sessions; the related configuration sections are not active integrations. I have not claimed compatibility with those platforms.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
21 2,085
src/main/java/com/novaauth/NovaAuth.java
package com.novaauth;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.security.SecureRandom;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;

public final class NovaAuth extends JavaPlugin {
    public enum State { PENDING, LOGIN, REGISTER, AUTHENTICATED }

    private final Map<UUID, State> states = new ConcurrentHashMap<>();
    private final Map<UUID, Long> joinedAt = new ConcurrentHashMap<>();
    private final Map<UUID, Long> lockedUntil = new ConcurrentHashMap<>();
    private final Map<UUID, Integer> failedAttempts = new ConcurrentHashMap<>();
    private final Map<UUID, Long> lastRequest = new ConcurrentHashMap<>();
    private final Map<String, ArrayList<Long>> ipAttempts = new ConcurrentHashMap<>();
    private final Map<String, Long> lastRegistration = new ConcurrentHashMap<>();
    private final Set<UUID> busy = ConcurrentHashMap.newKeySet();
    private final Set<UUID> allowedTeleports = ConcurrentHashMap.newKeySet();
    private final Set<UUID> internalGameModeChanges = ConcurrentHashMap.newKeySet();
    private final Map<UUID, GameMode> originalGameModes = new ConcurrentHashMap<>();
    private final Map<UUID, BossBar> bossBars = new ConcurrentHashMap<>();
    private final SecureRandom random = new SecureRandom();
    private AuthDatabase database;
    private PasswordPolicy passwordPolicy;
    private MessageService messages;
    private YamlConfiguration sounds;
    private long tick;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResourceIfMissing("database.yml");
        saveResourceIfMissing("messages.yml");
        saveResourceIfMissing("titles.yml");
        saveResourceIfMissing("actionbar.yml");
        saveResourceIfMissing("bossbar.yml");
        saveResourceIfMissing("sounds.yml");
        saveResourceIfMissing("permissions.yml");
        saveResourceIfMissing("banpasswords.txt");
        messages = new MessageService(this);
        sounds = loadYaml("sounds.yml");
        passwordPolicy = new PasswordPolicy(this);
        try {
            database = new AuthDatabase(this);
        } catch (Exception exception) {
            getLogger().severe("Unable to initialize the authentication database: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        NovaAuthCommand command = new NovaAuthCommand(this);
        for (String name : Set.of("register", "login", "logout", "changepassword", "unregister", "auth", "novaauth")) {
            getCommand(name).setExecutor(command);
            getCommand(name).setTabCompleter(command);
        }
        getServer().getPluginManager().registerEvents(new AuthListener(this), this);
        getServer().getPluginManager().registerEvents(new RestrictionListener(this), this);
        getServer().getScheduler().runTaskTimer(this, this::updateAuthenticationUi, 20L, 20L);
        getLogger().info("NovaAuth is enabled. This build implements Paper authentication; proxy limbo and premium verification are not enabled.");
    }

    @Override
    public void onDisable() {
        for (BossBar bar : bossBars.values()) bar.removeAll();
        bossBars.clear();
        if (database != null) database.close();
    }

    public MessageService messages() {
        return messages;
    }

    public boolean isAuthenticated(UUID uuid) {
        return states.get(uuid) == State.AUTHENTICATED;
    }

    public boolean consumeAllowedTeleport(UUID uuid) {
        return allowedTeleports.remove(uuid);
    }

    public boolean isInternalGameModeChange(UUID uuid) {
        return internalGameModeChanges.contains(uuid);
    }

    public void beginAuthentication(Player player) {
        UUID uuid = player.getUniqueId();
        states.put(uuid, State.PENDING);
        joinedAt.put(uuid, System.currentTimeMillis());
        applyIsolation(player);
        playSound(player, "join");
        database.find(uuid).whenComplete((account, error) -> runOnMain(uuid, online -> {
            if (error != null) {
                getLogger().warning("Database lookup failed for a joining player: " + rootMessage(error));
                online.kickPlayer(legacy("&cAuthentication service unavailable. Please try again later."));
                return;
            }
            if (account.isPresent()) {
                if (account.get().locked()) {
                    messages.send(online, "account-locked", Map.of());
                    online.kickPlayer(legacy("&cThis account is locked."));
                    return;
                }
                states.put(uuid, State.LOGIN);
                messages.send(online, "login-required", Map.of());
                showTitle(online, "login", Map.of());
                teleportToConfiguredSpawn(online, "login");
            } else {
                if (!getConfig().getBoolean("registration.enabled", true)) {
                    online.kickPlayer(legacy("&cRegistration is currently disabled."));
                    return;
                }
                states.put(uuid, State.REGISTER);
                messages.send(online, "register-required", Map.of());
                showTitle(online, "register", Map.of());
                teleportToConfiguredSpawn(online, "register");
            }
        }));
    }

    public void register(Player player, String password, String confirmation) {
        UUID uuid = player.getUniqueId();
        if (states.get(uuid) == State.AUTHENTICATED) {
            messages.send(player, "already-authenticated", Map.of());
            return;
        }
        if (states.get(uuid) != State.REGISTER) {
            messages.send(player, "account-exists", Map.of());
            return;
        }
        if (!getConfig().getBoolean("registration.enabled", true)) {
            messages.send(player, "registration-disabled", Map.of());
            return;
        }
        if (!password.equals(confirmation)) {
            messages.send(player, "password-mismatch", Map.of());
            playSound(player, "registration-failure");
            return;
        }
        if (!allowRequest(player)) return;
        String validation = passwordPolicy.validate(password);
        if (validation != null) {
            sendPolicyError(player, validation);
            playSound(player, "registration-failure");
            return;
        }
        String usernameError = passwordPolicy.validateUsername(player.getName());
        if (usernameError != null) {
            messages.send(player, "admin-failure", Map.of("reason", "Your username does not meet the configured username rule."));
            return;
        }
        String ip = player.getAddress() == null ? "unknown" : player.getAddress().getAddress().getHostAddress();
        String ipHashKey = ip;
        long cooldown = getConfig().getLong("registration.cooldown-seconds", 0);
        long remaining = cooldown * 1000 - (System.currentTimeMillis() - lastRegistration.getOrDefault(ipHashKey, 0L));
        if (remaining > 0) {
            messages.send(player, "registration-cooldown", Map.of("seconds", Long.toString((remaining + 999) / 1000)));
            return;
        }
        if (!beginRequest(player)) return;
        int cap = getConfig().getInt("registration.maximum-accounts-per-ip", 3);
        database.register(uuid, player.getName(), PasswordHasher.hash(password), ip, cap).whenComplete((success, error) -> runOnMain(uuid, online -> {
            busy.remove(uuid);
            if (error != null) {
                getLogger().warning("Account registration failed: " + rootMessage(error));
                messages.send(online, "admin-failure", Map.of("reason", "The account could not be saved."));
            } else if (success) {
                lastRegistration.put(ipHashKey, System.currentTimeMillis());
                audit(null, uuid, "register", "success");
                markAuthenticated(online);
                messages.send(online, "register-success", Map.of());
                showTitle(online, "register-success", Map.of());
                playSound(online, "register-success");
                teleportAfterAuthentication(online);
            } else {
                messages.send(online, "too-many-accounts", Map.of());