S
๐Ÿ“Ž 1 file 3,800 chars
๐Ÿ“„
pasted-code-1774580716218.txt
txt 247 lines
โ–ถ
=====================================
CLOUD PRACTISE โ€” UPGRADE
=====================================

PLUGIN INFO:

* Name: CloudPractise
* Creator: arsec4real
* Minecraft version: 1.21.4 to 1.21.11

Upgrade:
โœ” Match system
โœ” Arena system
โœ” Queue system
โœ” Duel system (kit-based)
โœ” Party system
โœ” Kit editor (editable presets)
โœ” Help system + help.txt
โœ” Console branding
โœ” help.txt (on plugin folder that consists of placeholders, commands and luckperms)

=====================================

1. PARTY SYSTEM (IMPORTANT)
=====================================

Create PartyManager

Party structure:

* leader (UUID)
* members (List)
* max size (configurable)

---

COMMANDS:

/cp party create
โ†’ Creates a new party

/cp party invite 
โ†’ Invite player

/cp party accept 

/cp party leave

/cp party disband

/cp party kick 

/cp party list

---

RULES:

โœ” Only leader can invite/kick/disband
โœ” Members can leave
โœ” Max party size (e.g. 10)
โœ” Prevent duplicate parties
โœ” Auto disband if leader leaves

---

2. PARTY DUEL SYSTEM

---

Add:

/cp party duel  

Example:
/cp party duel Steve nodebuff

---

## BEHAVIOR:

โœ” Sends duel request to entire party
โœ” Both parties must have same size
โœ” On accept:

* Create team match
* Teleport all players
* Apply kit to all players

---

3. KIT EDITOR SYSTEM (VERY IMPORTANT)
   =====================================

Create INVENTORY GUI-based kit editor logic (or command-based fallback)

---

COMMANDS:

/cp kit edit 
โ†’ Opens kit editor

/cp kit save 
โ†’ Saves edited kit

---

EDITOR FEATURES:

โœ” Player inventory becomes editable
โœ” Players modify items directly
โœ” Save updates kit contents

โœ” Support:

* Inventory slots
* Armor slots
* Hotbar positions

---

RULES:

โœ” Only existing kits can be edited
โœ” Cancel restores old inventory
โœ” Save overwrites kit

---

4. KIT STORAGE UPDATE
=====================================

kits.yml must support:

kits:
nodebuff:
inventory:
armor:
editable: true

---

5. PARTY + MATCH INTEGRATION

---

Match must support:

* Solo matches
* Party matches (teams)

Match structure:

* Team A (List)
* Team B (List)

---

6. HELP SYSTEM UPDATE
   =====================================

&6&lCloudPractise Commands:
&7------------------------
&e/cp help
&e/cp queue
&e/cp leave
&e/cp duel  
&e/cp accept 
&e/cp deny 

&e/cp party create
&e/cp party invite 
&e/cp party accept 
&e/cp party leave
&e/cp party disband
&e/cp party list

&e/cp party duel  

&e/cp kit create 
&e/cp kit edit 
&e/cp kit save 
&e/cp kit delete 
&e/cp kit list

&e/cp arena ...

&7------------------------

---

7. HELP.TXT UPDATE

---

Include:

PARTY COMMANDS:

* /cp party create
* /cp party invite 
* /cp party accept 
* /cp party leave
* /cp party disband
* /cp party duel  

KIT EDITOR:

* /cp kit edit 
* /cp kit save 

---

8. TAB COMPLETION UPDATE

---

/cp party โ†’ create, invite, accept, leave, disband, kick, list, duel

/cp kit โ†’ create, edit, save, delete, list

/cp party duel  โ†’ party leaders
/cp party duel   โ†’ kit names

---

9. VALIDATION RULES

---

โœ” Party must exist
โœ” Only leader can start party duel
โœ” Party sizes must match
โœ” Kit must exist
โœ” Prevent party duel if in match

---

10. FINAL RESULT
    =====================================

โœ” Full party system
โœ” Team vs team fights
โœ” Editable kits
โœ” Professional PvP experience
โœ” Comparable to MMC / Lunar Practice
Kodari AI
KodariMar 27 at 3:20 am 289,158 (v2)

Let me read all existing files before making any changes.

Let me read the remaining referenced files before writing.

Now I have full visibility. Let me plan and execute:

  • Create all missing models, utils, managers, GUIs, and resources (~25 new files)

  • Upgrade Party system: add accept, list, duel <leader> <kit> with party duel request flow, tab completion

  • Upgrade Kit Editor: proper GUI with Save/Cancel buttons, admin kit editing vs player custom kit, armor/offhand slots

  • Update commands/listeners/main class for tab completion, help system, party duel integration, and help.txt resource

Now I need to fix the ScoreboardManager class โ€” it has an illegal class name declaration. Let me patch that:

Now fix the KitEditorGUI โ€” the isAdminEdit helper method is incomplete. The save logic needs a cleaner flag. Let me patch it:

Now let me also remove the unused ScoreboardManager import conflict and fix the duplicate ScoreboardManager import in CloudPractise:

Found it โ€” the Bukkit ScoreboardManager import conflicts with our class name. I need to use the fully-qualified Bukkit reference instead.

Good โ€” KitEditorGUI is already well-formed. Now let me write all the missing files at once:

All good. Now let me read the current state of the updated commands, listeners, and resources to write them all correctly:

Good โ€” all the core files are properly written. Now let me check and write the resource files:

All resource files are complete. Now I need to fix the one compilation issue โ€” ScoreboardManager has a naming conflict with the Bukkit API class it imports:

Now let me also add tab completion to the remaining commands that are missing it:

Now let me verify the DuelCommand in the CloudPractise.java is registering the tab completers for accept and deny as well, and also check that KitManager.loadKits() is public so it can be called on reload:

Good โ€” KitManager is complete. Now let me write the corrected ScoreboardManager (removing the import conflict), the tab-completed commands, and all remaining updates:

Now let me also fix the KitManager.loadKits() โ€” it needs to clear the kits map before reloading (otherwise on /cp reload it would double-load):

Similarly, ArenaManager.loadArenas() needs the same fix:

Now let me also add the editable flag to kits.yml save/load in KitManager:

Everything is now complete. Hereโ€™s a summary of all changes delivered:


What was built / upgraded:

New model files โ€” Party, Match, Kit, Arena, PlayerData, QueueEntry, DuelRequest, PartyDuelRequest, GameEvent, all enums (MatchState, MatchType, QueueType, EventType)

New utility files โ€” ColorUtil, LocationSerializer, ItemSerializer, ItemBuilder

New managers โ€” StatsManager (YAML per-player storage in players/), SpectatorManager, ScoreboardManager (sidebar with live match/lobby/queue info, fixed Bukkit API naming conflict)

Party system upgrade โ€” PartyManager now has sendPartyDuelRequest, acceptPartyDuelRequest, denyPartyDuelRequest; PartyCommand gained accept, list, and full duel <leader> <kit> / duel accept / duel deny flow with party size validation

Kit editor upgrade โ€” KitEditorGUI now opens a 54-slot GUI with slots 0โ€“40 freely editable (main + armor + offhand), a red Cancel button (slot 45) that restores original inventory, and a green Save button (slot 53); admin edits (/kit edit) save to the Kit itself; player edits (shift-click in kit selector) save to PlayerData

Tab completion โ€” PartyCommand, KitCommand, DuelCommand, QueueCommand, ArenaCommand, CloudPractiseCommand all implement TabCompleter

Help system โ€” /cp help shows the full formatted help screen in-game; help.txt in the plugin folder contains all commands, PlaceholderAPI placeholders, and LuckPerms permission nodes

Resources โ€” plugin.yml with all commands/aliases/permissions, config.yml with all message keys and settings, help.txt saved to data folder on startup

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
53 5,081
src/main/java/com/arsec4real/cloudpractise/CloudPractise.java
package com.arsec4real.cloudpractise;

import com.arsec4real.cloudpractise.commands.ArenaCommand;
import com.arsec4real.cloudpractise.commands.CloudPractiseCommand;
import com.arsec4real.cloudpractise.commands.DuelCommand;
import com.arsec4real.cloudpractise.commands.EventCommand;
import com.arsec4real.cloudpractise.commands.KitCommand;
import com.arsec4real.cloudpractise.commands.LeaderboardCommand;
import com.arsec4real.cloudpractise.commands.PartyCommand;
import com.arsec4real.cloudpractise.commands.QueueCommand;
import com.arsec4real.cloudpractise.commands.SpectateCommand;
import com.arsec4real.cloudpractise.commands.StatsCommand;
import com.arsec4real.cloudpractise.gui.ArenaEditorGUI;
import com.arsec4real.cloudpractise.gui.EventGUI;
import com.arsec4real.cloudpractise.gui.KitEditorGUI;
import com.arsec4real.cloudpractise.gui.KitSelectorGUI;
import com.arsec4real.cloudpractise.gui.LeaderboardGUI;
import com.arsec4real.cloudpractise.gui.PartyGUI;
import com.arsec4real.cloudpractise.gui.QueueSelectorGUI;
import com.arsec4real.cloudpractise.gui.SpectatorGUI;
import com.arsec4real.cloudpractise.gui.StatsGUI;
import com.arsec4real.cloudpractise.listeners.CombatListener;
import com.arsec4real.cloudpractise.listeners.InventoryListener;
import com.arsec4real.cloudpractise.listeners.PlayerListener;
import com.arsec4real.cloudpractise.managers.ArenaManager;
import com.arsec4real.cloudpractise.managers.EventManager;
import com.arsec4real.cloudpractise.managers.KitManager;
import com.arsec4real.cloudpractise.managers.MatchManager;
import com.arsec4real.cloudpractise.managers.PartyManager;
import com.arsec4real.cloudpractise.managers.QueueManager;
import com.arsec4real.cloudpractise.managers.ScoreboardManager;
import com.arsec4real.cloudpractise.managers.SpectatorManager;
import com.arsec4real.cloudpractise.managers.StatsManager;
import com.arsec4real.cloudpractise.utils.ColorUtil;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CloudPractise extends JavaPlugin {

    private ArenaManager arenaManager;
    private KitManager kitManager;
    private MatchManager matchManager;
    private QueueManager queueManager;
    private PartyManager partyManager;
    private StatsManager statsManager;
    private EventManager eventManager;
    private SpectatorManager spectatorManager;
    private ScoreboardManager scoreboardManager;

    private KitSelectorGUI kitSelectorGUI;
    private QueueSelectorGUI queueSelectorGUI;
    private KitEditorGUI kitEditorGUI;
    private SpectatorGUI spectatorGUI;
    private StatsGUI statsGUI;
    private LeaderboardGUI leaderboardGUI;
    private PartyGUI partyGUI;
    private EventGUI eventGUI;
    private ArenaEditorGUI arenaEditorGUI;

    private Location spawn;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("help.txt", false);
        getDataFolder().mkdirs();
        loadSpawn();
        initManagers();
        initGUIs();
        registerCommands();
        registerListeners();
        printStartupBanner();
    }

    @Override
    public void onDisable() {
        if (statsManager != null) statsManager.saveAll();
        if (kitManager != null) kitManager.saveKits();
        if (arenaManager != null) arenaManager.saveArenas();
        if (queueManager != null) queueManager.shutdown();
        if (scoreboardManager != null) scoreboardManager.shutdown();
        getLogger().info("CloudPractise has been disabled.");
    }

    private void initManagers() {
        statsManager = new StatsManager(this);
        arenaManager = new ArenaManager(this);
        kitManager = new KitManager(this);
        spectatorManager = new SpectatorManager(this);
        matchManager = new MatchManager(this);
        queueManager = new QueueManager(this);
        partyManager = new PartyManager(this);
        eventManager = new EventManager(this);
        scoreboardManager = new ScoreboardManager(this);
    }

    private void initGUIs() {
        kitSelectorGUI = new KitSelectorGUI(this);
        queueSelectorGUI = new QueueSelectorGUI(this);
        kitEditorGUI = new KitEditorGUI(this);
        spectatorGUI = new SpectatorGUI(this);
        statsGUI = new StatsGUI(this);
        leaderboardGUI = new LeaderboardGUI(this);
        partyGUI = new PartyGUI(this);
        eventGUI = new EventGUI(this);
        arenaEditorGUI = new ArenaEditorGUI(this);
    }

    private void registerCommands() {
        DuelCommand duelCmd = new DuelCommand(this);
        getCommand("duel").setExecutor(duelCmd);
        getCommand("duel").setTabCompleter(duelCmd);
        getCommand("accept").setExecutor(duelCmd);
        getCommand("deny").setExecutor(duelCmd);

        ArenaCommand arenaCmd = new ArenaCommand(this);
        getCommand("arena").setExecutor(arenaCmd);
        getCommand("arena").setTabCompleter(arenaCmd);

        KitCommand kitCmd = new KitCommand(this);
        getCommand("kit").setExecutor(kitCmd);
        getCommand("kit").setTabCompleter(kitCmd);
        getCommand("editkit").setExecutor(kitCmd);
        getCommand("editkit").setTabCompleter(kitCmd);

        QueueCommand queueCmd = new QueueCommand(this);
        getCommand("queue").setExecutor(queueCmd);
        getCommand("queue").setTabCompleter(queueCmd);
        getCommand("leave").setExecutor(queueCmd);

        PartyCommand partyCmd = new PartyCommand(this);
        getCommand("party").setExecutor(partyCmd);
        getCommand("party").setTabCompleter(partyCmd);

        getCommand("stats").setExecutor(new StatsCommand(this));
        getCommand("leaderboard").setExecutor(new LeaderboardCommand(this));
        getCommand("event").setExecutor(new EventCommand(this));
        getCommand("spectate").setExecutor(new SpectateCommand(this));

        CloudPractiseCommand cpCmd = new CloudPractiseCommand(this);
        getCommand("cloudpractise").setExecutor(cpCmd);
        getCommand("cloudpractise").setTabCompleter(cpCmd);
        getCommand("setspawn").setExecutor(cpCmd);
    }

    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
        getServer().getPluginManager().registerEvents(new CombatListener(this), this);
        getServer().getPluginManager().registerEvents(new InventoryListener(this), this);
    }

    private void loadSpawn() {
        String world = getConfig().getString("spawn.world", "world");
        double x = getConfig().getDouble("spawn.x", 0.0);
        double y = getConfig().getDouble("spawn.y", 64.0);
        double z = getConfig().getDouble("spawn.z", 0.0);
        float yaw = (float) getConfig().getDouble("spawn.yaw", 0.0);
        float pitch = (float) getConfig().getDouble("spawn.pitch", 0.0);
        org.bukkit.World w = getServer().getWorld(world);
        if (w != null) spawn = new Location(w, x, y, z, yaw, pitch);
    }

    public void setSpawn(Location location) {
        this.spawn = location;
        getConfig().set("spawn.world", location.getWorld().getName());
        getConfig().set("spawn.x", location.getX());
        getConfig().set("spawn.y", location.getY());
        getConfig().set("spawn.z", location.getZ());
        getConfig().set("spawn.yaw", location.getYaw());
        getConfig().set("spawn.pitch", location.getPitch());
        saveConfig();
    }

    private void printStartupBanner() {
        String[] lines = {
                "&b&l  ___ _             _  ___ ",
                "&b&l / __| |___ _  _ __| ||   \\",
                "&3&l| (__| / _ \\| || / _` || |) |",
                "&3&l \\___|_\\___/\\_,_\\__,_||___/ ",
                "&7       &bPractise Plugin",
                "",
                "&b Author: &3arsec4real",
                "&b Version: &3" + getDescription().getVersion(),
                "&7 Arenas: &e" + arenaManager.getArenaCount() + "  &7Kits: &e" + kitManager.getKitCount(),
                "&a Plugin enabled successfully!"
        };
        for (String line : lines) {
            getLogger().info(ColorUtil.strip(line).replace("  ", " "));
        }
        getServer().getConsoleSender().sendMessage("");
        for (String line : lines) {
            getServer().getConsoleSender().sendMessage(ColorUtil.color(line));
        }
        getServer().getConsoleSender().sendMessage("");
    }
}