AuthGuardLogin — Production-Ready Minecraft Authentication Plugin
Create a complete, production-ready Minecraft authentication/login plugin named AuthGuardLogin using Java and targeting Paper 1.21.11.
The plugin's primary purpose is to protect player accounts on a private Minecraft server. A player must authenticate before they can access the normal world, move around, interact with blocks, inspect containers, or reach their previous location.
The implementation must be modular, secure, maintainable, and compile successfully without missing classes, imports, methods, or dependencies.
---
- Technical Requirements
- Platform: Paper
- Minecraft version: 1.21.11
- Language: Java
- Build system: Maven
- Use the modern Paper API wherever possible.
- Use Adventure API for messages, colors, titles, and formatting.
- Do not use deprecated APIs when a modern alternative exists.
- Use SQLite for persistent authentication data.
- Use UUID, not player names, as the primary player identifier.
- Passwords must never be stored in plaintext.
- Use a secure password-hashing algorithm such as BCrypt.
- Database operations must not block the Minecraft main server thread.
- Handle database errors safely.
- Handle missing worlds and invalid saved locations safely.
- Do not hardcode authentication-spawn coordinates.
- Configuration must be stored in "config.yml".
---
- Core Authentication States
Create an authentication manager with exactly these logical states:
REGISTER_REQUIRED LOGIN_REQUIRED AUTHENTICATED
Every relevant player event must check the player's authentication state through the central authentication manager.
Avoid scattering independent authentication logic throughout the plugin.
---
- First-Time Player Registration
When a player joins for the first time and their UUID does not exist in the authentication database:
- Set their state to:
REGISTER_REQUIRED
- Immediately teleport them to the configured authentication spawn.
- Freeze them at the authentication spawn.
- Prevent them from accessing the normal world.
- Display registration instructions.
The player must NOT be able to:
- Move away from the authentication spawn.
- Break blocks.
- Place blocks.
- Attack players.
- Attack entities.
- Take damage.
- Deal damage.
- Drop items.
- Pick up items.
- Open chests.
- Open barrels.
- Open shulker boxes.
- Open furnaces.
- Open any containers.
- Interact with blocks.
- Use items.
- Interact with entities.
- Ride vehicles.
- Enter vehicles.
- Use portals.
- Change gamemode.
- Use teleport commands.
- Teleport through any plugin mechanism.
- Use normal commands.
- Access gameplay-related inventories.
- Bypass authentication through death.
- Bypass authentication through disconnect/reconnect.
- Bypass authentication through spectator mode.
Only authentication-related commands should be allowed.
---
- Registration Command
Create:
/register <password> <password>
Example:
/register 12345 12345
Requirements:
- Password must be entered twice.
- Both passwords must match.
- Enforce a configurable minimum password length.
- Optionally support a configurable maximum password length.
- Never store the plaintext password.
- Hash the password using BCrypt.
- Store the hash in SQLite.
- Associate the account with the player's UUID.
- Save the registration timestamp.
If the passwords do not match:
❌ Passwords do not match.
If the password is too short:
❌ Password must be at least <length> characters.
If registration succeeds:
Set the player state to:
AUTHENTICATED
Display a private title visible only to that player.
Default title:
✔ Registration Successful LADKE 😎🔥
Use configurable title/subtitle text and colors.
After successful registration:
- Restore normal gameplay.
- Restore normal movement.
- Restore normal interaction.
- If a valid previous saved location exists, teleport the player there.
- If no valid saved location exists, teleport them to the configured fallback/server spawn.
---
- Returning Player Login
When a registered player joins:
- Check their UUID in SQLite.
- Set their state to:
LOGIN_REQUIRED
- Immediately teleport them to the authentication spawn.
- Freeze them.
- Prevent all normal gameplay access.
- Do NOT teleport them to their previous location before successful authentication.
- Show login instructions.
Create:
/login <password>
Example:
/login 12345
The password must be checked against the stored BCrypt hash.
If the password is incorrect:
❌ Wrong password! Try again.
The player must remain unauthenticated and frozen.
If the password is correct:
- Set state to "AUTHENTICATED".
- Update the last-login timestamp.
- Restore normal gameplay.
- Restore movement and interaction.
- Restore the player's saved location if it is valid.
- If the saved world no longer exists, safely use the configured fallback spawn.
- Display a private title visible only to that player.
Default login-success title:
😂 Agya Bhangar Ki Shakal Ka 💀
Make title/subtitle and formatting configurable.
---
- Authentication Spawn
The authentication spawn is the location where unauthenticated players are held.
It must contain:
Create:
/auth setspawn
When an administrator executes this command:
- Save the administrator's current location as the authentication spawn.
- Persist it in "config.yml".
- Confirm the change to the administrator.
Do not hardcode any coordinates.
If the authentication spawn is missing or its world does not exist:
- Log a clear warning.
- Use the configured fallback/server spawn where safe.
- Never send an unauthenticated player to their previous location.
---
- Player Freeze System
Unauthenticated players must remain at the authentication spawn.
Prevent:
- Walking
- Sprinting
- Jumping
- Flying
- Swimming
- Gliding
- Vehicle movement
- Portal movement
- Knockback
- Plugin-generated movement where practical
Cancel unauthorized movement.
If necessary, continuously ensure the player remains at the authentication spawn.
Do not interfere with authenticated players.
---
- Complete Anti-Bypass Protection
Authentication must not be bypassable through:
- Reconnecting
- Relogging
- Death
- Respawn
- Damage
- Knockback
- Teleport commands
- Plugin teleports
- Nether portals
- End portals
- End gateways
- Vehicles
- Boats
- Minecarts
- Spectator mode
- Gamemode changes
- Commands
- Item interaction
- Block interaction
- Inventory interaction
- Container interaction
- Dropping items
- Picking up items
- Attacking entities
- Being attacked
- World changes
- Plugin reloads
- Server restarts
- Client movement packets
If an unauthenticated player dies or otherwise changes location, safely return them to the authentication spawn.
Authentication restrictions must also be reapplied after reconnects and server lifecycle events.
---
- Command Restrictions
While the player is:
REGISTER_REQUIRED
allow only:
/register
While the player is:
LOGIN_REQUIRED
allow only:
/login
Block all other player commands.
Commands must be blocked before they can provide access to gameplay or information.
Do not block console commands.
Do not prevent administrators from using legitimate console/admin commands.
---
- Last Location System
Whenever an authenticated player leaves the server, save their current location.
Save:
World name X Y Z Yaw Pitch
Example:
world 250.5 72.0 -430.2 90.0 0.0
On the next successful authentication:
/login password
teleport the player back to that exact saved location.
Important:
- Never save a new location while the player is unauthenticated.
- Never save the authentication spawn as the player's last location.
- Never overwrite a valid saved location with the authentication spawn.
- Only save locations when the player is authenticated.
- Check whether the saved world still exists.
- If the world no longer exists, use the configured fallback spawn.
- If the saved location is invalid or unsafe, use the fallback spawn.
Make last-location restoration configurable.
---
- SQLite Database
Use SQLite as persistent storage.
Create a database file such as:
plugins/AuthGuardLogin/auth.db
Use UUID as the primary key.
Recommended table:
players
Fields:
uuid password_hash registered_at last_login last_logout last_world last_x last_y last_z last_yaw last_pitch
Use prepared statements.
Do not concatenate user input directly into SQL queries.
Database connections must be handled safely.
Use asynchronous database operations where appropriate.
Do not perform expensive database operations synchronously on the main server thread.
---
- Password Security
Create a dedicated:
PasswordManager
Responsibilities:
- Generate BCrypt hashes.
- Verify passwords against BCrypt hashes.
- Never log plaintext passwords.
- Never store plaintext passwords.
- Never send passwords to other players.
- Never include passwords in error messages.
- Avoid exposing password data through admin information commands.
Use a suitable BCrypt work factor and make it configurable only if necessary.
---
- Failed Login Protection
Add configurable failed-login protection.
Example:
max-login-attempts: 5 kick-after-max-attempts: true
If the player enters an incorrect password:
❌ Wrong password! Try again.
Increment their failed attempt counter.
After the configured maximum:
❌ Too many failed login attempts.
Kick the player if configured.
Failed-attempt counters should be reset after:
- Successful authentication
- Player disconnect
- Appropriate authentication lifecycle reset
Do not reveal unnecessary information about whether another player's account exists.
---
- Authentication Timeout
Add configurable authentication timeout.
Example:
authentication-timeout-seconds: 60
If a player does not register/login within the configured time:
- Optionally kick them.
- Send a configurable timeout message.
Do not allow the timeout system to accidentally authenticate a player.
---
- Admin Command
Create:
/auth
with the following subcommands.
Reset
/auth reset <player>
Purpose:
- Reset the player's authentication registration.
- Remove their password hash.
- Make them register again the next time they join.
---
Change Password
/auth changepassword <player> <newpassword>
Purpose:
- Replace the player's password.
- Hash the new password with BCrypt.
- Never store plaintext.
---
Unregister
/auth unregister <player>
Purpose:
- Completely remove the player's authentication data.
---
Info
/auth info <player>
Display:
Registered: Yes/No Last login: <timestamp> Last logout: <timestamp> Last saved location: <world, x, y, z> Authentication status: <state>
Do not display:
- Plaintext passwords.
- Password hashes unless there is a very strong administrative reason; preferably never display them.
---
Set Authentication Spawn
/auth setspawn
Save the administrator's current location as the authentication spawn.
---
Reload
/auth reload
Reload:
config.yml
Do not recreate the database unnecessarily.
Handle runtime configuration changes safely.
---
- Permissions
Create:
customlogin.admin
This permission is required for "/auth" administrative commands.
Player authentication commands should be usable by unauthenticated players only for their own authentication process.
Do not require the admin permission for:
/register /login
---
- Configuration
Create a clean and well-commented:
config.yml
It must support configuration of:
authentication: minimum-password-length: 5 maximum-password-length: 64 max-login-attempts: 5 kick-after-max-attempts: true authentication-timeout-seconds: 60 restore-last-location: true
spawn: world: "" x: 0.0 y: 100.0 z: 0.0 yaw: 0.0 pitch: 0.0
fallback-spawn: use-server-spawn: true
messages: prefix: "<gray>[<aqua>AuthGuardLogin</aqua>]</gray>" register: "..." login: "..." wrong-password: "..." password-mismatch: "..." password-too-short: "..." authentication-timeout: "..." too-many-attempts: "..." no-permission: "..."
titles: registration: enabled: true title: "<green>✔ Registration Successful LADKE 😎🔥</green>" subtitle: "<gray>Account successfully protected!</gray>" fade-in: 10 stay: 50 fade-out: 20
login: enabled: true title: "<gold>😂 Agya Bhangar Ki Shakal Ka 💀</gold>" subtitle: "<gray>Welcome back!</gray>" fade-in: 10 stay: 50 fade-out: 20
debug: false
Use MiniMessage/Adventure formatting appropriately.
Do not assume these exact values must be hardcoded; they are defaults.
---
- User Experience
Registration message should be clean and readable.
Example:
╔════════════════════╗ 🔐 ACCOUNT SETUP ╚════════════════════╝
Use: /register <password> <password>
Login message:
╔════════════════════╗ 🔐 LOGIN ╚════════════════════╝
Use: /login <password>
Messages should be configurable.
Do not spam the player repeatedly unless necessary.
---
- Join Lifecycle
Unregistered player
On join:
PlayerJoinEvent ↓ Check UUID in database ↓ Not registered ↓ REGISTER_REQUIRED ↓ Teleport to auth spawn ↓ Freeze ↓ Block unauthorized actions ↓ Show registration instructions
Registered player
On join:
PlayerJoinEvent ↓ Check UUID in database ↓ Registered ↓ LOGIN_REQUIRED ↓ Teleport to auth spawn ↓ Freeze ↓ Block unauthorized actions ↓ Show login instructions
Successful authentication
/login or /register ↓ Validate credentials ↓ AUTHENTICATED ↓ Reset failed attempts ↓ Restore gameplay ↓ Restore saved location ↓ Update last-login timestamp ↓ Show private success title
---
- Quit Lifecycle
When a player quits:
If:
state == AUTHENTICATED
then:
- Save their current location.
- Save world.
- Save X/Y/Z.
- Save yaw/pitch.
- Update last logout timestamp.
If:
state == REGISTER_REQUIRED
or:
state == LOGIN_REQUIRED
then:
- Do NOT save their current location.
- Do NOT overwrite the existing saved location.
Clean up temporary authentication state.
---
- Server Restart Safety
The plugin must behave correctly after:
- Server restart
- Server stop/start
- Plugin reload
- Player reconnect
Persistent registration data must remain intact.
A registered player must still be required to "/login" after reconnecting.
Do not automatically authenticate players after a restart.
Never trust in-memory authentication state after a restart.
---
- Death and Respawn Protection
Unauthenticated players must not bypass authentication through death.
If an unauthenticated player somehow dies:
- Prevent unauthorized gameplay.
- Ensure they respawn safely.
- Return them to the authentication spawn.
- Keep their authentication state unchanged.
They must still be required to register/login.
---
- Teleport Protection
Unauthenticated players must not reach their previous location through:
- "/tp"
- "/teleport"
- Plugins
- Portals
- End gateways
- Vehicles
- Commands
- Spectator
- Other teleport mechanisms
Be careful not to break the server's legitimate administrative functionality.
The restriction should apply to the unauthenticated player rather than globally cancelling all server teleports.
---
- Gamemode Protection
Unauthenticated players must not gain access through:
SURVIVAL CREATIVE ADVENTURE SPECTATOR
Prevent unauthorized gamemode changes.
If their gamemode is changed by another mechanism while unauthenticated, restore the configured safe gamemode if necessary.
After authentication, restore their legitimate gameplay state.
---
- Inventory and World Protection
Before authentication, block:
- Container opening
- Inventory interaction
- Crafting
- Item movement
- Item dropping
- Item pickup
- Block interaction
- Entity interaction
- Item usage
- Attacking
- Breaking
- Placing
Authentication commands must remain available.
---
- Architecture
Use a clean modular architecture similar to:
AuthGuardLogin ├── AuthManager ├── PlayerDataManager ├── PasswordManager ├── DatabaseManager ├── ConfigManager ├── LoginCommand ├── RegisterCommand ├── AuthAdminCommand ├── PlayerListener ├── AuthProtectionListener └── model ├── AuthState └── PlayerData
You may improve this architecture if a cleaner design is appropriate.
Responsibilities must be separated.
Do not place the entire plugin inside one giant Java class.
---
- Required Project Structure
Provide the complete project structure first.
For example:
AuthGuardLogin/ ├── pom.xml ├── README.md └── src/ └── main/ ├── java/ │ └── <package>/ │ ├── AuthGuardLogin.java │ ├── auth/ │ │ ├── AuthManager.java │ │ ├── AuthState.java │ │ └── PasswordManager.java │ ├── database/ │ │ ├── DatabaseManager.java │ │ └── PlayerDataManager.java │ ├── command/ │ │ ├── LoginCommand.java │ │ ├── RegisterCommand.java │ │ └── AuthAdminCommand.java │ ├── listener/ │ │ ├── PlayerListener.java │ │ └── AuthProtectionListener.java │ ├── config/ │ │ └── ConfigManager.java │ └── model/ │ └── PlayerData.java └── resources/ ├── plugin.yml └── config.yml
The package name may be chosen appropriately.
---
- plugin.yml
Provide a complete valid "plugin.yml".
It must include:
- Plugin name
- Version
- Main class
- API version compatible with Paper 1.21.11
- Commands
- Permissions
Commands:
login register auth
Permission:
customlogin.admin
Make sure command registration matches the Java implementation exactly.
---
- Maven Configuration
Provide a complete:
pom.xml
It must:
- Compile successfully with the required Java version.
- Depend on the appropriate Paper API for 1.21.11.
- Include BCrypt or another properly selected secure password hashing dependency.
- Package all required runtime dependencies correctly.
- Avoid unnecessary dependencies.
- Produce a final plugin JAR suitable for installation on a Paper server.
If a dependency must be shaded/relocated, configure Maven Shade Plugin correctly.
---
- Complete Source Code Requirement
Do NOT provide pseudocode.
Do NOT provide incomplete snippets.
Do NOT use placeholders such as:
// implement this // TODO // omitted // rest of code
Provide the complete code for every required file.
Every class must:
- Compile.
- Have all required imports.
- Have correct package declarations.
- Match the project structure.
- Work with the other classes.
- Use APIs compatible with Paper 1.21.11.
Before presenting the final answer, internally verify that:
- All referenced classes exist.
- All methods exist.
- All imports are correct.
- Commands match "plugin.yml".
- Permission nodes match.
- Database schema matches Java queries.
- Configuration paths match Java code.
- No plaintext password is stored.
- No authentication bypass is obvious.
- The plugin can compile as provided.
---
- Important Security Rule
The most important requirement is:
«An unauthenticated player must NEVER be sent to their previous saved location.»
The sequence must always be:
Join ↓ Authentication spawn ↓ Frozen / protected ↓ Authentication ↓ Only after successful authentication: previous location restoration
Never reverse this order.
This is the primary security purpose of the plugin.
---
- Final Response Format
After implementing the complete plugin, provide the response in this exact order:
- Project Structure
Show the complete directory tree.
- pom.xml
Provide the complete file.
- plugin.yml
Provide the complete file.
- config.yml
Provide the complete file.
- Java Source Files
Provide e