wer995

wersja 1.21.11

📎 2 files 21,000 chars
📄
pasted-code-1792282411377.txt
txt 225 lines
▶
# Plugin: AnarchyEvents+ — Events, Custom Items, LifeSteal & AntiCheat

## 1. General Information

Create a complete, stable Minecraft Java Edition plugin for an SMP/LifeSteal server with an anarchy theme.

- Platform: Paper
- Programming language: Java
- Build system: Maven
- Target server version: Minecraft 1.21.4
- API: Paper API compatible with Minecraft 1.21.4
- Include the main plugin class and `plugin.yml`.
- Store all settings in YAML configuration files.
- Support Polish language messages.
- Persist player data and plugin settings across server restarts.
- Organize the code into separate, maintainable modules and classes.
- Generate a complete project that can be compiled into a `.jar` file.

## 2. Event Items System

Implement a system for creating unique event items. Each item must have its own name, lore, rarity, appearance, effects, cooldown, and acquisition method.

### Heart of Immortality
- Legendary item.
- Grants a short Resistance effect when activated.
- Cooldown: 10 minutes.
- Does not provide complete immunity to death.
- All effects and durations must be configurable.

### Storm Totem
- Summons a lightning strike near the selected target.
- Configurable range and damage.
- Must not destroy blocks.
- Include a visual effect and cooldown.

### Blood Moon Sword
- Unique event sword with a custom name and lore.
- Displays special particle effects when hitting an enemy.
- Has a configurable chance to trigger an additional effect.
- Configurable damage, effects, and cooldowns.

### Escape Amulet
- Teleports the player to a previously configured safe location.
- Includes a configurable teleportation warm-up.
- Teleportation is cancelled if the player takes damage, moves too far, or changes worlds during the warm-up.
- Supports cooldowns and world-specific restrictions.

### Chaos Crystal
- Activates a temporary area-of-effect ability.
- Configurable range, duration, and effects.
- Must not destroy blocks unless explicitly enabled by an administrator.
- Include appropriate visual effects and cooldown handling.

### Event Crate
- A special crate containing random rewards.
- Supports configurable drop chances, reward pools, and rarity tiers.
- Prevent players from claiming the same reward multiple times through repeated interactions.
- Supports item rewards, money rewards, and keys if a compatible economy or crate system is installed.
- Handle missing external integrations safely.

## 3. Server Events System

Create events that can be started manually by administrators or automatically according to a configurable schedule.

Supported events:

- **Blood Moon:** Special PvP rewards and configurable event conditions.
- **Supply Drop:** Spawns a loot crate at a configured location.
- **Boss Event:** Spawns a powerful boss with a health bar and configurable rewards.
- **Treasure Hunt:** Challenges players to find hidden event chests in a designated area.
- **KOTH (King of the Hill):** Players compete to control a specific location.
- **Double Rewards:** Temporarily doubles selected rewards.

Requirements:

- Broadcast messages, titles, and action bar notifications.
- Boss bars showing event progress, remaining time, or boss health.
- Protection against duplicated rewards.
- Configurable duration, rewards, locations, cooldowns, and scheduling.
- Automatically end events and clean up temporary entities, tasks, and objects.
- Prevent conflicting events from running simultaneously when configured.
- Handle server shutdowns and restarts safely.
- Save event state when necessary and avoid duplicating rewards after recovery.

## 4. LifeSteal System

Implement a complete LifeSteal system.

- Killing another player grants the killer a configurable number of hearts.
- Player deaths remove a configurable number of hearts.
- Configurable minimum and maximum heart limits.
- Allow players to obtain and use a custom Heart item.
- Optionally ban, eliminate, or restrict players when they reach the minimum heart limit.
- Provide administrator commands for adding and removing hearts.
- Persist player heart data using a database or reliable file storage.
- Prevent duplicated heart rewards and repeated kill processing.
- Prevent abuse through suicide, repeated kills between the same players, and other configurable farming methods.
- Include configurable combat-logging behavior.
- Handle offline players, disconnects, and server restarts correctly.
- Keep the displayed health synchronized with the stored heart count.

## 5. Custom Items and Special Abilities

Create a configurable custom-item framework using YAML files.

Administrators must be able to define:

- Material and item name.
- Lore and rarity.
- Enchantments and visual effects.
- Abilities activated by right-clicking.
- Abilities triggered when hitting an enemy.
- Cooldowns and effect durations.
- World, game mode, and permission restrictions.
- Maximum item quantities, if required.
- Optional usage limits and acquisition methods.

Every custom item must have a unique, persistent identifier stored in the item's persistent data. Never identify custom items solely by their display name or lore.

Validate item identifiers and abilities on the server side. Prevent players from forging custom items by renaming ordinary items or modifying their lore.

## 6. Administrator Commands

Implement the following commands with tab completion and permission checks:

- `/ae help` — Display the available commands.
- `/ae reload` — Reload the configuration safely.
- `/ae give   [amount]` — Give a custom item to a player.
- `/ae event start ` — Start an event.
- `/ae event stop` — Stop the currently active event.
- `/ae event list` — List available events and their statuses.
- `/ae setspawn ` — Set a named location.
- `/ae hearts add  ` — Add hearts to a player.
- `/ae hearts remove  ` — Remove hearts from a player.
- `/ae inspect ` — Display a player's plugin-related statistics and heart data.

Implement granular permissions, including:

- `anarchy.admin`
- `anarchy.items.give`
- `anarchy.events.manage`
- `anarchy.hearts.manage`
- `anarchy.inspect`

The main administrator permission may grant access to all administrative commands, but individual permissions must also work independently.

Validate all command arguments, player names, item IDs, amounts, and event names. Return clear error messages in Polish.

## 7. AntiCheat and Server Protection

Implement a basic server-side protection module.

Features:

- Detect suspicious or physically implausible behavior using multiple signals.
- Protect against repeated activation of events and item abilities.
- Validate damage, cooldowns, teleportation, and reward distribution.
- Prevent custom-item duplication and unauthorized item creation.
- Add rate limits for repeated actions and spam.
- Log suspicious events to separate log files.
- Provide configurable alerts for administrators.
- Include a monitoring-only mode that records suspicious behavior without issuing punishments.

Do not automatically ban a player based on a single suspicious event. Use configurable thresholds, multiple signals, and repeated observations to reduce false positives.

Make it clear that this is a basic protection module, not a complete replacement for a dedicated anti-cheat plugin. Avoid claiming that it can detect every cheat.

## 8. Configuration Files

Create separate, well-documented YAML configuration files:

- `config.yml` — General settings, language, storage, permissions, and global options.
- `items.yml` — Custom item definitions, abilities, effects, cooldowns, and rarity.
- `events.yml` — Event definitions, schedules, locations, rewards, and durations.
- `lifesteal.yml` — Heart limits, kill rewards, death penalties, and elimination rules.
- `messages.yml` — All player-facing messages in Polish.
- `anticheat.yml` — Detection settings, thresholds, logging, alerts, and monitoring mode.

Provide working example configurations for every supported item and event.

Validate configuration files on startup and reload. Report invalid settings with clear error messages instead of silently ignoring them.

## 9. Code Quality and Implementation Requirements

- Generate complete, compilable Java source code, not pseudocode.
- Do not leave empty methods, placeholder implementations, or unimplemented features.
- Ensure that every advertised command, item ability, and event is implemented.
- Use persistent item identifiers and robust server-side validation.
- Prefer supported Paper API methods compatible with Minecraft 1.21.4.
- Avoid deprecated APIs where suitable alternatives exist.
- Keep expensive operations off the main server thread when safe to do so.
- Perform Bukkit/Paper world and entity operations on the appropriate server thread.
- Implement exception handling and meaningful logging.
- Ensure that scheduled tasks, boss bars, temporary entities, and listeners are cleaned up correctly when the plugin shuts down.
- Save player data safely and prevent data corruption.
- Avoid unnecessary dependencies and document every required external library.
- Include unit tests or integration tests for critical mechanics, especially heart calculations, reward distribution, cooldowns, and duplication prevention.
- Provide installation, configuration, compilation, and testing instructions.
- Include an example configuration that works immediately after installation.

## 10. Maven Project and Final Deliverables

Generate the complete Maven project, including:

- `pom.xml`
- All Java source files.
- `plugin.yml`
- All YAML configuration templates.
- Resource files.
- Tests for critical functionality.
- A README with setup and troubleshooting instructions.

Use a stable Java version compatible with Paper 1.21.4.

The final project must compile using:

`mvn clean package`

Place the compiled plugin JAR in the `target` directory.

If you cannot directly generate a compiled JAR, provide all source files and the exact build instructions required to compile it.

Do not claim that the plugin has been tested or compiled unless the build and tests have actually been executed successfully.

Prioritize correctness, security, performance, maintainability, and compatibility with Minecraft 1.21.4.
📄
pasted-code-1792283072311.txt
txt 225 lines
▶
# Plugin: AnarchyEvents+ — Events, Custom Items, LifeSteal & AntiCheat

## 1. General Information

Create a complete, stable Minecraft Java Edition plugin for an SMP/LifeSteal server with an anarchy theme.

- Platform: Paper
- Programming language: Java
- Build system: Maven
- Target server version: Minecraft 1.21.4
- API: Paper API compatible with Minecraft 1.21.4
- Include the main plugin class and `plugin.yml`.
- Store all settings in YAML configuration files.
- Support Polish language messages.
- Persist player data and plugin settings across server restarts.
- Organize the code into separate, maintainable modules and classes.
- Generate a complete project that can be compiled into a `.jar` file.

## 2. Event Items System

Implement a system for creating unique event items. Each item must have its own name, lore, rarity, appearance, effects, cooldown, and acquisition method.

### Heart of Immortality
- Legendary item.
- Grants a short Resistance effect when activated.
- Cooldown: 10 minutes.
- Does not provide complete immunity to death.
- All effects and durations must be configurable.

### Storm Totem
- Summons a lightning strike near the selected target.
- Configurable range and damage.
- Must not destroy blocks.
- Include a visual effect and cooldown.

### Blood Moon Sword
- Unique event sword with a custom name and lore.
- Displays special particle effects when hitting an enemy.
- Has a configurable chance to trigger an additional effect.
- Configurable damage, effects, and cooldowns.

### Escape Amulet
- Teleports the player to a previously configured safe location.
- Includes a configurable teleportation warm-up.
- Teleportation is cancelled if the player takes damage, moves too far, or changes worlds during the warm-up.
- Supports cooldowns and world-specific restrictions.

### Chaos Crystal
- Activates a temporary area-of-effect ability.
- Configurable range, duration, and effects.
- Must not destroy blocks unless explicitly enabled by an administrator.
- Include appropriate visual effects and cooldown handling.

### Event Crate
- A special crate containing random rewards.
- Supports configurable drop chances, reward pools, and rarity tiers.
- Prevent players from claiming the same reward multiple times through repeated interactions.
- Supports item rewards, money rewards, and keys if a compatible economy or crate system is installed.
- Handle missing external integrations safely.

## 3. Server Events System

Create events that can be started manually by administrators or automatically according to a configurable schedule.

Supported events:

- **Blood Moon:** Special PvP rewards and configurable event conditions.
- **Supply Drop:** Spawns a loot crate at a configured location.
- **Boss Event:** Spawns a powerful boss with a health bar and configurable rewards.
- **Treasure Hunt:** Challenges players to find hidden event chests in a designated area.
- **KOTH (King of the Hill):** Players compete to control a specific location.
- **Double Rewards:** Temporarily doubles selected rewards.

Requirements:

- Broadcast messages, titles, and action bar notifications.
- Boss bars showing event progress, remaining time, or boss health.
- Protection against duplicated rewards.
- Configurable duration, rewards, locations, cooldowns, and scheduling.
- Automatically end events and clean up temporary entities, tasks, and objects.
- Prevent conflicting events from running simultaneously when configured.
- Handle server shutdowns and restarts safely.
- Save event state when necessary and avoid duplicating rewards after recovery.

## 4. LifeSteal System

Implement a complete LifeSteal system.

- Killing another player grants the killer a configurable number of hearts.
- Player deaths remove a configurable number of hearts.
- Configurable minimum and maximum heart limits.
- Allow players to obtain and use a custom Heart item.
- Optionally ban, eliminate, or restrict players when they reach the minimum heart limit.
- Provide administrator commands for adding and removing hearts.
- Persist player heart data using a database or reliable file storage.
- Prevent duplicated heart rewards and repeated kill processing.
- Prevent abuse through suicide, repeated kills between the same players, and other configurable farming methods.
- Include configurable combat-logging behavior.
- Handle offline players, disconnects, and server restarts correctly.
- Keep the displayed health synchronized with the stored heart count.

## 5. Custom Items and Special Abilities

Create a configurable custom-item framework using YAML files.

Administrators must be able to define:

- Material and item name.
- Lore and rarity.
- Enchantments and visual effects.
- Abilities activated by right-clicking.
- Abilities triggered when hitting an enemy.
- Cooldowns and effect durations.
- World, game mode, and permission restrictions.
- Maximum item quantities, if required.
- Optional usage limits and acquisition methods.

Every custom item must have a unique, persistent identifier stored in the item's persistent data. Never identify custom items solely by their display name or lore.

Validate item identifiers and abilities on the server side. Prevent players from forging custom items by renaming ordinary items or modifying their lore.

## 6. Administrator Commands

Implement the following commands with tab completion and permission checks:

- `/ae help` — Display the available commands.
- `/ae reload` — Reload the configuration safely.
- `/ae give   [amount]` — Give a custom item to a player.
- `/ae event start ` — Start an event.
- `/ae event stop` — Stop the currently active event.
- `/ae event list` — List available events and their statuses.
- `/ae setspawn ` — Set a named location.
- `/ae hearts add  ` — Add hearts to a player.
- `/ae hearts remove  ` — Remove hearts from a player.
- `/ae inspect ` — Display a player's plugin-related statistics and heart data.

Implement granular permissions, including:

- `anarchy.admin`
- `anarchy.items.give`
- `anarchy.events.manage`
- `anarchy.hearts.manage`
- `anarchy.inspect`

The main administrator permission may grant access to all administrative commands, but individual permissions must also work independently.

Validate all command arguments, player names, item IDs, amounts, and event names. Return clear error messages in Polish.

## 7. AntiCheat and Server Protection

Implement a basic server-side protection module.

Features:

- Detect suspicious or physically implausible behavior using multiple signals.
- Protect against repeated activation of events and item abilities.
- Validate damage, cooldowns, teleportation, and reward distribution.
- Prevent custom-item duplication and unauthorized item creation.
- Add rate limits for repeated actions and spam.
- Log suspicious events to separate log files.
- Provide configurable alerts for administrators.
- Include a monitoring-only mode that records suspicious behavior without issuing punishments.

Do not automatically ban a player based on a single suspicious event. Use configurable thresholds, multiple signals, and repeated observations to reduce false positives.

Make it clear that this is a basic protection module, not a complete replacement for a dedicated anti-cheat plugin. Avoid claiming that it can detect every cheat.

## 8. Configuration Files

Create separate, well-documented YAML configuration files:

- `config.yml` — General settings, language, storage, permissions, and global options.
- `items.yml` — Custom item definitions, abilities, effects, cooldowns, and rarity.
- `events.yml` — Event definitions, schedules, locations, rewards, and durations.
- `lifesteal.yml` — Heart limits, kill rewards, death penalties, and elimination rules.
- `messages.yml` — All player-facing messages in Polish.
- `anticheat.yml` — Detection settings, thresholds, logging, alerts, and monitoring mode.

Provide working example configurations for every supported item and event.

Validate configuration files on startup and reload. Report invalid settings with clear error messages instead of silently ignoring them.

## 9. Code Quality and Implementation Requirements

- Generate complete, compilable Java source code, not pseudocode.
- Do not leave empty methods, placeholder implementations, or unimplemented features.
- Ensure that every advertised command, item ability, and event is implemented.
- Use persistent item identifiers and robust server-side validation.
- Prefer supported Paper API methods compatible with Minecraft 1.21.4.
- Avoid deprecated APIs where suitable alternatives exist.
- Keep expensive operations off the main server thread when safe to do so.
- Perform Bukkit/Paper world and entity operations on the appropriate server thread.
- Implement exception handling and meaningful logging.
- Ensure that scheduled tasks, boss bars, temporary entities, and listeners are cleaned up correctly when the plugin shuts down.
- Save player data safely and prevent data corruption.
- Avoid unnecessary dependencies and document every required external library.
- Include unit tests or integration tests for critical mechanics, especially heart calculations, reward distribution, cooldowns, and duplication prevention.
- Provide installation, configuration, compilation, and testing instructions.
- Include an example configuration that works immediately after installation.

## 10. Maven Project and Final Deliverables

Generate the complete Maven project, including:

- `pom.xml`
- All Java source files.
- `plugin.yml`
- All YAML configuration templates.
- Resource files.
- Tests for critical functionality.
- A README with setup and troubleshooting instructions.

Use a stable Java version compatible with Paper 1.21.4.

The final project must compile using:

`mvn clean package`

Place the compiled plugin JAR in the `target` directory.

If you cannot directly generate a compiled JAR, provide all source files and the exact build instructions required to compile it.

Do not claim that the plugin has been tested or compiled unless the build and tests have actually been executed successfully.

Prioritize correctness, security, performance, maintainability, and compatibility with Minecraft 1.21.4.
Kodari AI
KodariOct 18 at 12:31 am 3
AnarchyEventsPlus
Comprehensive Paper plugin for anarchy SMP servers integrating event items, server events, LifeSteal mechanics, custom item framework, admin commands, and basic anti-cheat. Features configurable YAML files for items, events, hearts, messages, and anti-cheat settings. Includes persistent player data storage, cooldown management, reward validation, and Polish language support. Provides granular permissions, tab completion, and robust server-side validation to prevent duplication and abuse. Implements scheduled events, boss bars, and automatic cleanup on shutdown.
  1. Utworzę projekt Maven dla Paper 1.21.11 i polskie konfiguracje.

  2. Dodam LifeSteal, identyfikowane PDC przedmioty oraz ich umiejętności.

  3. Dodam zarządzanie wydarzeniami, komendy administracyjne i podstawowy moduł ochronny.

  4. Dodam plugin.yml, README oraz testy obliczeń serc.

Utworzyłem projekt AnarchyEvents+ dla Paper 1.21.11 / Java 21, z konfiguracjami YAML, pom.xml, plugin.yml, README i testem logiki serc.

  • Dodałem LifeSteal z trwałym zapisem serc i statystyk, komendy administracyjne oraz siedem typów przedmiotów specjalnych.

  • Dodałem sześć wydarzeń, harmonogramy interwałowe, nagrody i sprzątanie obiektów tymczasowych po restarcie.

  • Moduł ochronny zapisuje sygnały do osobnego logu; domyślnie działa w trybie monitorowania. Nagrody pieniężne i klucze są pomijane, jeśli nie ma zewnętrznej integracji.

  • Nie uruchamiałem kompilacji ani testów, więc nie potwierdzam, że projekt został zbudowany. JAR pobierzesz po kompilacji w Kodari: na komputerze kliknij Compile → Compile, a na telefonie ⋮ → Compile Project → Compile. Po sukcesie wybierz Download.

wer995
📎 1 file 4,657 chars
📄
pasted-code-1792316242835.txt
txt 57 lines
▶
# AnarchyEventsPlus — 15 nowych eventów i 15 eventówek
Wersja serwera: Paper 1.21.11, Java 21.

Dodaj do pluginu 15 w pełni działających eventów oraz 15 unikalnych eventówek (specjalnych przedmiotów). Wszystkie funkcje muszą być zaimplementowane w kodzie, a nie tylko opisane. Eventy i przedmioty muszą współpracować z istniejącym pluginem AnarchyEventsPlus.

## CZĘŚĆ 1 — 15 EVENTÓW

1. **Blood Moon** — czerwony księżyc, silniejsze potwory i dodatkowe nagrody za zabijanie mobów.
2. **Supply Drop** — losowa skrzynia z cennym lootem, której lokalizacja jest ogłaszana wszystkim graczom.
3. **Boss Event** — potężny boss z paskiem zdrowia, własnymi atakami i nagrodami dla uczestników.
4. **Treasure Hunt** — poszukiwanie ukrytej skrzyni na podstawie wskazówek i koordynatów.
5. **King of the Hill** — przejmowanie i utrzymywanie wyznaczonego obszaru w celu zdobywania punktów.
6. **Meteor Shower** — meteory spadające w określonych miejscach, pozostawiające surowce i nagrody.
7. **Chaos Storm** — burza z piorunami, specjalnymi strefami i ładunkami energii do zbierania.
8. **Nether Rift** — portal eventowy, fale silnych mobów i nagroda za pokonanie wszystkich fal.
9. **Last Life Arena** — turniej PvP, w którym wygrywa ostatni żywy uczestnik.
10. **Hour of Wealth** — czasowe podwójne nagrody za wybrane aktywności.
11. **Zombie Invasion** — fale zombie o rosnącym poziomie trudności i coraz lepszych nagrodach.
12. **Legendary Weapon Hunt** — poszukiwanie legendarnej broni chronionej przez moby lub zadania.
13. **Frost Blizzard** — lodowe moby, kryształy mrozu i nagrody za ich zbieranie.
14. **Capture the Flag** — dwie drużyny próbują przejąć flagę przeciwnika i zdobyć najwięcej punktów.
15. **Chaos Crystal** — gracze ładują kryształ, utrzymując kontrolę nad obszarem; zwycięzca zdobywa rzadką nagrodę.

## CZĘŚĆ 2 — 15 EVENTÓWEK

1. **Heart of Immortality** — jednorazowo ratuje posiadacza przed śmiercią, jeśli mechanika jest aktywna i przedmiot znajduje się w ekwipunku.
2. **Storm Totem** — po użyciu wywołuje efekt burzy i uderzenie pioruna w bezpiecznie wyznaczonym miejscu.
3. **Blood Moon Sword** — specjalny miecz z unikalną umiejętnością aktywowaną prawym przyciskiem myszy, z cooldownem.
4. **Escape Amulet** — po aktywacji teleportuje właściciela do ustawionego bezpiecznego punktu, jeśli nie walczy i nie ma blokady teleportacji.
5. **Chaos Crystal** — po aktywacji uruchamia efekt obszarowy i daje punkty w odpowiednim evencie.
6. **Event Crate Key** — klucz otwierający specjalną skrzynię eventową z nagrodami konfigurowanymi w YAML.
7. **Soul Reaper Scythe** — kosa zadająca dodatkowe obrażenia mobom i zbierająca dusze za pokonanych przeciwników.
8. **Phoenix Feather** — jednorazowo przywraca część zdrowia po aktywacji, z czasem odnowienia.
9. **Thunder Hammer** — młot wywołujący kontrolowany efekt pioruna przy trafieniu, z cooldownem.
10. **Shadow Dagger** — sztylet dający krótką niewidzialność lub szybkość po użyciu.
11. **Vampire Fang** — broń przywracająca część zdrowia za zadane obrażenia, z limitem leczenia.
12. **Frost Orb** — kula spowalniająca pobliskich przeciwników na krótki czas.
13. **Gravity Rune** — runa dająca pobliskim graczom krótki efekt podbicia lub spowolnienia.
14. **Hunter’s Compass** — kompas wskazujący aktywny event lub cel eventowy, jeśli taki istnieje.
15. **Lucky Dice** — kość uruchamiająca losowy efekt z ustalonej listy, z równoważonymi szansami.

## WYMAGANIA TECHNICZNE

- Kompatybilność z Paper 1.21.11 i Java 21.
- Każdy event musi mieć faktyczną logikę, warunki zwycięstwa, czas trwania, cooldown i nagrody.
- Każda eventówka musi mieć unikalny identyfikator w PersistentDataContainer, aby nie dało się jej podrobić zwykłą nazwą przedmiotu.
- Dodaj komendy administratora do rozpoczynania, kończenia, konfigurowania i sprawdzania statusu eventów.
- Dodaj komendy do przyznawania eventówek graczom.
- Dodaj uprawnienia dla administratorów i graczy.
- Dodaj pliki YAML do konfiguracji eventów, przedmiotów, dropów, nagród, cooldownów i wiadomości.
- Dodaj zabezpieczenia przed duplikowaniem przedmiotów, wielokrotnym odbieraniem nagród i nadużywaniem teleportacji.
- Po restarcie serwera wyczyść lub bezpiecznie odtwórz stan eventów zgodnie z konfiguracją.
- Nie wykonuj ciężkich operacji na głównym wątku serwera.
- Dodaj obsługę błędów, README, przykładową konfigurację i instrukcję kompilacji Maven.
- Wszystkie komendy, nazwy przedmiotów, opisy i wiadomości powinny być konfigurowalne.
- Nie usuwaj istniejących funkcji pluginu.
- Nie deklaruj funkcji jako ukończonych, jeśli nie zostały zaimplementowane i przetestowane.
Kodari AI
KodariOct 18 at 10:01 am 18
  1. Sprawdzę obecną strukturę pluginu i jego system eventów, żeby rozbudowa zachowała istniejące funkcje.

  2. Dodam framework eventów oraz logikę 15 eventów.

  3. Dodam 15 eventówek z identyfikatorami PDC, cooldownami i zabezpieczeniami.

  4. Dodam komendy, uprawnienia, konfigurowalne pliki YAML oraz dokumentację.

Rozbudowa pluginu została dodana w kodzie i konfiguracji:

  • 15 wydarzeń wraz z cyklami, cooldownami, warunkami zwycięstwa i nagrodami. Zachowałem też dotychczasowe double_rewards. Dodałem m.in. losowy Zrzut Zaopatrzenia z ogłoszeniem koordynatów, fale mobów, strażników legendarnej broni, punktację CTF i ładowanie Kryształu Chaosu.

  • 15 eventówek z unikalnymi identyfikatorami PDC. Obejmują opisane zdolności, w tym jednorazową ochronę przed śmiercią, bezpieczny amulet teleportacyjny oraz menu Event Crate Key z ochroną przed duplikacją nagrody.

  • Dodałem komendy /ae event status i /ae event configure, obsługę uprawnień graczy i administratorów, ustawienia w YAML oraz aktualizację README.

  • Stan tymczasowych obiektów i pogody jest sprzątany lub przywracany po restarcie; czyszczenie oznaczonych encji odbywa się partiami.

Nie uruchomiłem serwera Paper 1.21.11, więc nie mogę potwierdzić testów runtime ani deklarować, że funkcje zostały przetestowane. README wskazuje kompilację przez Compile w Kodari; projekt zachowuje konfigurację Maven w pom.xml.

wer995

skończyłęs

Kodari AI
KodariOct 18 at 10:05 am 1

Nie mam jeszcze zadania do wykonania — napisz, co mam zrobić.

wer995

dodaj 15 nowych itemów w tym cała zbroja protection 5 z nazwą np. hełm. blood helmet oraz miecz z ostrością sześć i miecz z ostrością siedem i jak na mieczu z ostrością siedem kliknię się prawy przycisk myszki daje na 10 sekund efekt siłay 2 resztę przedmiotów i ich umiejętności zrób na koniec

Kodari AI
KodariOct 18 at 11:50 am 1

Plan:

  1. Sprawdzę, jak projekt rejestruje własne przedmioty i umiejętności.

  2. Dodam 15 nowych przedmiotów: pełny zestaw Blood z Protection V, dwa miecze oraz 9 autorskich przedmiotów z umiejętnościami.

Dodano 15 przedmiotów: pełną zbroję Blood z Protection V, miecze z Ostrością VI i VII oraz 9 dodatkowych przedmiotów z umiejętnościami. PPM mieczem Blood VII daje Siłę II na 10 sekund; ma też 30-sekundowy cooldown.

Przedmioty dodasz komendą /ae give <gracz> <id>. ID to m.in. blood_helmet, blood_sword_6, blood_sword_7 i blood_totem.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
19 3,196
src/main/java/pl/anarchyevents/AnarchyEventsPlugin.java
package pl.anarchyevents;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.List;

public final class AnarchyEventsPlugin extends JavaPlugin {
    private FileConfiguration itemsConfig;
    private FileConfiguration eventsConfig;
    private FileConfiguration lifestealConfig;
    private FileConfiguration messagesConfig;
    private FileConfiguration anticheatConfig;
    private LocationStore locationStore;
    private ItemManager itemManager;
    private LifeStealManager lifeStealManager;
    private EventManager eventManager;
    private AntiCheatManager antiCheatManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadConfigurations();
        locationStore = new LocationStore(this);
        lifeStealManager = new LifeStealManager(this);
        itemManager = new ItemManager(this);
        eventManager = new EventManager(this);
        antiCheatManager = new AntiCheatManager(this);
        getServer().getPluginManager().registerEvents(itemManager, this);
        getServer().getPluginManager().registerEvents(new MechanicsListener(this), this);
        getServer().getPluginManager().registerEvents(eventManager, this);
        getServer().getPluginManager().registerEvents(antiCheatManager, this);
        AeCommand command = new AeCommand(this);
        getCommand("ae").setExecutor(command);
        getCommand("ae").setTabCompleter(command);
        Bukkit.getOnlinePlayers().forEach(lifeStealManager::synchronizeHealth);
        long savePeriod = Math.max(20L, getConfig().getLong("settings.save-player-data-on-interval-seconds", 300) * 20L);
        Bukkit.getScheduler().runTaskTimer(this, lifeStealManager::save, savePeriod, savePeriod);
        eventManager.startScheduler();
        getLogger().info("AnarchyEvents+ uruchomiony.");
    }

    @Override
    public void onDisable() {
        if (eventManager != null) eventManager.shutdown();
        if (itemManager != null) itemManager.shutdown();
        if (lifeStealManager != null) lifeStealManager.save();
    }

    public void loadConfigurations() {
        itemsConfig = loadYaml("items.yml");
        eventsConfig = loadYaml("events.yml");
        lifestealConfig = loadYaml("lifesteal.yml");
        messagesConfig = loadYaml("messages.yml");
        anticheatConfig = loadYaml("anticheat.yml");
        validateConfiguration();
    }

    private FileConfiguration loadYaml(String name) {
        File file = new File(getDataFolder(), name);
        if (!file.exists()) saveResource(name, false);
        return YamlConfiguration.loadConfiguration(file);
    }

    private void validateConfiguration() {
        if (lifestealConfig.getInt("hearts.minimum", 1) < 1
                || lifestealConfig.getInt("hearts.maximum", 20) < lifestealConfig.getInt("hearts.minimum", 1)) {
            getLogger().severe("Nieprawidłowy zakres hearts.minimum/maximum w lifesteal.yml. Użyj minimum=1 i maximum=20.");
            lifestealConfig.set("hearts.minimum", 1);
            lifestealConfig.set("hearts.maximum", 20);
        }
        if (itemsConfig.getConfigurationSection("items") == null) {
            getLogger().severe("Brak sekcji items w items.yml; system przedmiotów będzie niedostępny.");
        }
        if (eventsConfig.getConfigurationSection("events") == null) {
            getLogger().severe("Brak sekcji events w events.yml; system wydarzeń będzie niedostępny.");
        }
    }

    public String message(String key) {
        String prefix = messagesConfig.getString("prefix", "");
        String value = messagesConfig.getString("messages." + key, key);
        return color(prefix + value);
    }

    public List<String> messages(String key) {
        return messagesConfig.getStringList("messages." + key).stream().map(AnarchyEventsPlugin::color).toList();
    }

    public static String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }

    public void send(org.bukkit.command.CommandSender sender, String key) {
        sender.sendMessage(message(key));
    }

    public void send(org.bukkit.command.CommandSender sender, String key, String token, String replacement) {
        sender.sendMessage(message(key).replace("%" + token + "%", replacement));
    }

    public FileConfiguration items() { return itemsConfig; }
    public FileConfiguration events() { return eventsConfig; }
    public FileConfiguration lifesteal() { return lifestealConfig; }
    public FileConfiguration anticheat() { return anticheatConfig; }
    public LocationStore locations() { return locationStore; }
    public ItemManager itemsManager() { return itemManager; }
    public LifeStealManager lifeSteal() { return lifeStealManager; }
    public EventManager eventsManager() { return eventManager; }

    public boolean saveEventsConfiguration() {
        try {
            eventsConfig.save(new File(getDataFolder(), "events.yml"));
            return true;
        } catch (IOException exception) {
            getLogger().severe("Nie można zapisać events.yml: " + exception.getMessage());
            return false;
        }
    }

    public void reloadPlugin() {
        reloadConfig();
        loadConfigurations();
        itemManager.reloadValidation();
        eventManager.reloadSchedules();
    }
}