S
📎 1 file 1,791 chars
📄
pasted-code-1776697054321.txt
txt 84 lines
▶
**Prompt: Shadow Contracts Minecraft Plugin**

Create a detailed design and implementation plan for a Minecraft server plugin called **"Shadow Contracts"**.

### Core Concept:

Players can accept risky “contracts” that challenge them with specific objectives. Completing contracts grants rewards, while failing results in penalties.

---

### Core Features:

* INVENTORY GUI system to accept/decline contracts
* Randomized contract generation with difficulty scaling
* Time-limited objectives
* Risk vs reward balancing

---

### Example Contracts:

* Kill a number of mobs within a time limit
* Survive under certain health conditions
* Travel a distance without taking damage
* PvP-related objectives (optional)

---

### Rewards:

* Temporary buffs (speed, strength, luck)
* Money or items
* Unique perks or abilities

---

### Penalties:

* Debuffs (slowness, weakness)
* XP loss or item loss
* Temporary “mark” that increases mob aggression

---

### Systems to include:

* Player contract tracking system
* Cooldowns and limits
* Configurable difficulty scaling
* Event listeners for tracking progress
* Persistent data storage

---

### Advanced Features:

* Contract chains (multi-stage challenges)
* Daily/weekly rotating contracts
* Leaderboards
* Party/shared contracts
* Integration with economy plugins (Vault)

---

### Technical Requirements:

* Built for Spigot/Paper API
* Modular architecture
* Optimized for multiplayer servers
* Configurable via YAML
* Optional database support

---

### Output format:

* Architecture overview
* Key classes
* Example pseudocode
* Config examples
* Balancing suggestions

Make the plugin engaging, replayable, and suitable for survival and RPG servers.
Kodari AI
KodariApr 20 at 3:01 pm 21,248 (v2)

I’ll create a comprehensive Shadow Contracts plugin with randomized contracts, inventory GUI system, risk/reward mechanics, and persistent data tracking.

ShadowContracts
A dynamic contract system where players accept risky time-limited challenges with randomized objectives. Features include kill quests, survival challenges, travel missions, and PvP objectives. Completing contracts grants temporary buffs, items, and money, while failures result in debuffs, XP loss, and aggression marks. Includes difficulty scaling, cooldown systems, contract chains, daily rotations, leaderboards, and Vault economy integration with full GUI-based interaction.

Shadow Contracts plugin created successfully! This comprehensive system includes randomized contract generation with 4 difficulty levels, inventory GUI system for accepting/tracking contracts, 4 contract types (kill mobs, survive health, travel distance, PvP), dynamic reward/penalty system with buffs/debuffs, time-based tracking with expiration, cooldown management, leaderboards, history tracking, and Vault economy integration. All systems are modular and fully configurable via YAML.

S

i want that in the config you can add contracts and you can get coins when completing it vault

Kodari AI
KodariApr 20 at 3:16 pm 16,609 (v2)

I’ll modify the plugin to support custom contracts defined in config.yml and add Vault economy integration for coin rewards.

Now I’ll update the plugin to support custom contracts in config with Vault coin rewards:

Perfect! I’ve updated the Shadow Contracts plugin with the following features:

Key Changes:

1. Custom Contracts in Config

  • Added custom-contracts section in config.yml with 5 example contracts

  • Each contract can specify exact coins, items, buffs, xp penalties, and debuffs

  • Contracts can be enabled/disabled individually

2. Vault Economy Integration

  • Coins are now properly given via Vault when completing contracts

  • Custom contracts specify exact coin amounts

  • Random contracts use the multiplier system for coin calculation

  • Players receive a message showing how many coins they earned

3. Enhanced Contract System

  • Contract class now stores reward/penalty data (coins, items, buffs, xp loss, debuffs)

  • ContractManager loads custom contracts from config

  • Mix system: randomly chooses between custom and generated contracts

  • Custom contracts include mob types for kill objectives

4. Flexible Reward System

  • RewardManager reads contract-specific rewards first

  • Falls back to random rewards if contract doesn’t specify

  • Supports coin amounts, item lists, and buff durations per contract

5. Custom Penalty System

  • PenaltyManager applies contract-specific penalties

  • Supports custom XP loss amounts and debuff durations

  • Aggression mark can be enabled per contract

Example Custom Contract Format:

YAML
zombie_slayer:
  enabled: true
  type: KILL_MOBS
  difficulty: EASY
  time-limit-minutes: 15
  objective:
    description: "Kill 30 Zombies"
    target: 30
    mob-type: ZOMBIE
  rewards:
    coins: 250          # Vault coins!
    items:
      - DIAMOND:2
      - GOLDEN_APPLE:1
    buffs:
      - SPEED:1:600     # Effect:Level:Seconds
  penalties:
    xp-loss: 2
    debuffs:
      - SLOWNESS:1:300

The plugin now fully supports Vault economy and customizable contracts!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
28 2,028
src/main/java/com/shadowcontracts/plugin/ShadowContracts.java
package com.shadowcontracts.plugin;

import com.shadowcontracts.plugin.commands.ContractAdminCommand;
import com.shadowcontracts.plugin.commands.ContractCommand;
import com.shadowcontracts.plugin.config.ConfigManager;
import com.shadowcontracts.plugin.inventory.gui.GUIListener;
import com.shadowcontracts.plugin.inventory.gui.GUIManager;
import com.shadowcontracts.plugin.listeners.ContractProgressListener;
import com.shadowcontracts.plugin.listeners.PlayerDeathListener;
import com.shadowcontracts.plugin.listeners.PlayerJoinQuitListener;
import com.shadowcontracts.plugin.managers.ContractManager;
import com.shadowcontracts.plugin.managers.PenaltyManager;
import com.shadowcontracts.plugin.managers.PlayerDataManager;
import com.shadowcontracts.plugin.managers.RewardManager;
import com.shadowcontracts.plugin.tasks.ContractTimerTask;
import lombok.Getter;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ShadowContracts extends JavaPlugin {
    private ConfigManager configManager;
    private PlayerDataManager playerDataManager;
    private ContractManager contractManager;
    private RewardManager rewardManager;
    private PenaltyManager penaltyManager;
    private GUIManager guiManager;
    private Economy economy;
    
    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.playerDataManager = new PlayerDataManager(this);
        this.rewardManager = new RewardManager(this);
        this.penaltyManager = new PenaltyManager(this);
        this.contractManager = new ContractManager(this);
        this.guiManager = new GUIManager();
        
        if (Bukkit.getPluginManager().getPlugin("Vault") != null) {
            setupEconomy();
        }
        
        registerCommands();
        registerListeners();
        startTasks();
        
        getLogger().info("Shadow Contracts enabled!");
    }
    
    @Override
    public void onDisable() {
        if (playerDataManager != null) {
            playerDataManager.saveAll();
        }
        getLogger().info("Shadow Contracts disabled!");
    }
    
    private void setupEconomy() {
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp != null) {
            economy = rsp.getProvider();
            getLogger().info("Vault economy integration enabled!");
        }
    }
    
    private void registerCommands() {
        getCommand("contract").setExecutor(new ContractCommand(this));
        getCommand("contractadmin").setExecutor(new ContractAdminCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new ContractProgressListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this);
    }
    
    private void startTasks() {
        new ContractTimerTask(this).runTaskTimer(this, 20L, 20L);
    }
}