gr4zd
📎 1 file 1,554 chars
📄
pasted-code-1783347148256.txt
txt 71 lines
▶
Generate a complete production-ready Minecraft Paper plugin named **LegacyReputation**.

Requirements:

* Paper 1.21.1
* Java 21
* Maven
* SQLite
* Fully compilable with `mvn package`
* Return the complete Maven project with every file.

Features:

* Randomly assign every new player Hero or Bandit (50/50).
* Save reputation permanently.
* Hero perks:

  * +1 heart
  * 10% regeneration
  * Better villager trades
  * Iron Golems ignore accidental hits
* Bandit perks:

  * +10% melee damage
  * +10% movement speed
  * 20% XP steal from players
* Hero kills Bandit:

  * Hero stays Hero.
  * Victim gets 60 seconds to use `/swaprep` or `/keeprep`.
  * If they do nothing, automatically execute `/keeprep`.
* Bandit kills Hero:

  * Same mechanic.
* Hero kills Hero:

  * Killer immediately becomes Bandit.
  * Display "You have fallen from grace."
* Bandit kills Bandit:

  * Killer immediately becomes Hero.
  * Display "You have redeemed yourself."
* Commands:

  * `/rep`
  * `/swaprep`
  * `/keeprep`
  * `/rep set  hero`
  * `/rep set  bandit`
  * `/rep reload`
  * `/rep reset `
* Store all player data in SQLite.
* Include:

  * `pom.xml`
  * `plugin.yml`
  * `config.yml`
  * `messages.yml`
  * All Java source files
  * README
* Use proper package separation:

  * commands
  * listeners
  * managers
  * models
  * database
  * utils
* No TODOs, no placeholder code, no missing methods.
* Ensure the project compiles successfully for Paper 1.21.1.
Kodari AI
KodariJul 6 at 2:15 pm 1

I’ll create the LegacyReputation plugin — a complete reputation system for Paper 1.21.1 with SQLite persistence.

LegacyReputation
A player reputation system that randomly assigns every new player as Hero or Bandit with unique perks. Heroes gain +1 heart, regeneration, better villager trades, and iron golem immunity. Bandits gain +10% melee damage, +10% speed, and 20% XP steal from kills. Includes kill-based reputation swaps, pending swap mechanic, and full admin commands.
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
18 1,104
src/main/java/com/legacyreputation/LegacyReputation.java
package com.legacyreputation;

import com.legacyreputation.commands.KeepRepCommand;
import com.legacyreputation.commands.RepCommand;
import com.legacyreputation.commands.SwapRepCommand;
import com.legacyreputation.database.DatabaseManager;
import com.legacyreputation.database.SQLiteDatabase;
import com.legacyreputation.listeners.BanditPerksListener;
import com.legacyreputation.listeners.CombatListener;
import com.legacyreputation.listeners.HeroPerksListener;
import com.legacyreputation.listeners.PlayerJoinListener;
import com.legacyreputation.managers.ReputationManager;
import com.legacyreputation.utils.MessageUtil;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class LegacyReputation extends JavaPlugin {

    private DatabaseManager databaseManager;
    private ReputationManager reputationManager;
    private MessageUtil messageUtil;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);

        this.messageUtil = new MessageUtil(this);
        this.databaseManager = new SQLiteDatabase(this);
        this.databaseManager.initialize();
        this.reputationManager = new ReputationManager(this, databaseManager, messageUtil);

        registerListeners();
        registerCommands();
        startSchedulers();

        getLogger().info("LegacyReputation enabled.");
    }

    @Override
    public void onDisable() {
        if (databaseManager != null) {
            databaseManager.close();
        }
        getLogger().info("LegacyReputation disabled.");
    }

    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(reputationManager, messageUtil), this);
        Bukkit.getPluginManager().registerEvents(new CombatListener(reputationManager, messageUtil), this);
        Bukkit.getPluginManager().registerEvents(new HeroPerksListener(reputationManager), this);
        Bukkit.getPluginManager().registerEvents(new BanditPerksListener(reputationManager, messageUtil), this);
    }

    private void registerCommands() {
        RepCommand repCommand = new RepCommand(reputationManager, messageUtil);
        getCommand("rep").setExecutor(repCommand);
        getCommand("rep").setTabCompleter(repCommand);
        getCommand("swaprep").setExecutor(new SwapRepCommand(reputationManager, messageUtil));
        getCommand("keeprep").setExecutor(new KeepRepCommand(reputationManager, messageUtil));
    }

    private void startSchedulers() {
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            reputationManager.checkExpiredSwaps();
            reputationManager.applyHeroRegeneration();
        }, 20L, 20L);
    }

    public ReputationManager getReputationManager() {
        return reputationManager;
    }

    public MessageUtil getMessageUtil() {
        return messageUtil;
    }
}