Naflate Cam

--- 📎 Attached 1 file(s):

File: pasted-code-1789819664057.txt

txt
Role: You are an expert Minecraft Java Plugin Developer (Paper API 1.20+).

Objective: Write a complete, standalone Minecraft Java plugin named CockFighting using Paper/Spigot API and Vault for economy. The plugin allows players to capture, train, fight, and bet on chickens in a custom arena.

1. Core Plugin Specifications
Target Version: Paper API 1.20.4+

Dependencies: Vault (Soft-depend / required for /bet)

Data Storage: Use PersistentDataContainer (PDC) to store custom chicken stats (Max Health, Base Damage) on ItemStacks and Entities, rather than parsing lore strings.

2. Custom Items
Protein Feed:

Item: WHEAT_SEEDS named "&eProtein Feed"

Action: Right-clicking a chicken increases its max health by 2.0 (heals it) and increments its stored base damage metadata by +1. Plays ENTITY_CHICKEN_EGG sound.

Capture Crate:

Item: CHEST named "&aCapture Crate"

Action: Right-clicking a chicken consumes 1 Crate, removes the chicken entity, and gives the player a Captured Fighter spawn egg.

Captured Fighter Egg:

Item: CHICKEN_SPAWN_EGG named "&cCaptured Fighter"

Data Saved in PDC: owner (UUID/String), max_health (Double), damage (Double).

Lore Display: Shows Owner name, Max HP, and Base Damage.

Action: Right-clicking a block spawns the chicken with its saved custom health and damage stats applied.

3. Commands & Permissions
/getchickenitems (Permission: admin.chicken): Gives 1 Capture Crate and 16 Protein Feed to the sender.

/setchickenarena <1 | 2 | spectator> (Permission: admin.chickenarena): Saves the sender's location for Fighter 1 spawn, Fighter 2 spawn, or Spectator area in a config.yml.

/chickenfight <player> <instant|betting> (Permission: cockfight.use):

Validates both players are holding a Captured Fighter egg.

Validates arena locations are set and no match is currently running.

Sends a challenge invitation to the target player.

/acceptfight (Permission: cockfight.use):

Accepts pending challenge.

Removes 1 egg from both players' inventories.

Reads PDC stats from both eggs to prepare match entities.

Teleports both players to the spectator location.

If mode is instant, starts match immediately. If betting, opens a 60-second countdown with broadcasts at 30s, 15s, and 5s.

/bet <1|2> <amount> (Permission: cockfight.use):

Integrates with Vault Economy.

Deducts funds and adds them to Fighter 1 or Fighter 2 pot during active betting windows.

4. Match Engine & Combat Logic
Spawn: Spawns two chickens at fighter1 and fighter2 locations, setting their custom display names, max health, current health, and custom damage attributes/PDC.

Combat Task: Runs a BukkitRunnable every 1.5 seconds while both chickens are alive:

Random 50/50 chance for Fighter 1 or Fighter 2 to attack the other.

Applies damage equal to the attacker's custom base damage attribute.

Plays sound effects on hit: ENTITY_CHICKEN_HURT, ENTITY_PLAYER_ATTACK_CRIT, and low-volume ENTITY_GENERIC_EXPLODE.

Victory & Payout:

When one chicken reaches 0 HP, clear remaining entities.

Broadcast the winning owner.

Play victory sound UI_TOAST_CHALLENGE_COMPLETE at winner location.

Calculate total pot pool (Pot1 + Pot2) and pay out betting winners proportionally to their contribution ((PlayerBet / FighterPot) * TotalPot).

Reset all fight and betting variables.

5. Delivery Requirements
Please provide:

Complete plugin.yml file.

Full Java code structured with main class CockFighting.java, Event Listeners, Command Executor classes, and Match Manager. Ensure no placeholder // TODO blocks are left in key logic.
📎 1 file 3,543 chars
📄
pasted-code-1789819686923.txt
txt 94 lines
▶
Role: You are an expert Minecraft Java Plugin Developer (Paper API 1.20+).

Objective: Write a complete, standalone Minecraft Java plugin named CockFighting using Paper/Spigot API and Vault for economy. The plugin allows players to capture, train, fight, and bet on chickens in a custom arena.

1. Core Plugin Specifications
Target Version: Paper API 1.20.4+

Dependencies: Vault (Soft-depend / required for /bet)

Data Storage: Use PersistentDataContainer (PDC) to store custom chicken stats (Max Health, Base Damage) on ItemStacks and Entities, rather than parsing lore strings.

2. Custom Items
Protein Feed:

Item: WHEAT_SEEDS named "&eProtein Feed"

Action: Right-clicking a chicken increases its max health by 2.0 (heals it) and increments its stored base damage metadata by +1. Plays ENTITY_CHICKEN_EGG sound.

Capture Crate:

Item: CHEST named "&aCapture Crate"

Action: Right-clicking a chicken consumes 1 Crate, removes the chicken entity, and gives the player a Captured Fighter spawn egg.

Captured Fighter Egg:

Item: CHICKEN_SPAWN_EGG named "&cCaptured Fighter"

Data Saved in PDC: owner (UUID/String), max_health (Double), damage (Double).

Lore Display: Shows Owner name, Max HP, and Base Damage.

Action: Right-clicking a block spawns the chicken with its saved custom health and damage stats applied.

3. Commands & Permissions
/getchickenitems (Permission: admin.chicken): Gives 1 Capture Crate and 16 Protein Feed to the sender.

/setchickenarena <1 | 2 | spectator> (Permission: admin.chickenarena): Saves the sender's location for Fighter 1 spawn, Fighter 2 spawn, or Spectator area in a config.yml.

/chickenfight   (Permission: cockfight.use):

Validates both players are holding a Captured Fighter egg.

Validates arena locations are set and no match is currently running.

Sends a challenge invitation to the target player.

/acceptfight (Permission: cockfight.use):

Accepts pending challenge.

Removes 1 egg from both players' inventories.

Reads PDC stats from both eggs to prepare match entities.

Teleports both players to the spectator location.

If mode is instant, starts match immediately. If betting, opens a 60-second countdown with broadcasts at 30s, 15s, and 5s.

/bet <1|2>  (Permission: cockfight.use):

Integrates with Vault Economy.

Deducts funds and adds them to Fighter 1 or Fighter 2 pot during active betting windows.

4. Match Engine & Combat Logic
Spawn: Spawns two chickens at fighter1 and fighter2 locations, setting their custom display names, max health, current health, and custom damage attributes/PDC.

Combat Task: Runs a BukkitRunnable every 1.5 seconds while both chickens are alive:

Random 50/50 chance for Fighter 1 or Fighter 2 to attack the other.

Applies damage equal to the attacker's custom base damage attribute.

Plays sound effects on hit: ENTITY_CHICKEN_HURT, ENTITY_PLAYER_ATTACK_CRIT, and low-volume ENTITY_GENERIC_EXPLODE.

Victory & Payout:

When one chicken reaches 0 HP, clear remaining entities.

Broadcast the winning owner.

Play victory sound UI_TOAST_CHALLENGE_COMPLETE at winner location.

Calculate total pot pool (Pot1 + Pot2) and pay out betting winners proportionally to their contribution ((PlayerBet / FighterPot) * TotalPot).

Reset all fight and betting variables.

5. Delivery Requirements
Please provide:

Complete plugin.yml file.

Full Java code structured with main class CockFighting.java, Event Listeners, Command Executor classes, and Match Manager. Ensure no placeholder // TODO blocks are left in key logic.
Kodari AI
KodariSep 19 at 12:11 pm 10
CockFighting
A comprehensive Minecraft plugin for capturing, training, and fighting chickens in a custom arena. Players use special items like Protein Feed to boost chicken stats and Capture Crates to obtain fighter eggs. The plugin features a full match engine with turn-based combat, betting integration with Vault economy, and a GUI-based interface for managing fights. Commands allow setting up arenas, challenging other players, and placing bets. The system uses PersistentDataContainer for storing custom chicken attributes and includes spectator teleportation, countdown timers, and proportional payout mechanics.
  1. Create the Paper/Vault Gradle project, plugin descriptor, and arena configuration.

  2. Implement PDC-backed fighter items and chicken interaction handling.

  3. Implement arena setup, challenge, acceptance, betting, combat, and proportional Vault payouts.

Implemented the complete CockFighting Paper plugin project with:

  • Gradle build targeting Paper 1.20.4+ and Vault API.

  • plugin.yml commands, permissions, and Vault soft dependency.

  • PDC-backed captured fighters storing owner, health, and damage.

  • Protein Feed training, Capture Crate capture flow, and fighter egg spawning.

  • Arena setup with persistent config locations.

  • Player challenges, acceptance flow, instant and 60-second betting modes.

  • Vault-backed bets with proportional winner payouts.

  • Automated chicken combat, sounds, victory broadcast, cleanup, and shutdown handling.

Naflate Cam

make sure to separate the crate and protein seed so i can sell them in the shop use command to give it

Kodari AI
KodariSep 19 at 12:15 pm 5
  1. Add separately tagged crate and protein-feed items so shop products cannot be confused with renamed vanilla items.

  2. Add console-safe commands to give either item to a named player, with an optional amount.

  1. Separated shop items with PDC item_type tags, preventing renamed wheat seeds or chests from functioning as plugin items.

  2. Added item-giving commands for console, admins, and shop integrations:

    • /giveproteinfeed <player> [amount]

    • /givecapturecrate <player> [amount]

  3. Kept /getchickenitems as the admin bundle command.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
12 889
src/main/java/com/kodari/cockfighting/CockFighting.java
package com.kodari.cockfighting;

import com.kodari.cockfighting.command.ChickenAdminCommand;
import com.kodari.cockfighting.command.FightCommand;
import com.kodari.cockfighting.listener.ChickenListener;
import com.kodari.cockfighting.match.MatchManager;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class CockFighting extends JavaPlugin {
    private Economy economy;
    private MatchManager matchManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        setupEconomy();

        this.matchManager = new MatchManager(this);
        Bukkit.getPluginManager().registerEvents(new ChickenListener(this), this);

        ChickenAdminCommand adminCommand = new ChickenAdminCommand(this);
        FightCommand fightCommand = new FightCommand(this);
        Objects.requireNonNull(getCommand("getchickenitems")).setExecutor(adminCommand);
        Objects.requireNonNull(getCommand("giveproteinfeed")).setExecutor(adminCommand);
        Objects.requireNonNull(getCommand("givecapturecrate")).setExecutor(adminCommand);
        Objects.requireNonNull(getCommand("setchickenarena")).setExecutor(adminCommand);
        Objects.requireNonNull(getCommand("chickenfight")).setExecutor(fightCommand);
        Objects.requireNonNull(getCommand("acceptfight")).setExecutor(fightCommand);
        Objects.requireNonNull(getCommand("bet")).setExecutor(fightCommand);
    }

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

    private void setupEconomy() {
        RegisteredServiceProvider<Economy> registration = Bukkit.getServicesManager().getRegistration(Economy.class);
        if (registration != null) {
            this.economy = registration.getProvider();
        }
    }

    public Economy getEconomy() {
        return economy;
    }

    public MatchManager getMatchManager() {
        return matchManager;
    }

    public boolean hasCompleteArena() {
        return getArenaLocation("fighter1") != null
                && getArenaLocation("fighter2") != null
                && getArenaLocation("spectator") != null;
    }

    public Location getArenaLocation(String key) {
        return getConfig().getLocation("arena." + key);
    }

    public void setArenaLocation(String key, Location location) {
        getConfig().set("arena." + key, location);
        saveConfig();
    }
}