beastliongamer-rgb

Best login like fire MC login plugin

Kodari AI
KodariApr 15 at 5:36 pm 16,567 (v2)

I’ll create a comprehensive login authentication plugin for Minecraft servers.

SecureLogin
A robust authentication system that protects your server with player login and registration. Players must register with a password and login each session. Features include session management, configurable login timeouts, movement/interaction blocking until authenticated, blind effect during login, brute-force protection with attempt limits, password hashing with BCrypt, SQLite/MySQL database support, and customizable messages. Includes admin commands to manage player accounts and bypass permissions for staff.

I’ll create a comprehensive authentication plugin with login/registration system, session management, and database support.

All files created successfully! SecureLogin is a complete authentication plugin with the following features:

  • Player registration and login system with password hashing using BCrypt

  • Session management with configurable timeouts

  • Database support for both SQLite and MySQL

  • Security features including login attempt limits, brute-force protection, and player freezing

  • Protection system that blocks all actions (movement, chat, commands, damage) until authenticated

  • Admin commands for reload, player reset, and force login

  • Customizable messages and configuration options

  • Blind effect during login for additional security

  • Auto-kick on timeout or max attempts (configurable)

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
18 1,239
src/main/java/com/securelogin/SecureLogin.java
package com.securelogin;

import com.cryptomorin.xseries.XPotion;
import com.securelogin.command.AdminCommand;
import com.securelogin.command.ChangePasswordCommand;
import com.securelogin.command.LoginCommand;
import com.securelogin.command.RegisterCommand;
import com.securelogin.listener.JoinListener;
import com.securelogin.listener.ProtectionListener;
import com.securelogin.listener.QuitListener;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class SecureLogin extends JavaPlugin {
    private ConfigManager configManager;
    private DatabaseManager databaseManager;
    private SessionManager sessionManager;
    private LoginManager loginManager;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.databaseManager = new DatabaseManager(this);
        this.sessionManager = new SessionManager(this);
        this.loginManager = new LoginManager(this);

        databaseManager.connect();

        registerListeners();
        registerCommands();
        startTimeoutTask();

        getLogger().info("SecureLogin has been enabled!");
    }

    @Override
    public void onDisable() {
        if (databaseManager != null) {
            databaseManager.disconnect();
        }

        sessionManager.logoutAll();

        getLogger().info("SecureLogin has been disabled!");
    }

    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new JoinListener(this), this);
        getServer().getPluginManager().registerEvents(new QuitListener(this), this);
        getServer().getPluginManager().registerEvents(new ProtectionListener(this), this);
    }

    private void registerCommands() {
        getCommand("login").setExecutor(new LoginCommand(this));
        getCommand("register").setExecutor(new RegisterCommand(this));
        getCommand("changepassword").setExecutor(new ChangePasswordCommand(this));
        getCommand("securelogin").setExecutor(new AdminCommand(this));
    }

    private void startTimeoutTask() {
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            for (Player player : Bukkit.getOnlinePlayers()) {
                if (player.hasPermission("securelogin.bypass")) {
                    continue;
                }

                if (sessionManager.requiresLogin(player.getUniqueId())) {
                    if (loginManager.hasTimedOut(player.getUniqueId())) {
                        if (configManager.isKickOnTimeout()) {
                            player.kickPlayer(configManager.getMessageNoPrefix("kicked-timeout"));
                        } else {
                            player.sendMessage(configManager.getMessage("kicked-timeout"));
                            XPotion.matchXPotion("BLINDNESS").ifPresent(xp -> 
                                player.removePotionEffect(xp.getPotionEffectType()));
                            sessionManager.login(player.getUniqueId());
                        }
                        loginManager.clearTimeout(player.getUniqueId());
                    }
                }
            }

            sessionManager.clearExpiredSessions();
        }, 20L, 20L);
    }
}