N0t Kenji

Create a complete, lightweight, highly optimized Minecraft Java authentication plugin for Minecraft.

Plugin Name: KrowAuth Theme: Premium Black / Dark Theme Database: SQLite Java Version: Java 21/25

  1. Authentication System
  • "/register <password> <confirmPassword>"
  • "/login <password>"
  • "/changepassword <oldPassword> <newPassword>"
  • "/logout"
  • "/auth" admin commands.
  1. Security
  • Secure PBKDF2 password hashing.
  • SQLite account storage.
  • Prevent movement before login.
  • Block commands before authentication.
  • Block inventory and interactions.
  • Login timeout system.
  • Prevent duplicate registrations.
  • Secure asynchronous database operations.
  1. Optimization
  • Extremely lightweight.
  • Low RAM usage.
  • Minimal CPU usage.
  • No unnecessary repeating tasks.
  • Efficient player authentication cache.
  • Optimized SQLite queries.
  • No unnecessary dependencies.
  1. Black Theme & UI
  • Premium black and dark-gray visual identity.
  • Modern, clean login messages.
  • White and gray text with subtle purple accents.
  • Consistent KrowAuth branding.
  • Customizable messages in config.yml.
  1. Technical Requirements
  • Java 21/25
  • Gradle build system.
  • SQLite database.
  • Proper event handling.
  • Clean and modular Java source code.
  • No compilation errors.
  • Fully functional plugin.
  1. Deliverables
  • Complete Java source code.
  • Complete Gradle project.
  • plugin.yml.
  • config.yml.
  • README.md with installation instructions.
  • Buildable JAR file.
  • Optimized and production-ready implementation.

Important: Do not provide incomplete code, placeholders, or pseudocode. Make sure the complete project compiles and works on paper 1.21.11.

Kodari AI
KodariNov 8 at 2:16 am 1
KrowAuth
A premium black-themed Minecraft authentication plugin with secure PBKDF2 password hashing and SQLite storage. Features register, login, change password, logout, and admin commands. Blocks movement, commands, inventory interactions, and implements login timeout. Uses asynchronous database operations with efficient player authentication caching. Lightweight with minimal RAM and CPU usage. Customizable messages in config.yml with modern dark UI and purple accents. Built with Java 21/25 and Gradle for Paper 1.21.11.
  1. Set up the Java 21/Paper project metadata and SQLite runtime dependency.

  2. Implement asynchronous SQLite storage, PBKDF2 hashing, authentication sessions, and commands.

  3. Add pre-login protections, configurable dark-themed messages, and installation/build documentation.

Created KrowAuth for Paper 1.21.11, targeting Java 21. It includes PBKDF2 password hashing, asynchronous SQLite storage, login timeouts, pre-login restrictions, configurable messages, and admin commands.

To generate and download the JAR:

  1. Click Compile in the top bar (on mobile: ⋮ → Compile Project).

  2. Click Compile in the window.

  3. When it succeeds, click Download on the build.

The SQLite database is stored at plugins/KrowAuth/accounts.db.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
12 1,127
src/main/java/com/krowauth/KrowAuthPlugin.java
package com.krowauth;

import com.krowauth.auth.AuthCommands;
import com.krowauth.auth.AuthSessionManager;
import com.krowauth.auth.PasswordHasher;
import com.krowauth.auth.SqliteStorage;
import com.krowauth.listener.AuthListener;
import java.io.File;
import java.util.Objects;
import java.util.concurrent.CompletionException;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public final class KrowAuthPlugin extends JavaPlugin {
    private SqliteStorage storage;
    private PasswordHasher passwordHasher;
    private AuthSessionManager sessions;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        if (!getDataFolder().exists() && !getDataFolder().mkdirs()) {
            throw new IllegalStateException("Could not create the KrowAuth data folder.");
        }

        storage = new SqliteStorage(new File(getDataFolder(), "accounts.db"));
        passwordHasher = new PasswordHasher(getHashIterations());
        sessions = new AuthSessionManager(this, storage);

        AuthCommands commands = new AuthCommands(this, storage, passwordHasher, sessions);
        for (String name : new String[]{"register", "login", "changepassword", "logout", "auth"}) {
            Objects.requireNonNull(getCommand(name), "Missing command declaration: " + name)
                .setExecutor(commands);
        }
        getServer().getPluginManager().registerEvents(new AuthListener(this, sessions), this);

        storage.ready().whenComplete((ignored, error) -> {
            if (error != null) {
                logFailure(error);
                Bukkit.getScheduler().runTask(this, () -> getServer().getPluginManager().disablePlugin(this));
            }
        });
        getLogger().info("KrowAuth enabled.");
    }

    @Override
    public void onDisable() {
        if (sessions != null) {
            sessions.shutdown();
        }
        if (passwordHasher != null) {
            passwordHasher.close();
        }
        if (storage != null) {
            storage.close();
        }
    }

    public void sendMessage(CommandSender recipient, String messageKey) {
        String prefix = getConfig().getString("prefix", "&8[&5KrowAuth&8] &r");
        String message = getConfig().getString("messages." + messageKey,
            "&cAuthentication is temporarily unavailable.");
        recipient.sendMessage(color(prefix + message));
    }

    public String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }

    public int getMinimumPasswordLength() {
        return Math.max(1, getConfig().getInt("security.minimum-password-length", 8));
    }

    public int getMaximumPasswordLength() {
        return Math.max(getMinimumPasswordLength(),
            getConfig().getInt("security.maximum-password-length", 128));
    }

    public int getHashIterations() {
        return Math.max(100_000, Math.min(1_000_000,
            getConfig().getInt("security.pbkdf2-iterations", 210_000)));
    }

    public SqliteStorage storage() {
        return storage;
    }

    public AuthSessionManager sessions() {
        return sessions;
    }

    public void logFailure(Throwable error) {
        Throwable cause = error;
        while (cause instanceof CompletionException && cause.getCause() != null) {
            cause = cause.getCause();
        }
        getLogger().log(Level.SEVERE, "An authentication operation failed.", cause);
    }
}