ogkeshav69

Create a Minecraft Spigot/Paper plugin in Java called "SecureAuth".

Main package: com.secureauth.plugin

Main class:

SecureAuth

Minecraft version: 1.20+

The plugin must implement a full REGISTER and LOGIN system.

-----------------------------------

PLUGIN FEATURES

-----------------------------------

  1. REGISTER SYSTEM

When a player joins the server for the FIRST TIME:

Show a TITLE message:

Title: §a/register Subtitle: §7Use /register <password>

Player must run:

/register <password>

After successful register:

Show TITLE:

Title: §aSuccessfully Registered Subtitle: §7You can now login when you rejoin

Send chat message: §aRegistration complete!

Save password in config.yml in PLAIN TEXT.

Example config.yml:

players:

Notch: password: "12345"

-----------------------------------

  1. LOGIN SYSTEM

When a registered player joins again:

Teleport player to spawn location.

Show TITLE:

Title: §e/login Subtitle: §7Use /login <password>

Player must type:

/login <password>

If password correct:

Show TITLE:

Title: §aSuccessfully Logged In Subtitle: §7Welcome back

Teleport player back to the location where they were before join.

Remove blindness effect.

Allow all actions again.

If password incorrect:

Send message: §cInvalid password.

Kick player from server after 3 wrong attempts.

Kick message: §cWrong password!

-----------------------------------

  1. LOGIN PROTECTION

While player is NOT logged in:

Apply BLINDNESS effect.

Cancel these actions:

PlayerMoveEvent → cancel movement

EntityDamageByEntityEvent → cannot hit players

BlockBreakEvent → cancel

BlockPlaceEvent → cancel

PlayerDropItemEvent → cancel

PlayerInteractEvent → cancel

PlayerInteractEntityEvent → cancel

ProjectileLaunchEvent → cancel

PlayerTeleportEvent → cancel

PlayerSwapHandItemsEvent → cancel

PlayerItemConsumeEvent → cancel

PlayerCommandPreprocessEvent → block all commands except:

/login /register

Also block using:

  • Ender Pearl
  • Wind Charge / Wind Burst
  • Bow
  • Crossbow
  • Trident
  • Any throwable item
  • Any item use

-----------------------------------

  1. SPAWN TELEPORT SYSTEM

When player joins:

Save their previous location in memory using HashMap.

Teleport them to server spawn location.

After successful login:

Teleport them back to the saved location.

-----------------------------------

  1. PASSWORD CHANGE COMMAND

Command:

/changepass <oldpassword> <newpassword>

If old password matches:

Change password in config.yml.

Send message:

§aPassword changed successfully.

-----------------------------------

  1. ADMIN PASSWORD CHANGE

Command:

/adminpasschange <player> <newpassword>

Permission required:

secureauth.admin

Allows admin to change any player's password.

Send message:

§aPassword changed for player.

-----------------------------------

  1. CONFIG FILE

config.yml structure:

players: playername: password: "password"

-----------------------------------

  1. DATA STRUCTURES

Use:

HashMap<UUID, Boolean> loggedInPlayers HashMap<UUID, Location> playerLastLocation HashMap<UUID, Integer> loginAttempts

-----------------------------------

  1. TITLE SYSTEM

Register title:

GREEN

Login title:

YELLOW

Success title:

GREEN

-----------------------------------

  1. PLUGIN.YML

name: SecureAuth main: com.secureauth.plugin.SecureAuth version: 1.0 api-version: 1.20

commands: register: description: register password login: description: login password changepass: description: change password adminpasschange: description: admin password change

permissions: secureauth.admin: default: op

-----------------------------------

  1. IMPORTANT REQUIREMENTS

The plugin must:

✔ Fully compile ✔ Work on multiplayer servers ✔ Auto create config.yml ✔ Save passwords in config ✔ Use Bukkit API correctly ✔ Cancel ALL gameplay actions before login ✔ Restore player location after login ✔ Use listener classes ✔ Be cleanly structured

-----------------------------------

Generate the FULL Java plugin code including:

  • Main class
  • Command classes
  • Event listener class
  • plugin.yml
Kodari AI
KodariMar 8 at 3:01 pm 15,018 (v2)

I’ll create a complete SecureAuth plugin with registration and login system.

SecureAuth
A comprehensive authentication system for Minecraft servers requiring players to register and login. Features include password-based registration, secure login with attempt limits, login protection (movement blocking, blindness, action cancellation), spawn teleportation during authentication, admin password management, and player data persistence. Prevents all gameplay interactions until successful authentication.

Complete SecureAuth plugin created with full registration and login system, login protection, spawn teleportation, password management, and admin controls.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 609
src/main/java/com/secureauth/plugin/SecureAuth.java
package com.secureauth.plugin;

import com.secureauth.plugin.commands.AdminPasswordCommand;
import com.secureauth.plugin.commands.ChangePasswordCommand;
import com.secureauth.plugin.commands.LoginCommand;
import com.secureauth.plugin.commands.RegisterCommand;
import com.secureauth.plugin.listeners.LoginProtectionListener;
import com.secureauth.plugin.managers.AuthManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class SecureAuth extends JavaPlugin {
    
    private AuthManager authManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.authManager = new AuthManager(this);
        
        getCommand("register").setExecutor(new RegisterCommand(this));
        getCommand("login").setExecutor(new LoginCommand(this));
        getCommand("changepass").setExecutor(new ChangePasswordCommand(this));
        getCommand("adminpasschange").setExecutor(new AdminPasswordCommand(this));
        
        Bukkit.getPluginManager().registerEvents(new LoginProtectionListener(this), this);
        
        getLogger().info("SecureAuth has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (authManager != null) {
            authManager.clearAllData();
        }
        getLogger().info("SecureAuth has been disabled!");
    }
}