Amougus Imposter
📎 1 file 6,150 chars
📄
pasted-code-1794898757152.txt
txt 255 lines
▶
# PROJECT: HIPEX AUCTIONS

Create a complete, polished, working Minecraft Java Edition client-side Fabric mod named **Hipex Auctions**.

## 1. GAME COMPATIBILITY

- Minecraft Java Edition 1.21.11
- Fabric Loader
- Fabric API
- Java 21
- Client-side only
- Designed to work with OneClient where technically compatible.
- Must not require server-side installation.
- Must not require OP permissions.
- Must not use server exploits, automation or unauthorized server interactions.

## 2. MAIN PURPOSE

This mod is designed for Donut SMP.

It allows the player HipexMC to run timed auctions.

When the player starts an auction, the mod monitors incoming server chat messages for legitimate payment notifications addressed to HipexMC.

It extracts:
- The payer's Minecraft username.
- The payment amount.
- The payment notification timestamp.

It ignores:
- Ordinary player messages.
- Messages about payments to other players.
- Outgoing payments.
- Unrelated server notifications.
- Messages that cannot be confidently identified as incoming payments.

Make the payment-message parser configurable because the exact Donut SMP notification format must be verified.

Never invent payer names or payment amounts.

## 3. AUCTION COMMANDS

Implement these client-side commands:

/startbidding 
Starts a new auction for the specified duration.

/stopbidding
Ends the current auction early.

/leaderboard
Displays the current auction leaderboard or the most recently completed leaderboard.

/viewleaderboards
Opens a history interface containing previous completed auctions.

/clearleaderboard
Clears the current auction's leaderboard after confirmation.

/auction
Opens the main auction interface.

/auction help
Displays available commands.

Validate command arguments and show helpful error messages.

Prevent accidentally starting multiple simultaneous auctions.

## 4. BIDDING RULES

IMPORTANT: Use the highest single payment per player.

Example:

Player1 pays:
- 100k
- 500k
- 200k

Player1's recorded bid must be 500k, NOT 800k.

Player2 pays:
- 800k
- 300k

Player2's recorded bid must be 800k.

Player2 wins.

Rules:
- Only payments received during the active auction count.
- Each player's highest individual payment is their recorded bid.
- A new qualifying payment replaces their previous bid only if it is higher.
- Sort bidders by highest payment.
- Display the top five bidders.
- Handle ties consistently and document the tie-breaking rule.
- Do not count payments received before the auction started.
- Do not count payments after the auction ends.

## 5. LIVE AUCTION HUD

Create a beautiful custom Minecraft HUD.

Design:
- Dark navy background.
- Elegant gold accents.
- Clean modern typography.
- Rounded-looking panels.
- Subtle shadows.
- Smooth animations.
- Premium appearance.

Display:

HIPEX AUCTIONS

AUCTION ENDS IN: 00:30

TOP 5 BIDDERS

1. Username — $5,000,000
2. Username — $3,000,000
3. Username — $2,000,000
4. Username — $1,000,000
5. Username — $500,000

CURRENT WINNING BID

$5,000,000

HIGHEST BIDDER: Username

Requirements:
- Update the leaderboard immediately after a qualifying payment.
- Animate leaderboard position changes.
- Highlight the highest bidder in gold.
- Display a countdown timer.
- Add a progress bar.
- Make the HUD readable without blocking important gameplay.
- Support configurable HUD position and scale.

## 6. AUCTION ENDING EFFECTS

When the timer reaches zero:

1. Stop accepting new bids.
2. Determine the highest bidder.
3. Display a large centered announcement:

AUCTION COMPLETE!

USERNAME WON!

$AMOUNT

4. Play a configurable victory sound.
5. Show a confetti animation for exactly 2 seconds.
6. Display the final top-five leaderboard for 5 seconds.
7. Automatically hide the celebration interface.

If nobody bids, display:

AUCTION ENDED
NO VALID BIDS

Do not falsely claim that a player won.

## 7. AUCTION HISTORY

Every completed auction must be saved separately.

Store:
- Auction number.
- Start time.
- End time.
- Duration.
- Winner username.
- Winning amount.
- Final top-five leaderboard.
- All recorded bidders and their highest individual payments.

History requirements:
- Persist between Minecraft restarts.
- Store data locally.
- Never mix old bids with a new auction.
- Starting a new auction must create a completely fresh bidding session.
- Allow previous auctions to be viewed using /viewleaderboards.
- Allow browsing individual historical auctions.
- Provide a clear-history option with confirmation.

## 8. SETTINGS

Create a settings interface with:

- Enable/disable HUD.
- HUD scale.
- HUD position.
- Enable/disable countdown sounds.
- Enable/disable victory sound.
- Enable/disable confetti.
- Confetti duration.
- Leaderboard display duration.
- Payment-message parsing settings.
- Enable/disable auction notifications.

## 9. TECHNICAL REQUIREMENTS

- Use proper Fabric APIs for Minecraft 1.21.11.
- Use client-side chat message handling.
- Use Brigadier for commands.
- Use safe client-thread scheduling.
- Use persistent JSON configuration and history.
- Avoid blocking the Minecraft rendering thread.
- Handle malformed chat messages safely.
- Avoid duplicate payment processing.
- Separate UI, payment parsing, auction logic, commands, settings and history into clean classes.
- Include useful logging for debugging.
- Do not hardcode an unverified Donut SMP payment format.

## 10. BUILD REQUIREMENTS

Generate the COMPLETE project.

Include:
- build.gradle
- settings.gradle
- gradle.properties
- Fabric metadata
- Java source files
- Resource files
- Configuration classes
- README.md
- Build instructions
- Gradle Wrapper

Use a compatible Gradle version and official Fabric dependencies.

Compile the project and fix all compilation errors.

Do not claim that the mod works unless it has actually been compiled and tested.

Provide the finished Minecraft .jar file.

## 11. FINAL QUALITY

This must be a real working Minecraft mod, not a mockup, prototype screenshot or HTML interface.

Prioritize reliability, compatibility, clean design and correct auction calculations.

Name the final project:

HIPEX AUCTIONS v1.0

Author: HipexMC
Kodari AI
KodariTue at 7:05 am 13
HipexAuctions
Client-side Fabric mod for Minecraft 1.21.11 enabling timed auctions on Donut SMP. Monitors incoming chat messages for payment notifications to HipexMC, extracts payer username and amount via configurable parser, and tracks highest individual payment per player as bids. Features live HUD with countdown timer, top-5 leaderboard, gold-highlighted winner, progress bar, and smooth animations. Includes auction commands (/startbidding, /stopbidding, /leaderboard, /viewleaderboards, /clearleaderboard, /auction), persistent JSON history storage, configurable settings interface, victory sound, confetti effects, and celebration screens. Clean separation of UI, payment parsing, auction logic, commands, settings, and history modules with comprehensive logging.

Created the HIPEX AUCTIONS project with client-side commands, configurable payment parsing, highest-single-payment bidding, local history, settings and a HUD.

Not yet verified: The project hasn’t been compiled or tested, and no finished JAR or Gradle Wrapper is included. Leaderboard position animations are also not implemented. The payment parser is disabled until you configure and verify the server’s actual notification format.

To build in Kodari, click Compile in the top bar, then Compile in the window. On success, click Download.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
README.md
settings.gradle
Code
14 466
src/client/java/com/hipexmc/auctions/AuctionsClient.java
package com.hipexmc.auctions;

import com.mojang.brigadier.arguments.IntegerArgumentType;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.registry.Registries;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

public final class AuctionsClient implements ClientModInitializer {
    public static Settings settings;
    public static Storage.History history;
    public static AuctionData.Session active, completed;
    public static long celebrationStart;
    private static long deadline;
    private static int lastCountdown = -1;

    @Override public void onInitializeClient() {
        settings = Storage.load("settings.json", Settings.class, new Settings());
        history = Storage.load("history.json", Storage.History.class, new Storage.History());
        if (history.auctions == null) history.auctions = new java.util.ArrayList<>();
        if (!history.auctions.isEmpty()) completed = history.auctions.get(history.auctions.size() - 1);
        ClientReceiveMessageEvents.GAME.register((message, overlay) -> {
            long received = System.currentTimeMillis();
            String text = message.getString();
            MinecraftClient.getInstance().execute(() -> receive(text, received));
        });
        ClientTickEvents.END_CLIENT_TICK.register(client -> tick());
        HudElementRegistry.addLast(Identifier.of("hipex_auctions", "auction"), AuctionHud::render);
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, access) -> {
            dispatcher.register(ClientCommandManager.literal("startbidding").then(ClientCommandManager.argument("seconds", IntegerArgumentType.integer(1, 86400)).executes(c -> { start(IntegerArgumentType.getInteger(c, "seconds")); return 1; })));
            dispatcher.register(ClientCommandManager.literal("stopbidding").executes(c -> { stop(); return 1; }));
            dispatcher.register(ClientCommandManager.literal("leaderboard").executes(c -> { leaderboard(); return 1; }));
            dispatcher.register(ClientCommandManager.literal("viewleaderboards").executes(c -> { open(true); return 1; }));
            dispatcher.register(ClientCommandManager.literal("clearleaderboard").executes(c -> { MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new AuctionScreen(false, true))); return 1; }));
            dispatcher.register(ClientCommandManager.literal("auction").executes(c -> { open(false); return 1; }).then(ClientCommandManager.literal("help").executes(c -> { say("/startbidding <seconds> | /stopbidding | /leaderboard | /viewleaderboards | /clearleaderboard | /auction"); return 1; })));
        });
    }
    public static void open(boolean history) { MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new AuctionScreen(history, false))); }
    public static void say(String text) {
        var player = MinecraftClient.getInstance().player;
        if (player != null) player.sendMessage(Text.literal("[Hipex Auctions] " + text), false);
    }
    public static void start(int seconds) {
        tick();
        if (active != null) { say("An auction is already running."); return; }
        active = new AuctionData.Session(); active.number = history.nextNumber++; active.start = System.currentTimeMillis(); active.durationSeconds = seconds;
        deadline = active.start + seconds * 1000L; lastCountdown = -1; celebrationStart = 0;
        Storage.save("history.json", history);
        say("Auction #" + active.number + " started for " + seconds + " seconds." + (settings.paymentRegex == null || settings.paymentRegex.isBlank() ? " Payment parser is disabled; configure it in settings." : ""));
    }
    public static void stop() {
        if (active == null) { say("There is no active auction."); return; }
        finish(Math.min(System.currentTimeMillis(), deadline));
    }
    private static void receive(String message, long received) {
        if (active == null || received < active.start || received >= deadline) return;
        PaymentParser.parse(message, settings.paymentRegex).ifPresent(payment -> {
            AuctionData.Bid previous = active.bidders.stream().filter(b -> b.name.equalsIgnoreCase(payment.payer())).findFirst().orElse(null);
            if (previous == null) active.bidders.add(new AuctionData.Bid(payment.payer(), payment.amount(), received));
            else if (payment.amount().compareTo(previous.amount) > 0) { previous.amount = payment.amount(); previous.receivedAt = received; previous.name = payment.payer(); }
            else return;
            if (settings.notifications) say(payment.payer() + " bid " + AuctionData.money(payment.amount()));
        });
    }
    private static void tick() {
        if (active == null) return;
        long now = System.currentTimeMillis();
        if (now >= deadline) { finish(deadline); return; }
        int seconds = (int) ((deadline - now + 999) / 1000);
        if (seconds <= 3 && seconds != lastCountdown) {
            lastCountdown = seconds;
            if (settings.countdownSound) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.ui(SoundEvents.UI_BUTTON_CLICK, 1f));
        }
    }
    private static void finish(long end) {
        active.end = end; completed = active; active = null; history.auctions.add(completed); celebrationStart = System.currentTimeMillis();
        Storage.save("history.json", history);
        var sorted = completed.sorted();
        if (settings.notifications) say(sorted.isEmpty() ? "Auction ended: no valid bids." : sorted.getFirst().name + " won with " + AuctionData.money(sorted.getFirst().amount));
        if (settings.victorySound) {
            Identifier id = Identifier.tryParse(settings.victorySoundId == null ? "" : settings.victorySoundId);
            if (id != null) Registries.SOUND_EVENT.getEntry(id).ifPresent(sound -> MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.ui(sound, 1f)));
        }
    }
    public static void leaderboard() {
        var session = active != null ? active : completed;
        if (session == null) { say("No auction leaderboard available."); return; }
        say("Auction #" + session.number + " — top five:");
        var bids = session.sorted();
        if (bids.isEmpty()) say("No valid bids.");
        for (int i = 0; i < Math.min(5, bids.size()); i++) say((i + 1) + ". " + bids.get(i).name + " — " + AuctionData.money(bids.get(i).amount));
    }
    public static long remaining() { return active == null ? 0 : Math.max(0, deadline - System.currentTimeMillis()); }
}