Adas Heniu
📎 1 file 6,372 chars
📄
pasted-code-1794445584621.txt
txt 86 lines
▶
Create a fully functional, highly optimized, and configurable Paper/Spigot Minecraft plugin for a Lifesteal / Anarchy server (version 1.20+) titled "ChristmasEvent".

The plugin must be written in Java, following modern PaperMC API best practices (using Component/Adventure API for messages, keeping operations asynchronous where needed, avoiding memory leaks, and providing a comprehensive config.yml).

### CRITICAL REQUIREMENTS:
1. **LANGUAGE:** ALL chat messages, GUI titles, item names, item lores, boss announcements, and system notifications MUST be in POLISH by default (in Polish language).
2. **TAB COMPLETION:** All commands, sub-commands, and arguments (e.g., player names, item types) MUST feature full Tab Completion (`TabCompleter`) for ease of use.

Below are the detailed specifications and requirements for the plugin:

---

### GENERAL CONFIGURATION (config.yml)
- All Polish item names, lore, particle effects, sounds, cooldowns, boss spawn times, loot tables, drop chances, and chat messages must be fully configurable via `config.yml`.
- Supports MiniMessage or Hex color codes (e.g., ``, `&#FF0000`).

---

### FEATURE 1: CHRISTMAS QUEST SYSTEM (NPC / GUI)
1. **Quest Pool:** Provide a pool of at least 10–15 pre-configured quests in Polish in `config.yml` (and structure it so server owners can easily add up to 100+ quests).
   - Examples of quest names in Polish: "Zabójca Potworów", "Górnik Świąteczny", "Łowca Graczy".
   - Quest types: `KILL_MOBS`, `KILL_PLAYERS`, `MINE_BLOCKS`, `FISH_ITEMS`.
2. **Daily Rotation:** Every day at midnight (or based on a 24h reset timer), the plugin randomly assigns 3 to 5 daily quests to each player.
3. **Command / NPC Interaction:**
   - Players can open the quest GUI using `/swieta` (or `/szef`, `/christmas`) or by right-clicking a designated NPC (compatible with Citizens NPC or custom entity tags).
   - GUI title must be in Polish (e.g., `&c&lZADANIA ŚWIĄTECZNE`).
4. **Rewards:** Completing quests awards event-specific Polish items used to trade for Event Keys (e.g., "Świąteczny Węgiel", "Piernikowy Żeton").

---

### FEATURE 2: CHRISTMAS ZONE & EVENT ITEMS
1. **Custom Currency Drops:**
   - Mobs killed in a defined "Christmas Zone" (configurable world guard region or coordinate range) or across the map have a configurable percentage chance to drop event tokens in Polish (e.g., "Zamarznięta Śnieżka", "Piernikowy Żeton").
2. **Event Crate Key Exchange GUI:**
   - Players can trade X amount of event tokens via a custom Polish GUI menu (`&e&lSKLEP ŚWIĄTECZNY`) to purchase "Świąteczne Klucze".
3. **Custom Event Items (Polish Names & Mechanics):**
   - **Rózga Mikołaja (Santa's Rod):** 
     - Item Name in Polish: `&c&lRózga Mikołaja`
     - Attribute: Has Knockback IV (KB 4).
     - Durability/Limits: Configurable maximum hits/uses (e.g., 50 uses). When durability reaches 0, the item breaks with a break sound/particle and sends a Polish message: `&cTwoja Rózga Mikołaja się złamała!`.
     - Optional Effect: 1-second Freeze / Slowness effect applied on hit.
   - **Królicza Łapka (Lucky Rabbit Foot - Offhand Heart Boost):**
     - Item Name in Polish: `&a&lŚwiąteczna Łapka Szczęścia`
     - Passive Ability: Grants +10 Max Health (+5 Extra Hearts / 10 HP) ONLY when held in the OFFHAND slot.
     - Listener Logic: Uses `PlayerSwapHandItemsEvent`, `PlayerItemHeldEvent`, and `InventoryClickEvent` to detect when the item enters or leaves the offhand. If removed from offhand, immediately remove the bonus hearts.

---

### FEATURE 3: THE GRINCH BOSS EVENT
1. **Scheduled Spawns:**
   - The Grinch Boss spawns automatically 3 times a day at configurable times (e.g., 14:00, 17:00, 20:00).
   - Broadcast global Polish chat announcements 10 minutes, 5 minutes, and 1 minute before spawn, displaying coordinates (e.g., `&c&lGRINCH: &fPojawię się za 5 minut na koordynatach X: %x%, Z: %z%!`).
2. **Boss Attributes & Mechanics:**
   - Entity: Wither Skeleton or Custom Zombie with Santa Hat/Armor named `&c&lGRINCH`.
   - Health: 1000 HP (configurable), with a visible BossBar in Polish (`&c&lGRINCH &8- &e%hp%/%max_hp% HP`).
   - Combat Abilities:
     - *Snowball Barrage:* Periodically shoots damaging snowballs in a circle.
     - *Freeze Area:* Temporarily freezes nearby players (Slowness + Ice particles).
3. **Loot & Reward Distribution System:**
   - **Top Damagers Rewards:** Top 3 players who dealt the most damage receive 1-2 Christmas Keys sent directly to their inventory/mail with a Polish message.
   - **Last Hit Bonus:** The player who lands the killing blow gets an extra reward and a broadcast message in Polish (e.g., `&aGracz %player% zadał ostateczny cios Grinchowi!`).
   - **Loot Explosion:** Upon death, the boss drops configurable items (Dusts, Tokens, and Event Keys) scattered in a 10-block radius with visual fireworks.

---

### COMMANDS, PERMISSIONS & TAB COMPLETION
1. **Player Commands:**
   - `/swieta` - Opens the main Christmas Event GUI (Quests & Token Shop).
2. **Admin Commands:**
   - `/grinch spawn` - Admin command to manually trigger the Grinch Boss spawn (`christmasevent.admin`).
   - `/grinch reload` - Reloads `config.yml` and quest data (`christmasevent.admin`).
   - `/grinch giveitem   ` - Gives specific event items (`christmasevent.admin`).
3. **TAB COMPLETER REQUIREMENTS:**
   - Implement a robust `TabCompleter` for all commands.
   - When typing `/grinch `, auto-suggest: `spawn`, `reload`, `giveitem`.
   - When typing `/grinch giveitem `, auto-suggest online player names.
   - When typing `/grinch giveitem  `, auto-suggest item types (`rod`, `rabbitfoot`, `key`).
   - When typing `/grinch giveitem   `, auto-suggest amounts (`1`, `8`, `16`, `64`).

---

### DATA STORAGE & TECHNICAL REQUIREMENTS
- Save player quest progress and daily rotations reliably in SQLite or YAML files (`/plugins/ChristmasEvent/data/`).
- Use `PersistentDataContainer` (PDC) to tag all custom items (Keys, Rod, Rabbit Foot) to prevent item duplication or forgery using standard anvil renaming.
- All messages in code default to Polish text.
- Code should be clean, modular, properly documented with comments, and split into clear packages: `commands`, `listeners`, `boss`, `quests`, `items`, `utils`.
Kodari AI
KodariNov 12 at 1:21 am 2
ChristmasEvent
Kompleksowy plugin świąteczny dla serwerów Lifesteal/Anarchy na Paper 1.20+. System codziennych zadań (15+ typów, rotacja 3-5 zadań), strefa świąteczna z dropem tokenów, wymiana na klucze w GUI, unikalne przedmioty (Rózga Mikołaja z Knockback IV i limitem użyć, Łapka Szczęścia dająca +10 HP w offhandzie), oraz boss Grinch z 3 zaplanowanymi spawnami dziennie, BossBarem, atakami śnieżkami i zamrożeniem. System nagród dla top 3 zadających obrażenia i gracza z ostatnim ciosem. Wszystkie komunikaty, GUI i itemy po polsku, w pełni konfigurowalne w config.yml z MiniMessage. Pełne TabCompletion dla komend /swieta i /grinch (spawn, reload, giveitem). Dane zapisywane w SQLite/YAML, przedmioty zabezpieczone PersistentDataContainer.
  1. Build the plugin foundation, Polish configuration, and configurable custom items.

  2. Add daily quests, event GUIs, commands with tab completion, and player data persistence.

  3. Add token drops, offhand health bonus, and the scheduled Grinch boss with rewards.

Utworzyłem plugin ChristmasEvent z polskimi komunikatami i konfiguracją w config.yml.

Zawiera codzienne zadania z zapisem postępów w plugins/ChristmasEvent/data/, GUI zadań i wymiany żetonów, oznaczone PDC przedmioty, drop żetonów, Rózgę Mikołaja, bonus zdrowia dla Łapki trzymanej w offhandzie oraz zaplanowane spawny Grincha z bossbarem, umiejętnościami i nagrodami.

Komendy: /swieta (aliasy /szef, /christmas) oraz administracyjne /grinch spawn, /grinch reload i /grinch giveitem <gracz> <rod|rabbitfoot|key> <ilość>. Tab-completion jest dostępne dla komend Grincha.

Adas Heniu
📎 1 file 3,567 chars
📄
pasted-code-1794447595226.txt
txt 47 lines
▶
Update and completely overhaul the "ChristmasEvent" plugin for Minecraft Paper 1.20+ to be 10000000000000000000000 times better, flawlessly optimized, visually stunning, and fully manageable via in-game commands.

Below are the mandatory requirements, aesthetic standards, and new command-control features, all strictly in Polish language:

---

### 1. THE GRINCH BOSS (CRITICAL FIXES)
- **Scale / Size Bug Fix:** Permanently fix the size bug where the Grinch shrinks back to normal after 1 second. Use proper Attribute Modifiers (`GENERIC_SCALE`) or Paper API to ensure the Grinch remains permanently massive (**Scale ~4.0**) throughout the entire combat.
- **Appearance:** Custom green-themed boss (Zombie/Wither Skeleton with dyed green armor, custom head, unmistakable green look).
- **Health & Mechanics:** 1000 HP, custom Polish BossBar (`&c&lGRINCH`), Snowball Barrage, and Area Freeze abilities.
- **Rewards:** Guaranteed keys for Top 3 damage dealers, extra reward for Last Hit, and a massive death explosion with fireworks and scattered loot.

---

### 2. STUNNING 250x250 CHRISTMAS MAP & STRUCTURES (HIGH AESTHETIC STANDARD)
- The 250x250 Christmas Zone arena must be **extremely beautiful, detailed, and visually breathtaking (absolutely NO ugly or primitive builds)**.
- **Central Christmas Tree:** A massive, masterfully detailed pine tree made of spruce wood, leaves, colorful wool/concrete ornaments, glowing blocks, and a radiant star on top.
- **Santa's Statue & Village Elements:** A gorgeous, high-detail pixel-art style statue of Santa Claus, decorative wrapped gift boxes, cozy winter cabins/stalls, and custom snow/ice detailing across the 250x250 area.
- **Protection:** Fully protect the zone against griefing (block break/place restrictions for normal players) while keeping PvP and event mechanics fully functional.

---

### 3. GUI, GRADIENTS & VISUAL EXCELLENCE
- Upgrade all GUI menus (`/swieta`, token shop, quest log) with professional design, borders, and smooth **MiniMessage/Hex color gradients** (e.g., green-to-red, gold-to-yellow transitions). No plain, boring text!
- **Custom Items:** Santa's Rod (KB4, custom durability/break effects) and Lucky Rabbit Foot (+10 HP when held in offhand) with glowing effects and pristine Polish lore.

---

### 4. FULL IN-GAME COMMAND CONTROL (WSZYSTKO KOMENDAMI)
- **Complete Command Management:** Server administrators must be able to manage, configure, and trigger **EVERYTHING** directly via in-game commands without needing to manually edit files or restart the server.
- **Required Admin Commands (`/grinch` or `/swieta admin`):**
  - `/grinch setspawn` - Sets the Grinch spawn point.
  - `/grinch setmap` or `/swieta setzone` - Sets the center coordinates for the 250x250 Christmas Zone.
  - `/grinch build` - Force-triggers the procedural generation/pasting of the 250x250 map structures.
  - `/grinch reload` - Reloads configuration and quests instantly.
  - `/grinch giveitem   ` - Gives event items.
  - `/grinch quest reset ` - Resets daily quests for a specific player.
  - `/grinch times add/remove/list` - Manages Grinch scheduled spawn times dynamically.

---

### TECHNICAL REQUIREMENTS
- Written in Java for Paper 1.20+.
- Fully configurable via `config.yml` (with all values editable live via commands).
- Robust data storage (SQLite/YAML) preventing data loss.
- Full Polish language support across all messages, items, GUIs, and announcements.
- Full TabCompletion for all commands.
Kodari AI
KodariNov 12 at 1:52 am 4
  1. Fix Grinch size, appearance, bossbar, abilities, and reward handling.

  2. Add live admin controls for spawn/map points, zone protection, quest resets, and spawn times.

  3. Upgrade GUI styling and tab completion; add arena generation only if it can be done safely without external build assets.

Zaimplementowałem aktualizację ChristmasEvent:

  • Grinch dostaje skalę 4.0, która jest ponownie ustawiana podczas walki, zielony pancerz, bossbar, ataki i wybuch z konfigurowalnymi fajerwerkami. Nagrody dla graczy offline trafiają do skrzynki oczekujących nagród.

  • Dodane komendy /grinch setspawn, /grinch setmap (także setzone), /grinch build, /grinch quest reset <gracz> oraz /grinch times add|remove|list. /grinch config get|set pozwala zarządzać ustawieniami bez edycji pliku; listy podawaj po przecinku.

  • /grinch build stopniowo tworzy śnieżną arenę 250×250 z choinką, posągiem Mikołaja, prezentami i chatkami. Strefa chroni bloki przed stawianiem i niszczeniem przez zwykłych graczy, ale nie blokuje PvP.

  • GUI otrzymały gradientowe tytuły, ozdobne ramki i połyskujące ikony; przedmioty eventowe również mają efekt połysku.

Ograniczenie skali: atrybut rozmiaru jest dostępny dopiero w Paper 1.20.5+, więc na Paper 1.20.4 i starszych Grinch pozostanie normalnego rozmiaru. Do autorskiej, bardzo szczegółowej mapy .schem użyj Kodari Studio (Builds, dostępne w płatnych planach) i przenieś ją do projektu przez workspace.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
13 2,467
src/main/java/pl/kodari/christmasevent/ChristmasEventPlugin.java
package pl.kodari.christmasevent;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import pl.kodari.christmasevent.boss.GrinchBossManager;
import pl.kodari.christmasevent.boss.ChristmasArenaBuilder;
import pl.kodari.christmasevent.commands.GrinchCommand;
import pl.kodari.christmasevent.gui.EventGuiManager;
import pl.kodari.christmasevent.items.EventItemManager;
import pl.kodari.christmasevent.listeners.EventListener;
import pl.kodari.christmasevent.quests.QuestManager;
import pl.kodari.christmasevent.util.TextUtil;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public final class ChristmasEventPlugin extends JavaPlugin {
    private ExecutorService dataWriter;
    private EventItemManager itemManager;
    private QuestManager questManager;
    private EventGuiManager guiManager;
    private GrinchBossManager bossManager;
    private ChristmasArenaBuilder arenaBuilder;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        try {
            Files.createDirectories(getDataFolder().toPath().resolve("data"));
        } catch (IOException exception) {
            throw new IllegalStateException("Nie można utworzyć katalogu danych wydarzenia.", exception);
        }
        dataWriter = Executors.newSingleThreadExecutor(runnable -> {
            Thread thread = new Thread(runnable, "ChristmasEvent-DataWriter");
            thread.setDaemon(true);
            return thread;
        });

        itemManager = new EventItemManager(this);
        questManager = new QuestManager(this, itemManager);
        guiManager = new EventGuiManager(this, questManager, itemManager);
        bossManager = new GrinchBossManager(this, itemManager);
        arenaBuilder = new ChristmasArenaBuilder(this);

        Bukkit.getPluginManager().registerEvents(new EventListener(this), this);
        Bukkit.getPluginManager().registerEvents(guiManager, this);
        getCommand("grinch").setExecutor(new GrinchCommand(this));
        getCommand("grinch").setTabCompleter(new GrinchCommand(this));
        getCommand("swieta").setExecutor(this::openEventCommand);
        getCommand("swieta").setTabCompleter(new TabCompleter() {
            @Override
            public java.util.List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
                return Collections.emptyList();
            }
        });

        questManager.start();
        bossManager.start();
        for (Player player : Bukkit.getOnlinePlayers()) {
            questManager.load(player);
            guiManager.refreshRabbitFoot(player);
            bossManager.addViewer(player);
        }
    }

    private boolean openEventCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            TextUtil.send(sender, getConfig().getString("messages.player-only"));
            return true;
        }
        guiManager.openMain(player);
        return true;
    }

    @Override
    public void onDisable() {
        if (questManager != null) {
            questManager.saveOnlinePlayers();
        }
        if (bossManager != null) {
            bossManager.shutdown();
        }
        if (arenaBuilder != null) {
            arenaBuilder.shutdown();
        }
        if (dataWriter != null) {
            dataWriter.shutdown();
            try {
                if (!dataWriter.awaitTermination(3, java.util.concurrent.TimeUnit.SECONDS)) {
                    dataWriter.shutdownNow();
                }
            } catch (InterruptedException exception) {
                Thread.currentThread().interrupt();
                dataWriter.shutdownNow();
            }
        }
    }

    public void saveDataAsync(Path path, String contents) {
        dataWriter.execute(() -> {
            try {
                Files.createDirectories(path.getParent());
                Files.writeString(path, contents, StandardCharsets.UTF_8);
            } catch (IOException exception) {
                getLogger().severe("Nie udało się zapisać danych gracza: " + exception.getMessage());
            }
        });
    }

    public EventItemManager items() {
        return itemManager;
    }

    public QuestManager quests() {
        return questManager;
    }

    public EventGuiManager gui() {
        return guiManager;
    }

    public GrinchBossManager boss() {
        return bossManager;
    }

    public ChristmasArenaBuilder arena() {
        return arenaBuilder;
    }
}