kingboy_0700
📎 1 file 8,738 chars
📄
pasted-code-1785144746786.txt
txt 556 lines
▶
# OneTimeIP - Advanced Authentication & Security Plugin

Create a professional, optimized Minecraft Paper 1.21.11 plugin named **OneTimeIP** using **Java 21** and the latest Paper API.

The plugin must be production-ready, secure, optimized, and fully commented.

--------------------------------------------------
MAIN IDEA
--------------------------------------------------

This plugin combines:

• One-Time IP Protection
• Password Login System
• Automatic IP Lock
• IP Ban System
• IP Whitelist
• Session System
• Admin Commands
• Configurable Settings

The goal is to stop account theft by allowing only the original IP address to use the account.

--------------------------------------------------
FIRST JOIN
--------------------------------------------------

When a player joins for the very first time:

Save:

- UUID
- Username
- IP Address
- Registration Date

Example:

players.yml

players:
  uuid:
    username: Steve
    ip: 192.168.1.25
    registered: true
    password: (hashed password)
    firstJoin: 2026-07-27

The first IP becomes permanently linked with that account.

--------------------------------------------------
RETURNING PLAYER
--------------------------------------------------

Whenever the player joins again:

Compare:

Saved IP
↓

Current IP

IF SAME

Allow the player to continue.

IF DIFFERENT

If auto-ip-ban is enabled:

• Instantly IP Ban the joining IP
• Kick player

Kick Message:

Access Denied!

This Minecraft account is permanently locked to another IP.

Your IP has been automatically banned.

Contact the server staff if this is a mistake.

--------------------------------------------------
LOGIN SYSTEM
--------------------------------------------------

Every player must register once.

Commands:

/register 

/login 

--------------------------------------------------
REGISTER
--------------------------------------------------

Conditions:

• Can only register once.
• Password must be hashed using BCrypt (or another secure password hashing algorithm).
• Never save plain-text passwords.
• Minimum password length configurable.
• Maximum password length configurable.
• Prevent weak passwords if enabled.

Example:

/register MyPassword123

Response:

Registration successful!

Please login using:

/login 

--------------------------------------------------
LOGIN
--------------------------------------------------

Example:

/login MyPassword123

If correct:

Player is authenticated.

If incorrect:

Increase failed attempts.

--------------------------------------------------
FAILED LOGIN LIMIT
--------------------------------------------------

Configurable.

Example:

max-login-attempts: 5

After 5 wrong passwords:

Kick player.

Optional:

Temporary IP ban.

--------------------------------------------------
LOGIN REQUIRED
--------------------------------------------------

Until logged in:

Player cannot:

Move

Break blocks

Place blocks

Drop items

Pick up items

Open inventory

Open chests

Use commands

Attack entities

Use items

Interact with blocks

Chat (optional)

Take damage (optional)

Give player blindness/slowness (optional)

Only allow:

/login

/register

--------------------------------------------------
SESSION SYSTEM
--------------------------------------------------

If enabled:

After successful login:

Player stays authenticated for X minutes.

Example:

session-time: 60

If reconnecting from SAME IP before session expires:

Skip login.

If IP changes:

Require login again.

--------------------------------------------------
AUTO LOGIN
--------------------------------------------------

Optional.

If:

Saved IP == Current IP

AND

session valid

Automatically login.

--------------------------------------------------
IP SECURITY
--------------------------------------------------

If someone logs in using another person's account:

Saved IP ≠ Current IP

Then:

Kick player.

Automatically IP ban.

Save attempted IP.

Log event.

--------------------------------------------------
IP BAN SYSTEM
--------------------------------------------------

Commands:

/ipban 

/ipunban 

/ipbanlist

--------------------------------------------------
IP WHITELIST
--------------------------------------------------

Commands:

/ipwhitelist on

/ipwhitelist off

/ipwhitelist add 

/ipwhitelist remove 

/ipwhitelist list

When enabled:

Only whitelisted IPs may join.

--------------------------------------------------
ADMIN COMMANDS
--------------------------------------------------

/oneip reload

Reload configs.

/oneip info 

Shows:

Username

UUID

Registered IP

Registration Date

Last Login

Session Status

Registered

Authenticated

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

/oneip reset 

Deletes:

Password

Saved IP

Session

Player must register again.

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

/oneip setip  

Changes saved IP.

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

/oneip forceauth 

Force login.

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

/oneip forceregister 

Reset registration.

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

/oneip status

Plugin statistics.

--------------------------------------------------
PASSWORD SECURITY
--------------------------------------------------

Use BCrypt hashing.

Never save plain-text passwords.

Store only hashed passwords.

Example:

password:

$2a$10$abcdefghijklmnopqrstuv...

--------------------------------------------------
CONFIG.YML
--------------------------------------------------

Settings:

auto-ip-ban: true

kick-on-ip-change: true

kick-message: "&cAccess Denied!\n&7Wrong IP."

login-required: true

session-enabled: true

session-time: 60

max-login-attempts: 5

min-password-length: 6

max-password-length: 32

use-bcrypt: true

allow-chat-before-login: false

allow-movement-before-login: false

allow-inventory-before-login: false

temporary-ip-ban-on-failed-login: false

failed-login-ip-ban-time: 30

whitelist-enabled: false

log-all-events: true

--------------------------------------------------
FILES
--------------------------------------------------

plugins/

OneTimeIP/

config.yml

players.yml

ipbans.yml

whitelist.yml

sessions.yml

logs.yml

messages.yml

--------------------------------------------------
MESSAGES.YML
--------------------------------------------------

Everything configurable.

Examples:

Registration successful

Already registered

Please login

Wrong password

Too many attempts

Access denied

IP banned

Authenticated

Logged in

Session expired

IP mismatch

--------------------------------------------------
PERMISSIONS
--------------------------------------------------

onetimeip.admin

onetimeip.reload

onetimeip.info

onetimeip.reset

onetimeip.forceauth

onetimeip.forceregister

onetimeip.setip

onetimeip.ipban

onetimeip.ipunban

onetimeip.whitelist

--------------------------------------------------
EVENT LOGGING
--------------------------------------------------

Log:

Registrations

Logins

Failed logins

IP changes

IP bans

Unbans

Whitelist edits

Admin actions

--------------------------------------------------
OPTIMIZATION
--------------------------------------------------

Use asynchronous file saving.

Avoid blocking the main server thread.

Support 500+ online players.

Use caches where appropriate.

Prevent race conditions.

--------------------------------------------------
COMPATIBILITY
--------------------------------------------------

Minecraft Paper 1.21.11

Java 21

Paper API

Support both IPv4 and IPv6.

Support Velocity and BungeeCord forwarded IPs when properly configured.

--------------------------------------------------
PROJECT STRUCTURE
--------------------------------------------------

Generate a complete Maven project including:

• Full Java source code
• plugin.yml
• pom.xml
• config.yml
• messages.yml
• players.yml
• ipbans.yml
• whitelist.yml
• sessions.yml
• logs.yml
• Proper package structure
• Well-commented code
• Error handling
• Production-ready implementation
• No placeholder code
• No TODOs
• Ready to compile and use immediately.
Kodari AI
KodariJul 27 at 9:42 am 3

I’ll create the OneTimeIP plugin — a comprehensive authentication and security plugin for Paper 1.21.

OneTimeIP
A comprehensive authentication and security plugin for Minecraft Paper servers. Features IP-locked accounts, password-based login/registration, automatic IP banning on mismatch, IP whitelist system, session management, and configurable login restrictions. Uses BCrypt password hashing, supports 500+ concurrent players, and handles both IPv4 and IPv6 with proxy forwarding support.

Let me create all 25 files now.

I’ll build the OneTimeIP plugin — a comprehensive authentication and IP security plugin for Paper 1.21.

An advanced authentication and IP security plugin for Minecraft Paper servers. Features one-time IP locking, password registration/login with BCrypt hashing, automatic IP banning on mismatch, session system, IP whitelist management, login blocking (movement/inventory/interaction), admin commands, and comprehensive event logging. Designed for 500+ concurrent players with async file operations and caching.

Let me create all files now. I’ll start with the build configuration and resources, then the Java source

Now I’ll create all files. Let me start with the build configuration and resources, then the source code.

I’ll use the <create> tags directly. Let me write all the files now.

kingboy_0700

Remove Login And Register System and add these commands /ipban = Ban The Ip Permanantly /ipunban = Unban The Ip of a Player /iplist = Shows The List Of Ip Which are Banned /ipcheck = Shows The Ip of a Player

Kodari AI
KodariJul 28 at 9:00 am 53
  1. Remove the password login/register flow and its join-time authentication restrictions.

  2. Add /ipban, /ipunban, /iplist, and /ipcheck with permissions and registration.

  3. Update configuration/resources and remove obsolete authentication wiring.

</update>

The authentication code is no longer wired into the plugin; I’m removing the obsolete login/register/session classes and resource, leaving the first-IP protection and the four requested IP commands active.

  1. Removed the login/register system and all password, BCrypt, session, and authentication wiring.

  2. Added and registered:

    • /ipban <player|ip> — permanently bans an IP.

    • /ipunban <player|ip> — removes an IP ban.

    • /iplist — lists banned IPs, with /ipbanlist as an alias.

    • /ipcheck <player> — displays the player’s stored IP and ban status.

  3. Updated permissions, configuration, messages, pom.xml, and admin status/info commands.

  4. Preserved first-IP protection, automatic IP bans on mismatches, IP whitelist support, logging, and asynchronous persistence.

Kodari can make mistakes. Review important code before using.
Files
OneTimeIP
Code
22 1,592
OneTimeIP/src/main/java/com/onetimeip/OneTimeIP.java
package com.onetimeip;

import com.onetimeip.commands.*;
import com.onetimeip.config.ConfigManager;
import com.onetimeip.config.MessageManager;
import com.onetimeip.data.*;
import com.onetimeip.security.IPBanManager;
import com.onetimeip.security.IPWhitelistManager;
import com.onetimeip.security.LogManager;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * OneTimeIP - IP security plugin.
 *
 * Protects player accounts by permanently linking them to their first-used
 * IP address and provides administrative IP ban and whitelist commands.
 */
public class OneTimeIP extends JavaPlugin {

    private ConfigManager configManager;
    private MessageManager messageManager;
    private PlayerDataManager playerDataManager;
    private IPBanManager ipBanManager;
    private IPWhitelistManager ipWhitelistManager;
    private LogManager logManager;

    @Override
    public void onEnable() {
        long start = System.currentTimeMillis();

        this.configManager = new ConfigManager(this);
        this.messageManager = new MessageManager(this);

        this.playerDataManager = new PlayerDataManager(this);
        this.ipBanManager = new IPBanManager(this);
        this.ipWhitelistManager = new IPWhitelistManager(this);
        this.logManager = new LogManager(this);

        getServer().getPluginManager().registerEvents(new IPSecurityListener(this), this);
        registerCommands();

        getLogger().info("OneTimeIP v" + getDescription().getVersion() + " enabled in "
                + (System.currentTimeMillis() - start) + "ms");
    }

    @Override
    public void onDisable() {
        if (playerDataManager != null) playerDataManager.saveToDisk();
        if (ipBanManager != null) ipBanManager.saveToDisk();
        if (ipWhitelistManager != null) ipWhitelistManager.saveToDisk();
        if (logManager != null) logManager.saveToDisk();

        getLogger().info("OneTimeIP disabled - all data saved.");
    }

    private void registerCommands() {
        AdminCommand adminCommand = new AdminCommand(this);
        IPBanCommand ipBanCommand = new IPBanCommand(this);
        IPWhitelistCommand ipWhitelistCommand = new IPWhitelistCommand(this);

        getCommand("oneip").setExecutor(adminCommand);
        getCommand("ipban").setExecutor(ipBanCommand);
        getCommand("ipunban").setExecutor(ipBanCommand);
        getCommand("iplist").setExecutor(ipBanCommand);
        getCommand("ipcheck").setExecutor(ipBanCommand);
        getCommand("ipwhitelist").setExecutor(ipWhitelistCommand);
    }

    public ConfigManager cfg() { return configManager; }
    public MessageManager messages() { return messageManager; }
    public PlayerDataManager getPlayerDataManager() { return playerDataManager; }
    public IPBanManager getIPBanManager() { return ipBanManager; }
    public IPWhitelistManager getIPWhitelistManager() { return ipWhitelistManager; }
    public LogManager getLogManager() { return logManager; }
}