Scythezeyn Gt608
📎 1 file 4,145 chars
📄
pasted-code-1789932897460.txt
txt 42 lines
▶
Task: Create a fully featured, modular Minecraft server event plugin named EventCore targeting Paper 1.21.11 API (Java 21).

1. CORE SYSTEM & ARCHITECTURE
- Command: /events (opens a multi-page interactive GUI for event selection and management).
- Subcommands:
  * /event start  - Forces an event to start.
  * /event stop  - Forcefully terminates an active event.
  * /unfreeze  - Manually unfreezes a frozen player.
- UI Components: Customizable Boss Bars, Titles/Subtitles, and Chat Messages using Adventure Component API (kyori net.kyori.adventure) for timers, phases, targets, and winner declarations.
- Configuration: Complete config.yml for all event timings, custom reward tables, auto-scheduler intervals (in seconds/minutes), and message strings.

2. EVENT MODULES

A. Server Start & Hype Events
- SMP Start:
  * Interactive Mode: Teleports online players to a central point, launches them high into the air, and applies a gentle rotating velocity pattern ("tornado effect") before giving Slow Falling. Includes a configurable grace period phase (e.g., Mining Grace).
  * Remote/Border Mode: Gradually shrinks the world border from a starting size over configured intervals.

B. Item & Reward Events
- Pinata Party: Spawns a custom mob (Pinata) with configurable tiers (Bronze, Silver, Gold, Diamond).
  * Hit Mode: Drops configurable loot on every hit.
  * Death Mode: Accumulates all loot drops and releases them simultaneously when killed on the final hit.
- Supply Drop: Spawns a block container (e.g., Barrel) in the sky using Block Displays with particle trails that gradually falls to the ground. Features chance-based reward tables per drop tier.
- Altar Event: Admins create an altar while holding the target reward item and specifying the required sacrifice item/recipe (e.g., 4 Golden Apples -> 1 Netherite Ingot). Places a physical block with a custom hologram showing requirements.

C. Arena & PvP Events
- King of the Hill (KOTH): Configurable capture radius and duration. Players stay inside the radius to claim ownership; pushing the owner out shifts control to the new occupant.
- TNT Tag: Assigns an explosive TNT item to random players. Hitting another player passes the TNT. Explodes and eliminates the holder when the round timer runs out until 1 survivor remains.
- Freeze Tag: Assigns Chasers and Runners. Chasers freeze runners on hit. Ends early when all runners are frozen or when the timer expires.
- Bounty & Bounty Survivor: 
  * Bounty: Applies a glowing effect (`setGlowing(true)`) to a target player. The player who slays the target claims the reward.
  * Bounty Survivor: If the target survives the entire duration, they win the reward.
- Manhunt: Targets a speedrunner with a glowing effect. Features dual reward paths depending on whether the hunter kills the runner or the runner survives.
- Battle Royale: Multi-stage shrinking world borders with periodic, automated supply drop spawns within the active safe zone.
- Assassin (Lifesteal): Assigns a secret target to each player (showing only target name and live distance meter via Action Bar). Slaying the secret target increases max health (`Attribute.MAX_HEALTH`) for the killer while deducting max health from the target.

D. Party & Mini-Game Events
- Chat Trivia: Broadcasts questions in chat at interval times. First player to type the exact answer in chat wins the configured reward.
- Egg Hunt: Spawns a specified number of egg items within a defined radius. Players right-click eggs to receive randomized tier loot.
- Hide and Seek: Freezes seekers for a grace period while giving hiders a disguise tool to turn into environmental blocks using Block Display entities. Seekers hit suspicious blocks to reveal/eliminate hiders.
- Scavenger Hunt: Server-wide sequential item request system. Displays an item in the HUD/chat; players must craft/acquire and hold the exact item in order to advance and earn points.
- Ender Dragon Event: Tracks damage dealt by all players to the Ender Dragon and awards the Dragon Egg/rewards to the top damage dealer upon dragon death.
Kodari AI
KodariSep 20 at 7:43 pm 2
EventCore
EventCore is a modular Paper 1.21.11 server event plugin offering a comprehensive suite of interactive multiplayer events. It features a multi-page GUI for event management, configurable boss bars, titles, and chat messages via Adventure API. Modules include SMP start hype events with tornado effects, Pinata Party loot drops, Supply Drop containers, KOTH capture zones, TNT Tag, Freeze Tag, Bounty systems, Manhunt, Battle Royale with shrinking borders, Lifesteal Assassin, Chat Trivia, Egg Hunt, Hide and Seek with block disguises, Scavenger Hunt, and Ender Dragon damage tracking. Includes full config.yml customization for timings, rewards, and scheduler intervals.
  1. Create the Paper/Gradle project shell and configuration.

  2. Add the event lifecycle engine, GUI, commands, listeners, and scheduling.

  3. Add modular implementations for the requested event families and shared rewards/messages.

  4. Register everything in EventCore with safe startup/shutdown handling.

The initial project is in place. I’m wiring the remaining event-facing hooks now: GUI click dispatch, egg collection dispatch, scheduled auto-starting, and event-specific stop validation.1. Created the Java 21 Paper project with Gradle, plugin metadata, permissions, and comprehensive configuration. 2. Added the modular event engine with lifecycle management, timers, boss bars, titles, rewards, broadcasts, auto-scheduling, and shutdown cleanup. 3. Added /events, /event start, /event stop, and /unfreeze commands with a paginated interactive GUI. 4. Added modules for SMP Start, Pinata, Supply Drop, Altar, KOTH, TNT Tag, Freeze Tag, Bounty, Bounty Survivor, Manhunt, Battle Royale, Assassin, Chat Trivia, Egg Hunt, Hide and Seek, Scavenger Hunt, and Ender Dragon events. 5. Added shared Adventure text formatting, configurable reward commands, event listeners, player targeting, timers, and event-specific interactions.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
32 1,161
src/main/java/com/eventcore/EventCore.java
package com.eventcore;

import com.eventcore.command.EventCommand;
import com.eventcore.command.UnfreezeCommand;
import com.eventcore.core.EventListener;
import com.eventcore.core.EventManager;
import com.eventcore.modules.*;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.util.concurrent.ThreadLocalRandom;

public final class EventCore extends JavaPlugin {
    private EventManager eventManager;
    private FreezeTagModule freezeTag;
    private BukkitTask schedulerTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        eventManager = new EventManager(this);
        freezeTag = new FreezeTagModule(eventManager);
        eventManager.register(new SmpStartModule(eventManager));
        eventManager.register(new PinataModule(eventManager));
        eventManager.register(new SupplyDropModule(eventManager));
        eventManager.register(new AltarModule(eventManager));
        eventManager.register(new KothModule(eventManager));
        eventManager.register(new TntTagModule(eventManager));
        eventManager.register(freezeTag);
        eventManager.register(new BountyModule(eventManager, false));
        eventManager.register(new BountyModule(eventManager, true));
        eventManager.register(new ManhuntModule(eventManager));
        eventManager.register(new BattleRoyaleModule(eventManager));
        eventManager.register(new AssassinModule(eventManager));
        eventManager.register(new ChatTriviaModule(eventManager));
        eventManager.register(new EggHuntModule(eventManager));
        eventManager.register(new HideAndSeekModule(eventManager));
        eventManager.register(new ScavengerHuntModule(eventManager));
        eventManager.register(new EnderDragonModule(eventManager));
        EventCommand command = new EventCommand(eventManager);
        Bukkit.getPluginManager().registerEvents(new EventListener(eventManager), this);
        Bukkit.getPluginManager().registerEvents(new org.bukkit.event.Listener() {
            @org.bukkit.event.EventHandler
            public void menuClick(org.bukkit.event.inventory.InventoryClickEvent event) {
                command.menu().click(event);
            }
        }, this);
        getCommand("events").setExecutor(command);
        getCommand("events").setTabCompleter(command);
        getCommand("event").setExecutor(command);
        getCommand("event").setTabCompleter(command);
        getCommand("unfreeze").setExecutor(new UnfreezeCommand(freezeTag));
        if (getConfig().getBoolean("settings.auto-schedule", false)) {
            long interval = Math.max(20L, getConfig().getLong("settings.scheduler-seconds", 300) * 20L);
            schedulerTask = Bukkit.getScheduler().runTaskTimer(this, eventManager::autoStart, interval, interval);
        }
    }

    @Override
    public void onDisable() {
        if (schedulerTask != null) schedulerTask.cancel();
        if (eventManager != null) eventManager.stop();
    }

    public EventManager eventManager() {
        return eventManager;
    }
}