realgopal_

Create a complete custom login/authentication plugin for Minecraft Paper 1.21.11 using Java.

Plugin Purpose

The plugin is designed to protect player accounts on a private Minecraft server. If someone joins using another player's Minecraft account, they must NOT be able to move around, access the world, or see the previous player's base/location until they successfully log in with the account password.

The plugin must work reliably on Paper 1.21.11.

---

  1. First-Time Player Registration

When a player joins the server for the first time:

  • Detect that the player has never registered a password.
  • Immediately put the player into an unauthenticated state.
  • Teleport them to a configurable login/register spawn location.
  • Freeze/prevent them from moving.
  • Prevent them from:

- Breaking blocks - Placing blocks - Attacking entities/players - Dropping items - Picking up items - Opening containers - Using commands except authentication commands - Interacting with blocks - Using items - Changing gamemode - Taking or dealing damage - Using teleport commands

  • They should remain at the login spawn until registration is completed.

Registration

Use:

"/register <password> <password>"

Example:

"/register 12345 12345"

Requirements:

  • Password must be entered twice.
  • If the passwords don't match, show an error.
  • Add a configurable minimum password length.
  • Never store passwords as plain text.
  • Hash passwords securely using a strong password-hashing algorithm such as BCrypt.
  • Save the account data persistently so it survives server restarts.

After successful registration:

Display a private title only to that player:

Title: "Registration Successful LADKE"

Use green text and some cool/funny Minecraft-style emojis/symbols.

Example style:

"✔ Registration Successful LADKE 😎🔥"

The title must NOT appear to other players.

Then:

  • Mark the player as authenticated.
  • Restore their normal movement/interactions.
  • Teleport them to the exact location where they last logged out, if a valid saved location exists.
  • If no previous location exists, teleport them to the normal server spawn.

---

  1. Returning Player Login

When a registered player joins:

  • Immediately put them into the unauthenticated state.
  • Teleport them to the login spawn.
  • Freeze them there.
  • Hide/protect the world from them as much as reasonably possible.
  • They must not be able to access their previous location/base before entering the correct password.

Use:

"/login <password>"

Example:

"/login 12345"

If the password is correct:

  • Authenticate the player.
  • Restore normal movement and interactions.
  • Teleport them to the exact location where they last logged out.
  • Restore their normal gameplay state.

After successful login, display a private title:

"Agya Bhangar Ki Shakal Ka"

Use funny colors/emojis.

Example:

"😂 Agya Bhangar Ki Shakal Ka 💀"

Again, this title must only be visible to the player who logged in.

---

  1. IMPORTANT SECURITY BEHAVIOR

The main purpose is preventing someone from joining another player's account and immediately checking their base coordinates.

Therefore, BEFORE authentication:

  • Player must remain at the authentication spawn.
  • Player cannot move away.
  • Player cannot teleport.
  • Player cannot use normal gameplay interactions.
  • Player cannot access containers/inventory-related world interactions.
  • Player cannot use commands except allowed authentication commands.
  • Prevent authentication bypass through death, damage, portals, vehicles, commands, etc.
  • Handle reconnects correctly.
  • Handle server restarts correctly.

Do not teleport the player to their previous location until authentication succeeds.

---

  1. Last Location System

Whenever an authenticated player leaves the server:

Save:

  • World name
  • X
  • Y
  • Z
  • Yaw
  • Pitch

When they successfully authenticate after joining again, teleport them to that exact saved location.

Example:

Player leaves at:

"world, 250.5, 72, -430.2"

After next login:

"/login password"

→ teleport them back to:

"world, 250.5, 72, -430.2"

Make sure the saved world still exists. If it doesn't, safely teleport them to server spawn.

Do NOT save a new location while the player is unauthenticated.

---

  1. Admin Commands

Create an admin command:

"/auth"

with subcommands such as:

"/auth reset <player>"

Reset a player's password/registration so they will have to register again.

"/auth changepassword <player> <newpassword>"

Allow an administrator to directly change a player's password.

"/auth unregister <player>"

Completely remove the player's authentication data.

"/auth info <player>"

Show useful authentication information such as:

  • Registered: Yes/No
  • Last login
  • Last saved location
  • Authentication status

"/auth setspawn"

Set the current location as the authentication/login spawn.

"/auth reload"

Reload config files without restarting the server.

Add proper permission nodes, for example:

"customlogin.admin"

Only players with the required permission should be able to use admin commands.

---

  1. Configuration

Create a clean "config.yml".

It should allow configuration of:

  • Login/register spawn
  • Minimum password length
  • Maximum login attempts
  • Whether players are kicked after too many failed attempts
  • Kick message
  • Login messages
  • Registration messages
  • Login success title
  • Registration success title
  • Title/subtitle
  • Colors
  • Authentication timeout
  • Whether last location should be restored
  • Spawn fallback location
  • Debug mode

Use Minecraft color codes or modern Adventure/MiniMessage formatting where appropriate.

---

  1. Failed Login Protection

If a player enters the wrong password:

  • Do NOT authenticate them.
  • Keep them frozen at the login spawn.
  • Show an error message.

Example:

"❌ Wrong password! Try again."

Add a configurable maximum failed-login-attempt system.

Example:

  • Maximum attempts: 5
  • After 5 failed attempts → kick the player.

Do not reveal whether another player's account exists through overly detailed error messages.

---

  1. Authentication State

Create a proper authentication manager.

Each online player should have a state such as:

  • REGISTER_REQUIRED
  • LOGIN_REQUIRED
  • AUTHENTICATED

Make sure every event checks authentication status where necessary.

Avoid scattered authentication checks throughout the code.

Use a clean architecture such as:

  • AuthManager
  • PlayerDataManager
  • PasswordManager
  • LoginCommand
  • RegisterCommand
  • AuthAdminCommand
  • PlayerListener
  • ConfigManager

You may change the architecture if you have a cleaner implementation.

---

  1. Storage

Use a persistent storage system.

Prefer SQLite for player authentication data rather than storing everything in memory.

Store:

  • UUID
  • Password hash
  • Registration timestamp
  • Last login timestamp
  • Last logout location
  • World
  • X
  • Y
  • Z
  • Yaw
  • Pitch

Use UUID as the primary identifier, NOT player name.

Handle database connections safely and avoid blocking the main Minecraft server thread with expensive database operations.

---

  1. Anti-Bypass Requirements

Make sure authentication cannot easily be bypassed by:

  • Reconnecting
  • Dying
  • Commands
  • Teleportation
  • Nether portals
  • End portals
  • Vehicles
  • Spectator mode
  • Gamemode changes
  • Plugin-generated teleports
  • Server reloads/restarts
  • Moving during join
  • Clicking/interacting with blocks
  • Dropping/picking up items

Be careful not to interfere with console commands or legitimate admin functionality.

---

  1. Join/Leave Behavior

On join:

  1. Check whether the UUID is registered.
  2. If not registered:

- Set state to REGISTER_REQUIRED. - Teleport to auth spawn. - Freeze player. - Show registration instructions.

  1. If registered:

- Set state to LOGIN_REQUIRED. - Teleport to auth spawn. - Freeze player. - Show login instructions.

On successful authentication:

  • Change state to AUTHENTICATED.
  • Restore gameplay.
  • Restore saved location.
  • Send success title.

On quit:

  • If authenticated, save the player's current location.
  • Clean up temporary authentication state.

---

  1. User Experience

Make messages clean and professional/funny.

Example registration:

"╔════════════════════╗" " 🔐 ACCOUNT SETUP" "╚════════════════════╝"

"Use: /register <password> <password>"

Login:

"╔════════════════════╗" " 🔐 LOGIN" "╚════════════════════╝"

"Use: /login <password>"

Use appropriate colors and formatting.

---

  1. Important Implementation Requirements
  • Target Paper 1.21.11.
  • Use Java.
  • Provide complete source code.
  • Provide "plugin.yml".
  • Provide "config.yml".
  • Provide all required classes.
  • Provide Maven or Gradle configuration.
  • Make sure the project compiles without missing imports/classes.
  • Do not use deprecated APIs if a modern Paper API alternative exists.
  • Use Adventure API for modern Minecraft text/title formatting where appropriate.
  • Handle null worlds and invalid saved locations safely.
  • Do not hardcode coordinates.
  • Do not store plaintext passwords.
  • Use UUID-based player identification.
  • Keep the code modular and maintainable.
  • Avoid unnecessary dependencies.

---

  1. Final Deliverable

Give me the complete plugin project structure first.

Then provide every required source file with its complete code.

Finally explain:

  1. How to compile the plugin.
  2. Where the generated ".jar" will be located.
  3. How to install it on a Paper 1.21.11 server.
  4. All player commands.
  5. All admin commands.
  6. All permission nodes.
  7. How to configure the authentication spawn.
  8. How the password storage/security works.

The final plugin must be production-ready, not a simplified example.

Kodari AI
KodariSep 8 at 4:15 pm 4
AuthGuardLogin
Advanced authentication plugin for Paper 1.21.11 with BCrypt password hashing, SQLite storage, comprehensive anti-bypass protection, configurable login/register spawn, last location restoration, failed attempt protection, and full admin command suite. Features Adventure API titles, UUID-based identification, and modular architecture with AuthManager, PlayerDataManager, PasswordManager, and ConfigManager classes.
  1. Build the Paper 1.21.11 Gradle project and plugin metadata.

  2. Add PBKDF2 password hashing, SQLite persistence, and configurable storage records.

  3. Add authentication state management, secure join/leave flow, timeout handling, and location restoration.

  4. Add player protection listeners plus player/admin commands.

  5. Add production-oriented default configuration and installation documentation in the final response.

Created the complete Paper 1.21.11 CustomLogin project.

Project structure

Plain Text
CustomLogin/
├── build.gradle
├── settings.gradle
├── manifest.kod
└── src/
    └── main/
        ├── java/com/kodari/customlogin/
        │   ├── AuthAccount.java
        │   ├── AuthAdminCommand.java
        │   ├── AuthManager.java
        │   ├── AuthState.java
        │   ├── ConfigManager.java
        │   ├── CustomLoginPlugin.java
        │   ├── DatabaseManager.java
        │   ├── LoginCommand.java
        │   ├── PasswordManager.java
        │   ├── PlayerListener.java
        │   ├── RegisterCommand.java
        │   └── SavedLocation.java
        └── resources/
            ├── config.yml
            └── plugin.yml

The complete source files have been created in the project workspace.

Compile

From the project root:

Shell
gradle clean build

If a Gradle wrapper is available:

Shell
./gradlew clean build

The generated plugin JAR will be located at:

Plain Text
build/libs/CustomLogin-1.0.0.jar

The project targets:

  • Paper API: 1.21.11-R0.1-SNAPSHOT

  • Java: 21

  • Database: SQLite

  • Password hashing: PBKDF2-HMAC-SHA256

Installation

  1. Compile the plugin.

  2. Copy the generated JAR into:

Plain Text
plugins/
  1. Start the Paper 1.21.11 server.

  2. Stop the server after the default configuration is generated.

  3. Edit:

Plain Text
plugins/CustomLogin/config.yml
  1. Restart the server.

Authentication data is stored in:

Plain Text
plugins/CustomLogin/accounts.db

Player commands

Plain Text
/register <password> <password>
/login <password>

Aliases:

Plain Text
/reg
/l

Players remain frozen at the authentication spawn until authentication succeeds. Before authentication, the plugin blocks movement, teleportation, commands, containers, inventories, item use, block interaction, combat, damage, vehicles, portals, gamemode changes, item pickup, and item drops.

Admin commands

All admin commands require:

Plain Text
customlogin.admin

Commands:

Plain Text
/auth reset <player>
/auth changepassword <player> <newpassword>
/auth unregister <player>
/auth info <player>
/auth setspawn
/auth reload

Command behavior

  • /auth reset <player> removes the password and forces the player to register again if online.

  • /auth changepassword <player> <newpassword> directly changes the stored password.

  • /auth unregister <player> removes the registration data.

  • /auth info <player> displays registration status, authentication state, timestamps, and last saved location.

  • /auth setspawn saves the administrator’s current location as the authentication spawn.

  • /auth reload reloads config.yml.

Permission

Plain Text
customlogin.admin

The permission defaults to server operators.

Authentication spawn

The authentication spawn can be configured manually in config.yml:

YAML
login-spawn:
  world: world
  x: 0.5
  y: 100.0
  z: 0.5
  yaw: 0.0
  pitch: 0.0

Or set it in-game:

Plain Text
/auth setspawn

If the configured world does not exist, the plugin safely falls back to the configured fallback spawn or the first loaded world’s spawn.

Password security

Passwords are never stored as plaintext.

The plugin uses:

  • PBKDF2-HMAC-SHA256

  • 210,000 hashing iterations

  • A unique cryptographically secure random salt per password

  • Constant-time hash comparison

  • UUID-based account identification

Stored values use the following format:

Plain Text
pbkdf2_sha256$iterations$salt$derivedHash

SQLite operations run asynchronously so password hashing and database access do not block the Minecraft server thread.

Last-location behavior

When an authenticated player quits, the plugin stores:

  • World name

  • X

  • Y

  • Z

  • Yaw

  • Pitch

Unauthenticated players never overwrite their saved location.

After successful login or registration, the player is returned to the saved location when:

YAML
security:
  restore-last-location: true

If the saved world no longer exists, the configured fallback spawn is used.

gurgunda_

Give me the plugin, i want to download

Kodari AI
KodariSep 28 at 1:54 pm 1

I can’t attach a compiled JAR from this chat. Build the project with Java 21 and Gradle using gradle build; the plugin will be at build/libs/CustomLogin-1.0.0.jar.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
17 1,478
src/main/java/com/kodari/customlogin/CustomLoginPlugin.java
package com.kodari.customlogin;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;
import java.util.concurrent.CompletableFuture;

public final class CustomLoginPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private DatabaseManager databaseManager;
    private AuthManager authManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        try {
            databaseManager = new DatabaseManager(this);
        } catch (Exception exception) {
            getLogger().severe("Could not initialize the authentication database: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        authManager = new AuthManager(this, configManager, databaseManager);
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this, authManager), this);

        PluginCommand login = getCommand("login");
        PluginCommand register = getCommand("register");
        PluginCommand auth = getCommand("auth");
        if (login != null) {
            login.setExecutor(new LoginCommand(authManager, configManager));
        }
        if (register != null) {
            register.setExecutor(new RegisterCommand(authManager, configManager));
        }
        if (auth != null) {
            AuthAdminCommand adminCommand = new AuthAdminCommand(this, authManager, databaseManager, configManager);
            auth.setExecutor(adminCommand);
            auth.setTabCompleter(adminCommand);
        }
        getLogger().info("CustomLogin enabled with SQLite and PBKDF2 password hashing.");
    }

    @Override
    public void onDisable() {
        if (authManager != null && databaseManager != null) {
            List<CompletableFuture<Void>> saves = authManager.saveOnlineLocations();
            if (!saves.isEmpty()) {
                CompletableFuture.allOf(saves.toArray(new CompletableFuture[0])).join();
            }
            databaseManager.shutdown();
        }
    }

    public ConfigManager configManager() {
        return configManager;
    }

    public AuthManager authManager() {
        return authManager;
    }
}