HadesScyther

The /dotkich command opens a dynamic chest menu showing raid categories such as Normal, Super, and Event. Category and boss icons, names, and lore are configured in-game. The menu automatically paginates when there are too many categories or bosses. Each boss entry displays live status such as 'Đang trống', 'Đang có người đánh', and the entry requirement.

/dotkich Clicking an empty boss in the menu starts the join flow. The plugin validates the boss is not in combat, the player is not already in a raid, the raid has not reached its fixed player cap, and the entry requirement is satisfied. If the entry item is configured to be consumed, the exact required quantity is removed before the player is teleported to the lobby. The maximum number of players allowed in one raid is fixed per boss and configurable in the admin GUI.

After players are in the lobby, any lobby player can run /dotkich start. A 15-second countdown begins. During the countdown, teleport commands that would move a player out of the lobby are blocked. When the countdown reaches zero, all online players in the lobby are teleported to the arena player spawn and the MythicMobs boss is spawned at the configured boss spawn.

/dotkich start When the countdown ends, the raid enters combat. The plugin starts a per-raid timer using the boss's configured time limit and initializes the team lives total. Player deaths inside the arena consume one team life and, while lives remain, the player respawns in the arena with inventory preserved. If the time limit expires or team lives reach zero, the raid fails: the boss is removed, all players are teleported to spawn, and the room is reset. If the boss dies, the raid succeeds and reward processing begins.

During combat, the plugin records the damage each player deals to the raid boss. When the boss dies, damage is sorted to determine top 1, top 2, and top 3. Top-ranked players receive larger configured reward packages; every other player who dealt damage receives a smaller participation package. Rewards can include console commands, fixed items, and chance-based items. Players also receive raid points based on their rank, persisted in YAML and exposed through PlaceholderAPI.

The /dotkich admin command opens a single administrative GUI for managing categories, bosses, coordinates, protection boxes, entry requirements, rewards, console command rewards, time limits, lives, pending transactions, and reconciliation. All configuration can be performed in-game without manually editing config.yml. Per-raid settings are stored in YAML data files and written immediately when changed.

/dotkich admin The lobby and arena boxes are protected from block breaking, block placing, item dropping, water/lava flow, and TNT/Creeper explosion damage. Each region is defined by two corners configured through the admin GUI. Only actions that occur inside these exact boxes are affected; world behavior outside the boxes is unchanged.

Players who disconnect while in a raid lobby or arena are removed from the raid. If the last player leaves an unfinished raid, the room is reset, timers are cancelled, and the MythicMobs boss is removed. On plugin disable, all active raids are cleaned up. On server restart, no active raid is restored. Orphaned raid bosses are removed lazily when their chunk loads.

All plugin data is stored in YAML files. Categories and bosses, player raid points, and pending transactions are durable. Writes are atomic, serialized through one writer, and protected by a monotonic revision. A genuine first install initializes empty data files, while later missing or corrupt data is never reset silently and instead disables the affected feature with an actionable error.

The plugin integrates tightly with MythicMobs for boss spawning, boss removal, boss death detection, and damage attribution. Each boss entry stores a MythicMobs Internal Name. At fight start, that exact internal name is spawned at the configured arena boss spawn. During combat, damage to the spawned boss entity is credited to players. On failure, victory, or cleanup, the MythicMobs boss is removed.

The plugin provides /dotkich help to show the available commands and /dotkich reload to reload configuration and data safely. Reload is transactional: it refuses to run while raids are active, validates the entire new state before swapping it, and keeps the old state when validation or saving fails.

/dotkich help /dotkich reload

📎 1 file 3,723 chars
📄
pasted-code-1788705652693.txt
txt 63 lines
▶
1. HỆ THỐNG MENU NGƯỜI CHƠI (/dotkich)

Giao diện động (Dynamic GUI): Lệnh /dotkich mở Menu chính chứa các Danh mục Đột kích (Ví dụ: Thường, Siêu cấp, Sự kiện...). Hỗ trợ tự động phân trang (Pagination) nếu có quá nhiều danh mục hoặc quá nhiều Boss.

Tùy biến hiển thị: Icon, Tên, và Lore của từng danh mục/boss phải hiển thị linh hoạt (Ví dụ: Hiển thị trạng thái "Đang trống" hoặc "Đang có người đánh", "Yêu cầu: 1 Vé Tân thủ").

Tham gia Đột kích:

Khi ấn vào 1 Boss đang trống -> Người chơi bị trừ Vé/Item (nếu có yêu cầu) -> Dịch chuyển vào khu vực Lobby (Phòng chờ).

Khi phòng Lobby đã có người tạo -> Người chơi khác ấn vào cũng sẽ bị kiểm tra & trừ Vé -> Dịch chuyển vào chung Lobby.

Nếu Boss đang trong trạng thái "Đang chiến đấu" -> Báo lỗi chặn lại "Khu vực này đang có người đánh, vui lòng chờ!".

2. LUỒNG CHIẾN ĐẤU (RAID FLOW)

Lobby & Countdown: Khi ở Lobby, người chơi gõ /dotkich start -> Bắt đầu đếm ngược 15 giây. Trong thời gian đếm ngược, block mọi lệnh teleport ra ngoài.

Arena (Khu vực đánh Boss): Hết 15s -> Dịch chuyển toàn bộ người chơi trong Lobby vào Arena -> Tự động spawn Boss của MythicMobs tại vị trí đã thiết lập.

Cơ chế Thắng/Thua:

Thất bại: Hệ thống có bộ đếm Thời gian (Time Limit) và Số mạng (Lives - tổng số lần chết cho phép của cả đội). Nếu hết giờ hoặc hết Số mạng -> Đột kích thất bại -> Xóa Boss -> Teleport tất cả về Spawn.

Bảo toàn khi chết: Nếu chưa hết Số mạng, người chơi chết sẽ respawn lại ngay trong Arena để đánh tiếp, bị trừ 1 mạng của đội.

Chiến thắng: Đánh chết Boss -> Kết thúc Đột kích -> Chia thưởng -> Xóa phòng -> Dịch chuyển về Spawn.

3. CƠ CHẾ PHẦN THƯỞNG & LEO TOP (DAMAGE LEADERBOARD)

Theo dõi sát thương: Plugin phải lưu lại lượng sát thương (Damage) của từng người chơi gây ra lên Boss.

Phân chia phần thưởng: Khi Boss chết, tính toán TOP Sát thương. Phân phát quà (Lệnh console, Item cố định, Item theo tỷ lệ xác suất/chances) dựa trên xếp hạng TOP 1, TOP 2, TOP 3...

Điểm Đột kích: Cộng điểm cho người chơi dựa trên thứ hạng (có thể dùng PlaceholderAPI để xuất data điểm ra bảng xếp hạng Leaderboard của server).

4. HỆ THỐNG QUẢN TRỊ ADMIN (IN-GAME ADMIN GUI TẤT CẢ TRONG MỘT)

Yêu cầu bắt buộc: Mọi thiết lập phải thao tác được qua GUI In-game (Ví dụ: lệnh /dotkich admin), hạn chế tối đa việc phải mò file Config.yml.

Các tính năng trong Admin GUI:

Quản lý Danh mục: Tạo/Xóa danh mục, chỉnh sửa Tên, Icon, Lore hiển thị, Slot vị trí trong menu.

Quản lý Boss: Thêm Boss vào danh mục. Liên kết chính xác với Internal Name của MythicMobs.

Thiết lập Tọa độ: Nút bấm tự động lấy tọa độ hiện tại của Admin để set vị trí Lobby, vị trí Arena_Player_Spawn (nơi người chơi xuất hiện), và Arena_Boss_Spawn (nơi Boss xuất hiện).

Thiết lập Yêu cầu: Cầm 1 Item trên tay và bấm vào GUI để set làm Vé/Điều kiện vào cửa. Kèm theo option "Có thu hồi/xóa vé khi vào hay không".

Thiết lập Quà (Rewards): Bỏ item vào GUI để làm quà cố định hoặc quà xác suất. Có menu nhập lệnh Console trả thưởng.

Thiết lập Chỉ số: Nút chỉnh Thời gian tối đa (Time Limit) và Số mạng tối đa (Lives) cho từng con Boss.

5. BẢO MẬT & BẢO VỆ (ANTI-GRIEF & OPTIMIZATION)

Anti-Grief: Trong khu vực Lobby và Arena, cấm tuyệt đối: Đập/Đặt block, Vứt đồ (Drop item), Dòng chảy Nước/Lava, Nổ TNT/Creeper làm hỏng map.

Xử lý ngắt kết nối: Nếu người chơi Disconnect/Thoát game khi đang ở Lobby/Arena -> Xử lý loại khỏi phòng, nếu là người cuối cùng thì reset phòng.

Dọn dẹp (Cleanup): Chắc chắn rằng Boss bị xóa (Remove entity) nếu phòng thất bại hoặc lỗi, không để lại rác (Entity leak).

Hãy phân tích kỹ các yêu cầu trên và cung cấp cấu trúc code (Structure), các class chính, và chi tiết cách bạn xử lý Data (YML hay SQLite), cách bắt Event, và cách tích hợp với MythicMobs API.
Kodari AI
KodariSep 6 at 2:47 pm 23
DotKichRaid
A comprehensive Minecraft raid system plugin with dynamic GUI menus, MythicMobs integration, and full in-game administration. Players browse categorized raid bosses through paginated chest menus, join available raids by consuming entry items, and teleport to protected lobbies. A 15-second countdown precedes arena combat where team lives and time limits determine success. Damage is tracked per player to calculate top 1-3 rankings for tiered rewards including console commands, fixed items, and chance-based drops. Raid points persist in YAML and expose through PlaceholderAPI. The admin GUI manages categories, bosses, coordinates, protection boxes, entry requirements, rewards, and settings entirely in-game. Lobby and arena regions are grief-protected against block edits, drops, liquid flow, and explosions. Disconnects clean up raids, and atomic YAML storage with revision tracking ensures data durability.
  1. Establish the Gradle/Paper plugin foundation and durable YAML data layer.

  2. Implement raid state, MythicMobs spawning, combat, rewards, cleanup, and protection listeners.

  3. Add paginated player/admin inventory GUIs, chat-backed in-game editors, commands, and PlaceholderAPI points.

Implemented the DotKich raid plugin foundation:

  • /dotkich, /dotkich start, /dotkich admin, /dotkich help, and /dotkich reload.

  • Dynamic paginated category/boss menus with live lobby/combat status and entry requirements.

  • MythicMobs boss spawning, damage tracking, combat timer, shared lives, success/failure cleanup, rewards, and raid points.

  • YAML-backed categories, bosses, player points, and pending-ticket reconciliation with serialized atomic writes.

  • Inventory-preserving arena respawns, disconnect cleanup, lobby countdown teleport blocking, and exact-box anti-grief protection.

  • In-game admin GUI plus chat inputs for creating/configuring bosses, coordinates, entry items, limits, and reward packages.

  • PlaceholderAPI placeholder: %dotkich_points%.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
18 1,341
src/main/java/com/kodari/dotkich/DotKichPlugin.java
package com.kodari.dotkich;

import com.kodari.dotkich.command.DotKichCommand;
import com.kodari.dotkich.gui.RaidGuiListener;
import com.kodari.dotkich.gui.RaidGuiManager;
import com.kodari.dotkich.input.ChatInput;
import com.kodari.dotkich.listener.ProtectionListener;
import com.kodari.dotkich.listener.RaidListener;
import com.kodari.dotkich.model.RaidModels.LocationData;
import com.kodari.dotkich.model.RaidModels.RaidBoss;
import com.kodari.dotkich.model.RaidModels.RegionData;
import com.kodari.dotkich.placeholder.RaidPointsExpansion;
import com.kodari.dotkich.raid.MythicBossService;
import com.kodari.dotkich.raid.RaidManager;
import com.kodari.dotkich.storage.RaidDataStore;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

@Getter
public class DotKichPlugin extends JavaPlugin {
    private RaidDataStore dataStore;
    private RaidManager raidManager;
    private RaidGuiManager guiManager;
    private ChatInput chatInput;

    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().getPlugin("MythicMobs") == null) {
            getLogger().severe("MythicMobs là bắt buộc. DotKich đã bị tắt.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        dataStore = new RaidDataStore(new File(getDataFolder(), "data"));
        if (!dataStore.load()) {
            getLogger().severe("Không thể khởi tạo dữ liệu DotKich. Plugin đã bị tắt để bảo toàn dữ liệu.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        raidManager = new RaidManager(this, dataStore, new MythicBossService());
        guiManager = new RaidGuiManager(this, dataStore, raidManager);
        chatInput = new ChatInput(this);
        PluginManager manager = Bukkit.getPluginManager();
        manager.registerEvents(new RaidGuiListener(guiManager), this);
        manager.registerEvents(chatInput, this);
        manager.registerEvents(new RaidListener(raidManager), this);
        manager.registerEvents(new ProtectionListener(raidManager), this);
        DotKichCommand command = new DotKichCommand(this);
        getCommand("dotkich").setExecutor(command);
        getCommand("dotkich").setTabCompleter(command);
        if (manager.getPlugin("PlaceholderAPI") != null) new RaidPointsExpansion(this).register();
        dataStore.reconcileOnline();
        getLogger().info("DotKich đã bật với " + dataStore.getBosses().size() + " boss.");
    }

    @Override
    public void onDisable() {
        if (raidManager != null) raidManager.cleanupAll();
        if (dataStore != null) dataStore.close();
    }

    public boolean reloadData() {
        RaidDataStore candidate = new RaidDataStore(new File(getDataFolder(), "data"));
        if (!candidate.load()) return false;
        RaidDataStore old = dataStore;
        dataStore = candidate;
        old.close();
        raidManager = new RaidManager(this, dataStore, new MythicBossService());
        guiManager = new RaidGuiManager(this, dataStore, raidManager);
        return true;
    }

    public LocationData locationData(org.bukkit.Location location) {
        LocationData data = new LocationData();
        data.setWorld(location.getWorld().getName()); data.setX(location.getX()); data.setY(location.getY()); data.setZ(location.getZ()); data.setYaw(location.getYaw()); data.setPitch(location.getPitch());
        return data;
    }

    public void setProtectionCorner(org.bukkit.entity.Player player, RaidBoss boss, boolean first) {
        RegionData region = boss.getArenaRegion();
        if (region == null) region = new RegionData();
        if (first) region.setFirst(locationData(player.getLocation()));
        else region.setSecond(locationData(player.getLocation()));
        boss.setArenaRegion(region);
        player.sendMessage("§aĐã đặt góc " + (first ? "1" : "2") + " cho khu bảo vệ Arena.");
    }
}