enzo
📎 1 file 5,403 chars
📄
pasted-code-1788118971085.txt
txt 68 lines
▶
Create a comprehensive, highly optimized, all-in-one OP Prison Core plugin for Spigot/Paper 1.20+ in Java. The core must be modular, asynchronous, and inspired by popular OP Prison cores like EdPrison, UltraPrisonCore, and PinnaPrison.

### 1. Multi-Economy System
- **Currencies:** Vault Money, Tokens, Gems, and Coins.
- **Commands:** `/tokens`, `/gems`, `/coins` (check, give, take, set, pay).
- **Features:** Asynchronous database saving (SQLite/MySQL support), PlaceholderAPI expansion (`%core_tokens%`, `%core_gems%`, `%core_coins%`, with formatted values).

### 2. Bound Pickaxe & Tier System
- **1 Unique Pickaxe:** Bind a single custom pickaxe per player (`/pickaxe` or auto-given on join).
- **Attributes:** Cannot be dropped, traded, stored in chests, or lost on death.
- **Tiers & Levels:** Pickaxe levels up based on total blocks mined. Higher tiers unlock access to advanced custom enchantments and cosmetic particle/lore effects.
- **GUI:** Integrated `/pickaxe` GUI to manage enchantments, view stats, and inspect tier progression.

### 3. Custom Enchantment System & Dynamic Enchantment Engine
- **GUI Upgrade Menu:** Upgrade enchantments using Tokens/Gems via `/enchants`.
- **Pre-Built Enchants:**
  - *Explosive:* Mines a sphere/cube of blocks around the broken block.
  - *Jackhammer:* Clears an entire horizontal layer of the current mine.
  - *Laser:* Clears a vertical column downwards.
  - *TokenFinder / GemFinder / CoinFinder:* Chance to drop extra currencies directly into the player balance.
  - *LayerBreaker / Nuuke:* High-tier enchants clearing massive radii.
  - *Haste / Speed / NightVision:* Permanent potion effects while holding the pickaxe.
- **Dynamic Enchantment Creation Engine (`enchants.yml`):**
  - Allow administrators to create and register **NEW custom enchantments dynamically** via `enchants.yml` without modifying Java source code or recompiling.
  - **Custom Enchant Schema:**
    - `id`: Unique string identifier.
    - `display-name`, `lore`, `max-level`, `required-tier`, `base-cost`, `cost-multiplier`.
    - `trigger`: Action trigger type (`ON_BLOCK_BREAK`, `ON_SNEAK`, `PASSIVE_HELD`).
    - `activation-chance`: Formula supported (e.g., `0.01 * level` or `%level% * 0.05`).
    - `actions`: List of modular actions to execute on activation:
      - `BREAK_RADIUS`: Clears blocks in a defined shape/radius.
      - `ADD_CURRENCY`: Gives specified amount/formula of Money/Tokens/Gems/Coins.
      - `GIVE_POTION`: Applies potion effects (type, amplifier, duration).
      - `RUN_COMMAND`: Executes console or player commands.
      - `PLAY_EFFECT`: Plays particles and sounds at the broken block location.

### 4. Ranks & Auto-Rankup
- **Progression:** Unlimited/Configurable rank ladder (e.g., A to Z, then Prestige 1, 2, 3...).
- **Costs:** Configurable money cost per rankup.
- **Auto-Rankup Toggle:** `/autorankup` or `/autorankup toggle` command allowing players to enable or disable automatic rankups when they reach the required money.
- **Commands:** `/rankup`, `/prestige`, `/ranks`.

### 5. Private Mines System
- **Functionality:** Per-player private mining areas created in a designated skygrid/void world.
- **Commands:** `/pmine` (create, reset, tp, invite, kick, setpublic, setprivate).
- **Upgrades:** GUI to upgrade mine size, block composition percentages (e.g., adding higher-tier ores), and reset timers using Tokens/Gems.
- **Fast Async Resets:** Integrates with FastAsyncWorldEdit (FAWE) or native NMS block setters for instant, zero-lag mine resets.

### 6. Gangs & Competitive System
- **Gang Core:** Create gangs (`/gang create `), invite members, transfer ownership, and view gang info.
- **Gang Top Leaderboard:** Rank gangs based on the combined total blocks mined by all members in the gang.
- **Gang Perks:** Gang chat (`/gang chat`), shared gang bank/vault, and unlockable global gang multipliers.

### 7. Mining Bombs & Pouches
- **Bombs:** Throwable custom items (NBT-tagged) that instantly blow up a configurable radius of blocks in a mine and give the player all items/currencies/block stats.
- **Pouches:** Right-clickable pouch items (Money, Token, Gem pouches) with Tier 1 to Tier 5 rarities that grant a randomized range of currency upon opening with an animated action bar/title message.

### 8. Additional Integrated Modules
- **AutoSell & AutoSmelt:** Toggleable `/autosell` and `/autosmelt` modes that automatically convert ores to ingots and deposit money/tokens instantly into the balance without filling the inventory.
- **Virtual Backpacks:** Auto-expanding or token-upgradable storage (`/backpack`) linked to AutoSell when inventory management is preferred.
- **Global & Personal Multipliers:** Systems for temporary Money/Token/Gem multipliers (e.g., 2x Token Event for 30 minutes).

### 9. Technical Requirements & Developer API
- Modular class architecture (`EconomyManager`, `PickaxeManager`, `EnchantManager`, `MineManager`, `GangManager`).
- Config files: `config.yml`, `messages.yml`, `enchants.yml`, `ranks.yml`, `pmines.yml`.
- Full PlaceholderAPI support for scoreboards, tablists, and holograms.
- Developer API & Event Hooks (`CustomEnchantRegisterEvent`, `CustomEnchantTriggerEvent`) to easily extend functionality in code.
- Optimized performance for handling hundreds of blocks broken per second asynchronously.
Kodari AI
KodariAug 30 at 7:56 pm 3
OPPrisonCore
A comprehensive modular OP Prison Core plugin for Spigot/Paper 1.20+ featuring multi-economy (Vault Money, Tokens, Gems, Coins) with async SQLite/MySQL storage, bound pickaxe tier system, dynamic custom enchantment engine via enchants.yml with modular actions, unlimited rank ladder with auto-rankup, private mines with FAWE integration, gang system with leaderboards, mining bombs and pouches, auto-sell/smelt, virtual backpacks, multipliers, PlaceholderAPI support, and developer API with custom events.
  1. Create the Gradle project, plugin metadata, and configurable resource files.

  2. Add the core lifecycle, persistence, economy, progression, pickaxe, enchantment, mine, gang, item, GUI, and backpack managers.

  3. Register commands, listeners, PlaceholderAPI integration, and developer events for the requested gameplay systems.

Created the OPPrisonCore project with:

  • Gradle build configuration for Paper 1.20+, Vault, PlaceholderAPI, XSeries, SQLite, and Lombok.

  • Configurable economy, ranks, enchantments, private mines, pouches, and mining bombs.

  • SQLite/MySQL-compatible asynchronous player persistence.

  • Token, gem, coin, and Vault money management.

  • Bound pickaxe with tiers, block progression, protection from drops/storage/death, and pickaxe GUI.

  • Dynamic enchantment definitions with configurable triggers, costs, chances, and actions.

  • Rankup, prestige, auto-rankup, gangs, private mines, backpacks, autosell, autosmelt toggles, and item commands.

  • GUI framework with pickaxe and enchantment menus.

  • PlaceholderAPI expansion for currencies, blocks, rank, and prestige.

  • Custom enchantment registration and trigger events.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
41 2,419
src/main/java/com/kodari/prison/OPPrisonCore.java
package com.kodari.prison;

import com.kodari.prison.backpack.BackpackManager;
import com.kodari.prison.config.ConfigManager;
import com.kodari.prison.economy.EconomyManager;
import com.kodari.prison.enchant.EnchantManager;
import com.kodari.prison.gang.GangManager;
import com.kodari.prison.gui.GUIListener;
import com.kodari.prison.gui.GUIManager;
import com.kodari.prison.item.ItemManager;
import com.kodari.prison.integration.CoreExpansion;
import com.kodari.prison.mine.MineManager;
import com.kodari.prison.pickaxe.PickaxeManager;
import com.kodari.prison.progression.RankManager;
import com.kodari.prison.storage.DatabaseManager;
import com.kodari.prison.storage.PlayerDataManager;
import com.kodari.prison.command.PrisonCommand;
import com.kodari.prison.listener.PrisonListener;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public class OPPrisonCore extends JavaPlugin {
    private ConfigManager configuration;
    private DatabaseManager database;
    private PlayerDataManager data;
    private EconomyManager economy;
    private PickaxeManager pickaxe;
    private EnchantManager enchants;
    private RankManager ranks;
    private MineManager mines;
    private GangManager gangs;
    private BackpackManager backpacks;
    private ItemManager items;
    private GUIManager gui;

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

        configuration = new ConfigManager(this);
        database = new DatabaseManager(this);
        database.initialize();
        data = new PlayerDataManager(this, database);
        economy = new EconomyManager(this, data);
        pickaxe = new PickaxeManager(this, configuration, data);
        enchants = new EnchantManager(this, configuration, economy, pickaxe, data);
        ranks = new RankManager(configuration, economy, data);
        mines = new MineManager(this, configuration);
        gangs = new GangManager();
        backpacks = new BackpackManager(data, configuration);
        items = new ItemManager(this, configuration, economy, pickaxe, mines);
        gui = new GUIManager();

        PrisonListener listener = new PrisonListener(this);
        Bukkit.getPluginManager().registerEvents(listener, this);
        Bukkit.getPluginManager().registerEvents(new GUIListener(gui), this);

        PrisonCommand command = new PrisonCommand(this);
        String[] commands = {"tokens", "gems", "coins", "pickaxe", "enchants", "rankup", "prestige",
                "ranks", "autorankup", "pmine", "gang", "autosell", "autosmelt", "backpack", "prisonitem"};
        for (String name : commands) {
            PluginCommand pluginCommand = getCommand(name);
            if (pluginCommand != null) {
                pluginCommand.setExecutor(command);
                pluginCommand.setTabCompleter(command);
            }
        }

        Bukkit.getScheduler().runTaskTimer(this, () ->
                Bukkit.getOnlinePlayers().forEach(player -> enchants.applyPassive(player)), 20L, 20L);

        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            new CoreExpansion(this).register();
        }
        getLogger().info("OPPrisonCore enabled.");
    }

    @Override
    public void onDisable() {
        if (data != null) data.saveAll();
        if (database != null) database.shutdown();
    }

    public ConfigManager configuration() { return configuration; }
    public DatabaseManager database() { return database; }
    public PlayerDataManager data() { return data; }
    public EconomyManager economy() { return economy; }
    public PickaxeManager pickaxe() { return pickaxe; }
    public EnchantManager enchants() { return enchants; }
    public RankManager ranks() { return ranks; }
    public MineManager mines() { return mines; }
    public GangManager gangs() { return gangs; }
    public BackpackManager backpacks() { return backpacks; }
    public ItemManager items() { return items; }
    public GUIManager gui() { return gui; }
}