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.
---
- 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.
---
- 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.
---
- 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.
---
- Last Location System
Whenever an authenticated player leaves the server:
Save:
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.
---
- 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.
---
- 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.
---
- 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.
---
- 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.
---
- 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.
---
- 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.
---
- Join/Leave Behavior
On join:
- Check whether the UUID is registered.
- If not registered:
- Set state to REGISTER_REQUIRED. - Teleport to auth spawn. - Freeze player. - Show registration instructions.
- 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.
---
- 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.
---
- 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.
---
- Final Deliverable
Give me the complete plugin project structure first.
Then provide every required source file with its complete code.
Finally explain:
- How to compile the plugin.
- Where the generated ".jar" will be located.
- How to install it on a Paper 1.21.11 server.
- All player commands.
- All admin commands.
- All permission nodes.
- How to configure the authentication spawn.
- How the password storage/security works.
The final plugin must be production-ready, not a simplified example.