P

this is whole prompt

📎 1 file 4,414 chars
📄
AccountSwitcher_Plugin_Prompt.txt
txt 239 lines
▶
Minecraft Plugin Development Prompt

Create a high-quality Paper 1.21.11 Java plugin (Java 21, Maven) named
AccountSwitcher.

Purpose

This plugin is designed for server owners to transfer everything from
one player account to another. It should only be usable by the server
console or OP players with the proper permission.

Main Command

/switch

Example:

/switch Steve Alex

This command transfers EVERYTHING from Steve to Alex.

After completion: - Steve becomes completely empty/default. - Alex now
owns everything Steve previously owned. - The transfer must be as safe
as possible.

Things That MUST Transfer

Inventory

Transfer: - Main inventory - Hotbar - Armor - Offhand - Cursor item -
Crafting slots (if possible)

Ender Chest

Transfer the entire Ender Chest.

XP

Transfer: - Level - Experience progress - Total experience

Health

Transfer: - Current health - Max health (if modified) - Absorption
hearts

Hunger

Transfer: - Hunger - Saturation - Exhaustion

Potion Effects

Transfer every active potion effect.

Statistics

Transfer: - Deaths - Mob kills - Blocks mined - Playtime - All Bukkit
statistics that can be copied safely.

Advancements

Transfer all advancements.

Recipes

Transfer all unlocked recipes.

Scoreboard Data

Transfer: - Teams - Tags - Scoreboard values - Objectives

PersistentDataContainer

Transfer every PersistentDataContainer key.

Spawn Point

Transfer the player’s personal spawn point.

Location

Optionally move the new account to the old player’s location.

Homes (IMPORTANT)

I am using SetHome 6.2.

The plugin must support it.

The AI should inspect the plugin through its public API if available.

If there is no API, detect and safely migrate its saved home data.

Every home should be moved.

Example:

Steve owns: - home - mine - end - village

After transfer:

Alex owns: - home - mine - end - village

Steve owns zero homes.

The transfer must preserve: - Home names - World - Coordinates - Yaw -
Pitch - Metadata

The migration must be compatible with the installed SetHome plugin.

SimpleTPA Compatibility

My server also uses SimpleTPA.

The plugin must remain fully compatible.

If SimpleTPA stores pending requests or player UUID references, update
them if possible.

Never break SimpleTPA.

UUID Handling

Many plugins save data by UUID.

The plugin should intelligently migrate UUID-based data whenever
possible.

Provide a clean API for future integrations.

Offline Players

The plugin must work when: - Both players are offline - One is online -
Both are online

Handle all cases safely.

Safety

Before switching:

Create a full backup in:

plugins/AccountSwitcher/backups/

Store: - Inventories - Ender chest - Homes - Playerdata - Metadata

Rollback Command

/switch rollback

Restores everything.

Preview Command

/switch preview Steve Alex

Shows exactly what will transfer.

Example: - Inventory ✓ - Armor ✓ - Ender Chest ✓ - Homes (5) - XP -
Health - Advancements - Recipes - Statistics

No changes are made.

Confirmation

Running:

/switch Steve Alex

Should respond:

This will permanently transfer everything.

Run:

/switch confirm

Only after confirmation should the transfer happen.

Logging

Log every transfer in:

logs/switch.log

Include: - Old player - New player - Executor - Date - Transferred
data - Backup ID

Permissions

Only OP or console may use.

Permissions: - accountswitcher.use - accountswitcher.rollback -
accountswitcher.preview

Default: op

Nobody else can execute any command.

Console Support

Console must be able to execute:

switch Steve Alex

Error Handling

Handle: - Player not found - Same player entered twice - Corrupted
data - Backup failure - Offline player files missing - UUID conflicts

Never corrupt player data.

Performance

Transfers should be asynchronous whenever possible.

Never freeze the server.

Compatibility

Support: - Paper 1.21.11 - Java 21 - Maven

Project Structure

Use clean OOP architecture.

Separate classes for: - Command - Backup Manager - Inventory Transfer -
EnderChest Transfer - XP Transfer - Home Migration - UUID Migration -
Rollback Manager - Logger - Utilities

Deliverables

Provide: - Complete Maven project - Source code - plugin.yml -
config.yml - README - Well-commented code - No placeholder methods -
Production-ready implementation

The code should compile without errors and be ready to drop into a Paper
1.21.11 server after running mvn package.
Kodari AI
KodariJul 2 at 11:46 am 3

I’ll build the AccountSwitcher plugin — a comprehensive player account transfer system for Paper 1.21.11.

AccountSwitcher
A Paper plugin for server admins to transfer all player data between accounts. Supports inventory, ender chest, XP, health, hunger, potion effects, statistics, advancements, recipes, scoreboard, persistent data, spawn points, and homes (SetHome 6.2). Features include offline player support, dry-run preview, confirmation workflow, full backups with rollback, UUID migration, and comprehensive logging.</project_descriptionI'll build the AccountSwitcher plugin — a complete Paper 1.21.11 account transfer system. Let me create all files now.
AccountSwitcher
A comprehensive account transfer plugin for Paper 1.21.11 that migrates everything between player profiles including inventory, ender chest, XP, health, hunger, potion effects, statistics, advancements, recipes, scoreboard data, persistent data, spawn point, and location. Features SetHome 6.2 compatibility, offline player support, backup/rollback, preview mode, confirmation system, and detailed logging.

The project is complete. Here’s a summary of what was built:

AccountSwitcher — 22 source files organized into clean packages:

Package
Files
Purpose
root
AccountSwitcher.java
Main plugin class, thread pool, manager wiring
command/
SwitchCommand.java
,
SwitchTabCompleter.java
/switch
with confirm/preview/rollback/list subcommands, tab completion
backup/
BackupManager.java
,
BackupData.java
Creates/restores full backups to
plugins/AccountSwitcher/backups/
rollback/
RollbackManager.java
Rollback orchestration with backup-lookup
preview/
PreviewManager.java
Generates detailed transfer previews
transfer/
13 transfer classes
Each handles one data domain (inventory, ender chest, XP, health, hunger, potions, statistics, advancements, recipes, scoreboard, PDC, spawn, location, homes)
uuid/
UUIDMigration.java
Scans plugin data folders and replaces UUID references
logging/
TransferLogger.java
Appends to
logs/switch.log
with timestamps
util/
PlayerDataUtil.java
Player/UUID resolution utilities

Key design decisions:

  • Offline-first: All transfer operations handle 4 states (both online, both offline, one online)

  • SetHome 6.2: Scans 3 storage formats (per-player YAML, central data.yml, central data.json) and migrates homes accordingly

  • SimpleTPA compatible: Uses UUID-based file scanning — never touches SimpleTPA data files directly

  • Safety: Full JSON+serialized binary backup before any transfer; confirmation timeout; error rollback

  • Async: Heavy operations run on a 4-thread pool, never freezing the server

  • Gson shaded into the JAR so no external dependencies required on the server

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
29 3,224
src/main/java/com/accountswitcher/AccountSwitcher.java
package com.accountswitcher;

import com.accountswitcher.backup.BackupManager;
import com.accountswitcher.command.SwitchCommand;
import com.accountswitcher.command.SwitchTabCompleter;
import com.accountswitcher.logging.TransferLogger;
import com.accountswitcher.preview.PreviewManager;
import com.accountswitcher.rollback.RollbackManager;
import com.accountswitcher.transfer.TransferManager;
import com.accountswitcher.uuid.UUIDMigration;
import com.accountswitcher.util.PlayerDataUtil;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

public final class AccountSwitcher extends JavaPlugin {

    private static AccountSwitcher instance;
    private BackupManager backupManager;
    private RollbackManager rollbackManager;
    private TransferManager transferManager;
    private PreviewManager previewManager;
    private TransferLogger transferLogger;
    private UUIDMigration uuidMigration;
    private PlayerDataUtil playerDataUtil;
    private ScheduledExecutorService executor;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        this.executor = Executors.newScheduledThreadPool(4);

        this.playerDataUtil = new PlayerDataUtil();
        this.backupManager = new BackupManager(this);
        this.rollbackManager = new RollbackManager(this);
        this.transferManager = new TransferManager(this);
        this.previewManager = new PreviewManager(this);
        this.transferLogger = new TransferLogger(this);
        this.uuidMigration = new UUIDMigration(this);

        SwitchCommand switchCommand = new SwitchCommand(this);
        Bukkit.getPluginCommand("switch").setExecutor(switchCommand);
        Bukkit.getPluginCommand("switch").setTabCompleter(new SwitchTabCompleter(this));

        scheduleBackupCleanup();

        getLogger().info("AccountSwitcher v" + getDescription().getVersion() + " enabled.");
    }

    @Override
    public void onDisable() {
        if (executor != null && !executor.isShutdown()) {
            executor.shutdown();
            try {
                executor.awaitTermination(5, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                getLogger().log(Level.WARNING, "Executor shutdown interrupted", e);
            }
        }
        instance = null;
    }

    private void scheduleBackupCleanup() {
        int retentionDays = getConfig().getInt("backup-retention-days", 30);
        executor.scheduleAtFixedRate(() -> {
            try {
                backupManager.cleanOldBackups(retentionDays);
            } catch (Exception e) {
                getLogger().log(Level.WARNING, "Backup cleanup failed", e);
            }
        }, 1, 24, TimeUnit.HOURS);
    }

    public static AccountSwitcher getInstance() {
        return instance;
    }

    public BackupManager getBackupManager() {
        return backupManager;
    }

    public RollbackManager getRollbackManager() {
        return rollbackManager;
    }

    public TransferManager getTransferManager() {
        return transferManager;
    }

    public PreviewManager getPreviewManager() {
        return previewManager;
    }

    public TransferLogger getTransferLogger() {
        return transferLogger;
    }

    public UUIDMigration getUuidMigration() {
        return uuidMigration;
    }

    public PlayerDataUtil getPlayerDataUtil() {
        return playerDataUtil;
    }

    public ScheduledExecutorService getExecutor() {
        return executor;
    }
}