ahirsmit2468
๐Ÿ“Ž 1 file 10,843 chars
๐Ÿ“„
pasted-code-1786984899928.txt
txt 666 lines
โ–ถ
AlphaXCS โ€” Minecraft CS 4v4 Plugin Development Specification

Create a production-ready Minecraft Paper plugin named AlphaXCS for a custom 4v4 round-based tactical shooter/minigame.

The plugin must be modular, configurable, and designed so additional maps, weapons, modes, ranks, and features can be added later.

1. Platform

Target:

- Minecraft: 1.21.x
- Server: Paper
- Language: Java
- Build system: Gradle or Maven
- Plugin name: "AlphaXCS"
- Main class: "com.alphagamezone.alphaxcs.AlphaXCS"

Use clean object-oriented architecture.

Do NOT put the entire plugin in one Java class.

2. External plugins

The plugin should integrate with:

- Citizens โ€” lobby CS NPC
- QualityArmory โ€” weapons
- PlaceholderAPI โ€” placeholders
- WorldGuard โ€” protected areas
- LuckPerms โ€” permissions

Make integrations optional where possible. If an optional dependency is missing, AlphaXCS should not crash.

3. Main gameplay

AlphaXCS is a 4v4 round-based game.

Maximum players per match: 8

Teams:

- ALPHA โ€” 4 players
- OMEGA โ€” 4 players

Match flow:

LOBBY
โ†’ NPC
โ†’ QUEUE
โ†’ 8 PLAYERS
โ†’ TEAM ASSIGNMENT
โ†’ TELEPORT
โ†’ 30 SECOND BUY PHASE
โ†’ ROUND
โ†’ TEAM WINS
โ†’ REWARD MONEY
โ†’ RESET
โ†’ 30 SECOND BUY PHASE
โ†’ NEXT ROUND
โ†’ FIRST TO 7
โ†’ MATCH END
โ†’ RESULTS
โ†’ LOBBY

4. Lobby NPC

Players should see a Citizens NPC named:

ALPHA X CS 4v4

Right-clicking the NPC should open/join the queue.

Display:

"ALPHA X CS 4v4"
"Players: X/8"
"Click to Join"

If the player is already queued, clicking again should remove them from the queue.

Commands:

"/axcs join"
"/axcs leave"
"/axcs status"

5. Queue system

Create a queue manager.

When 8 players are queued:

1. Stop accepting additional players for that match.
2. Create a Match instance.
3. Assign 4 players to ALPHA.
4. Assign 4 players to OMEGA.
5. Teleport them to the configured map.
6. Start the preparation phase.

Do not create duplicate matches.

Players should not be able to join another queue while already inside a match.

6. Configuration

All important settings must be configurable through:

"plugins/AlphaXCS/config.yml"

Example:

match:
  max-players: 8
  players-per-team: 4
  rounds-to-win: 7
  buy-time: 30
  round-time: 120
  post-round-time: 5

maps:
  alpha:
    world: alpha_cs
    spawn:
      x: 0
      y: 70
      z: 0
      yaw: 0
      pitch: 0
    buy-area:
      min:
        x: -7
        y: 65
        z: -2
      max:
        x: 7
        y: 68
        z: 2

  omega:
    world: alpha_cs
    spawn:
      x: 100
      y: 70
      z: 0
      yaw: 180
      pitch: 0

Do not hard-code map coordinates.

7. Match states

Create an enum:

WAITING
STARTING
BUY_PHASE
ROUND_ACTIVE
ROUND_END
MATCH_END

The match must always have a valid state.

Prevent actions that are invalid for the current state.

8. Team system

Create:

TeamManager
Team

Teams:

ALPHA
OMEGA

Each team should track:

- Players
- Alive players
- Round wins
- Spawn location
- Buy-area location

Players must remain assigned to the same team for the match.

9. Buy phase

Every round begins with:

30 seconds

During buy phase:

- Players are teleported to their team spawn/buy area.
- Players cannot leave their configured buy area.
- Players can open the buy menu.
- Players can purchase configured weapons/items.
- Players can purchase armor/utilities.
- Money is displayed.
- Countdown is displayed.

At:

"3"
"2"
"1"

start the round.

Prevent purchasing after the buy phase ends.

10. Economy

Create an "EconomyManager".

Each player has match money.

Default starting money:

"$800"

Example rewards:

economy:
  starting-money: 800
  kill-reward: 300
  round-win: 2000
  round-loss: 1000
  objective-reward: 500

Make all values configurable.

Money must be stored per match and reset appropriately when the match ends.

11. Weapon integration

Integrate with QualityArmory.

Do NOT hard-code weapon names.

Create configurable weapon entries:

weapons:
  example_weapon:
    display-name: "&aExample Weapon"
    price: 800
    qualityarmory-id: "example_weapon"

The buy system should check the player's money, then give the configured QualityArmory weapon.

If the weapon does not exist, show a clear error in console and prevent the purchase.

12. Buy menu

Create a configurable INVENTORY GUI.

Categories:

Weapons
Armor
Utility
Equipment

Example:

ALPHA X BUY MENU

Money: $3200

[Weapons]
[Armor]
[Utility]
[Equipment]

[Close]

Use configurable item slots and names.

Do not hard-code the entire INVENTORY GUI layout.

13. Round system

When the buy phase ends:

1. Unlock players.
2. Start the round timer.
3. Enable normal movement.
4. Enable combat.
5. Update scoreboard.
6. Start objective/game logic.

Players who die during the round become spectators.

They must NOT respawn until the next round.

14. Round win detection

A team wins the round when all opposing players are eliminated.

Example:

ALPHA ALIVE: 4
OMEGA ALIVE: 0

โ†’ ALPHA wins.

Display:

ROUND WON

ALPHA 1 - 0 OMEGA

Then:

1. Stop the round.
2. Stop combat logic.
3. Reward money.
4. Reset players.
5. Teleport players back to their team areas.
6. Start the next 30-second buy phase.

15. Match victory

Default:

First team to 7 rounds wins.

Example:

ALPHA 7 - 4 OMEGA

End the match.

Show a results screen containing:

- Winning team
- Final score
- Player kills
- Player deaths
- Player assists if implemented
- MVP
- XP earned
- Match duration

Then teleport everyone back to the lobby.

16. Spectator system

Dead players should:

- Become spectators.
- Be unable to interfere with living players.
- Not be able to pick up items.
- Not be able to damage players.
- Not be able to purchase items.
- Be able to spectate teammates.

At the beginning of the next round, restore them to normal survival mode.

17. Player reset

Create a reliable "PlayerResetManager".

At every round:

- Restore health.
- Restore food.
- Clear temporary effects.
- Reset inventory according to the economy/buy system.
- Reset spectator mode.
- Teleport to team spawn.
- Reset temporary match data.

At match end, completely restore the player to the lobby state.

Do not accidentally delete permanent player data.

18. Scoreboard

Create an in-game scoreboard.

Example:

       ALPHA X CS

ALPHA  3  -  2  OMEGA

Round: 6
Time: 01:42

ALPHA: 4 Alive
OMEGA: 2 Alive

Money: $2450

Make the scoreboard configurable.

19. Action bar

During buy phase:

BUY PHASE: 00:18
Money: $2450

During round:

ROUND TIME: 01:34

When a player dies:

You are eliminated.
Spectating...

20. Sounds and effects

Add configurable sounds for:

- Match found
- Countdown
- Round start
- Round win
- Round loss
- Player elimination
- Match victory
- Match defeat
- Buy confirmation
- Insufficient money

All sound settings should be configurable.

21. Commands

Implement:

/axcs join
/axcs leave
/axcs status
/axcs stats
/axcs reload
/axcs forcestart
/axcs stop
/axcs setlobby
/axcs setalphaspawn
/axcs setomegaspawn
/axcs setnpc

Admin commands require:

"alphaxcs.admin"

Player commands require:

"alphaxcs.play"

Add tab completion.

22. Map management

Support multiple CS maps.

Example:

maps:
  alpha_city:
    enabled: true

  alpha_factory:
    enabled: false

A match should select an enabled map.

Design the system so maps can later have:

- Alpha spawn
- Omega spawn
- Buy areas
- Objective locations
- Spectator spawn

Do not hard-code one map into Java.

23. Database

Create a database abstraction.

For V1, SQLite is acceptable.

Store:

- UUID
- Matches played
- Wins
- Losses
- Kills
- Deaths
- MVPs
- XP
- Rank

Do not store player data only in memory.

Use UUID instead of player names as the primary identifier.

24. Error handling

The plugin must gracefully handle:

- Player disconnects
- Server restart
- Missing world
- Missing NPC
- Missing QualityArmory weapon
- Missing configuration
- Invalid coordinates
- Less than 8 players
- Player already in another match
- Duplicate match creation

Never allow an exception to crash the entire server.

Log useful messages to console.

25. Disconnect handling

If a player disconnects during:

Queue

Remove them from queue.

Buy phase

Treat them as disconnected.

Active round

Mark them disconnected and handle the team accordingly.

Match

If the team becomes empty, allow the opposing team to win according to configurable rules.

26. Reload

"/axcs reload" should safely reload configuration without destroying active matches.

Do NOT reload active match state unless absolutely necessary.

27. Code quality

Requirements:

- Clean Java
- JavaDoc for public APIs
- No unnecessary static global state
- Dependency injection where useful
- Interfaces for external integrations
- Separate managers
- No duplicated logic
- No blocking operations on the main server thread
- Async database operations
- Proper Bukkit/Paper scheduler usage
- Thread-safe data handling where required

28. Project structure

Use:

AlphaXCS/
โ”œโ”€โ”€ build.gradle / pom.xml
โ”œโ”€โ”€ src/main/java/
โ”‚   โ””โ”€โ”€ com/alphagamezone/alphaxcs/
โ”‚       โ”œโ”€โ”€ AlphaXCS.java
โ”‚       โ”œโ”€โ”€ command/
โ”‚       โ”œโ”€โ”€ queue/
โ”‚       โ”œโ”€โ”€ match/
โ”‚       โ”œโ”€โ”€ team/
โ”‚       โ”œโ”€โ”€ round/
โ”‚       โ”œโ”€โ”€ buy/
โ”‚       โ”œโ”€โ”€ economy/
โ”‚       โ”œโ”€โ”€ player/
โ”‚       โ”œโ”€โ”€ spectator/
โ”‚       โ”œโ”€โ”€ scoreboard/
โ”‚       โ”œโ”€โ”€ npc/
โ”‚       โ”œโ”€โ”€ map/
โ”‚       โ”œโ”€โ”€ database/
โ”‚       โ”œโ”€โ”€ integration/
โ”‚       โ””โ”€โ”€ util/
โ”‚
โ””โ”€โ”€ src/main/resources/
    โ”œโ”€โ”€ plugin.yml
    โ”œโ”€โ”€ config.yml
    โ”œโ”€โ”€ messages.yml
    โ””โ”€โ”€ menus.yml

29. Development order

Do NOT attempt to implement everything at once.

Build and test in this order:

V0.1

NPC โ†’ queue โ†’ 8 players โ†’ team assignment โ†’ teleport

V0.2

30-second buy phase โ†’ countdown โ†’ round start

V0.3

Economy โ†’ buy menu โ†’ QualityArmory integration

V0.4

Death โ†’ spectator โ†’ round winner

V0.5

Round reset โ†’ next round โ†’ first-to-7

V0.6

Match results โ†’ statistics โ†’ lobby return

V1.0

Multiple maps โ†’ polished UI โ†’ sounds โ†’ database โ†’ ranks โ†’ MVP

After each phase, provide the complete updated source code and explain exactly what changed.

30. Important implementation rule

Do not invent APIs for Paper, Citizens, QualityArmory, PlaceholderAPI or other dependencies.

Check the correct API/version before writing integration code.

If an API is unavailable or uncertain, clearly state the problem and use a safe abstraction rather than producing fake methods.

Final goal

The finished plugin should create this exact gameplay loop:

PLAYER JOINS SERVER
โ†’ SEES ALPHA X CS 4V4 NPC
โ†’ CLICKS NPC
โ†’ QUEUE 1/8 ... 8/8
โ†’ AUTOMATIC 4V4 TEAM ASSIGNMENT
โ†’ TELEPORT TO CS MAP
โ†’ 30 SECOND BUY PHASE
โ†’ BUY WEAPONS/ARMOR/UTILITY
โ†’ ROUND START
โ†’ PLAYERS FIGHT
โ†’ DEAD PLAYERS SPECTATE
โ†’ TEAM WINS ROUND
โ†’ MONEY REWARD
โ†’ PLAYERS RETURN TO BUY AREA
โ†’ 30 SECOND BUY PHASE
โ†’ NEXT ROUND
โ†’ FIRST TO 7 ROUNDS
โ†’ MATCH RESULTS
โ†’ STATS/XP
โ†’ RETURN TO LOBBY

Build AlphaXCS as a real maintainable Paper plugin, not as a single-file demo.
Kodari AI
KodariAug 17 at 4:45 pm 7
AlphaXCS
AlphaXCS is a modular 4v4 round-based tactical shooter Paper plugin featuring queue management, team assignment, configurable buy phases with economy and weapon integration, round-based combat with spectator support, scoreboards, action bars, and sound effects. It includes multi-map support, SQLite database storage for player statistics, Citizens NPC integration, and comprehensive admin commands with tab completion. The plugin gracefully handles disconnects, reloads, and missing dependencies while maintaining clean object-oriented architecture with separate managers for queue, match, team, economy, buy, spectator, scoreboard, map, database, and integrations.
  1. Core foundation: Gradle metadata, plugin resources, configuration, maps, teams, economy, persistence, and integrations.

  2. Gameplay: queue/match/round flow, buy GUI, spectators, resets, scoreboard, NPC, listeners, and commands.

  3. Cross-version/runtime safety: optional integrations, configurable locations/items/messages, async SQLite writes, and graceful missing-dependency handling.

Created the AlphaXCS Paper 1.21 plugin project with:

  • Gradle build setup, plugin metadata, configurable maps, economy, messages, menus, sounds, and scoreboard.

  • Queue system with 8-player validation, automatic 4v4 team assignment, map selection, and duplicate-match prevention.

  • Match lifecycle: buy phase, round timers, combat, elimination, spectators, round wins, first-to-7 match victory, resets, and lobby return.

  • Configurable buy GUI with economy checks, armor/items, QualityArmory reflection integration, and refund handling.

  • Citizens queue NPC integration with dynamic player count and /axcs setnpc.

  • SQLite-backed asynchronous player statistics.

  • Optional PlaceholderAPI and WorldGuard detection without hard dependencies.

  • Commands and tab completion: /axcs join, /leave, /status, /stats, /buy, /reload, /forcestart, /stop, /setlobby, /setalphaspawn, /setomegaspawn, /setnpc.

  • Separate managers for maps, teams, economy, database, players, spectators, scoreboards, queues, matches, NPCs, GUI handling, and integrations.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
45 1,965
src/main/java/com/alphagamezone/alphaxcs/AlphaXCS.java
package com.alphagamezone.alphaxcs;

import com.alphagamezone.alphaxcs.buy.BuyManager;
import com.alphagamezone.alphaxcs.command.AlphaCommand;
import com.alphagamezone.alphaxcs.config.ConfigManager;
import com.alphagamezone.alphaxcs.database.Database;
import com.alphagamezone.alphaxcs.database.SQLiteDatabase;
import com.alphagamezone.alphaxcs.economy.EconomyManager;
import com.alphagamezone.alphaxcs.integration.PlaceholderBridge;
import com.alphagamezone.alphaxcs.integration.QualityArmoryIntegration;
import com.alphagamezone.alphaxcs.integration.ReflectionQualityArmory;
import com.alphagamezone.alphaxcs.integration.WorldGuardBridge;
import com.alphagamezone.alphaxcs.inventory.GUIListener;
import com.alphagamezone.alphaxcs.inventory.GUIManager;
import com.alphagamezone.alphaxcs.listener.GameListener;
import com.alphagamezone.alphaxcs.map.MapManager;
import com.alphagamezone.alphaxcs.match.MatchManager;
import com.alphagamezone.alphaxcs.npc.NpcListener;
import com.alphagamezone.alphaxcs.npc.NpcManager;
import com.alphagamezone.alphaxcs.player.PlayerResetManager;
import com.alphagamezone.alphaxcs.queue.QueueManager;
import com.alphagamezone.alphaxcs.scoreboard.GameScoreboardManager;
import com.alphagamezone.alphaxcs.spectator.SpectatorManager;
import com.alphagamezone.alphaxcs.team.TeamManager;
import org.bukkit.plugin.java.JavaPlugin;

import org.bukkit.command.PluginCommand;

public final class AlphaXCS extends JavaPlugin {
    private ConfigManager configManager;
    private MapManager mapManager;
    private EconomyManager economy;
    private PlayerResetManager resetManager;
    private SpectatorManager spectatorManager;
    private GameScoreboardManager scoreboardManager;
    private Database database;
    private MatchManager matchManager;
    private QueueManager queueManager;
    private BuyManager buyManager;
    private GUIManager guiManager;
    private NpcManager npcManager;
    private QualityArmoryIntegration qualityArmory;
    private PlaceholderBridge placeholderBridge;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        database = new SQLiteDatabase(this);
        database.initialize();
        mapManager = new MapManager(configManager);
        economy = new EconomyManager(configManager);
        resetManager = new PlayerResetManager();
        spectatorManager = new SpectatorManager(this);
        scoreboardManager = new GameScoreboardManager(this);
        TeamManager teamManager = new TeamManager();
        matchManager = new MatchManager(this, teamManager);
        guiManager = new GUIManager();
        qualityArmory = new ReflectionQualityArmory(getLogger());
        placeholderBridge = new PlaceholderBridge();
        new WorldGuardBridge(getLogger());
        npcManager = new NpcManager(this);
        queueManager = new QueueManager(this, matchManager);
        buyManager = new BuyManager(this, matchManager, guiManager, qualityArmory);

        getServer().getPluginManager().registerEvents(new GameListener(this), this);
        getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
        if (npcManager.isAvailable()) getServer().getPluginManager().registerEvents(new NpcListener(npcManager, queueManager), this);

        AlphaCommand command = new AlphaCommand(this);
        PluginCommand axcs = getCommand("axcs");
        if (axcs != null) {
            axcs.setExecutor(command);
            axcs.setTabCompleter(command);
        }
        getLogger().info("AlphaXCS enabled with " + mapManager.enabledMaps().size() + " enabled map(s).");
    }

    @Override
    public void onDisable() {
        if (matchManager != null) matchManager.stopAll();
        if (database != null) database.close();
    }

    public ConfigManager getConfigManager() { return configManager; }
    public MapManager getMapManager() { return mapManager; }
    public EconomyManager getEconomy() { return economy; }
    public PlayerResetManager getResetManager() { return resetManager; }
    public SpectatorManager getSpectatorManager() { return spectatorManager; }
    public GameScoreboardManager getScoreboardManager() { return scoreboardManager; }
    public Database getDatabase() { return database; }
    public MatchManager getMatchManager() { return matchManager; }
    public QueueManager getQueueManager() { return queueManager; }
    public BuyManager getBuyManager() { return buyManager; }
    public GUIManager getGuiManager() { return guiManager; }
    public NpcManager getNpcManager() { return npcManager; }
    public QualityArmoryIntegration getQualityArmory() { return qualityArmory; }
    public PlaceholderBridge getPlaceholderBridge() { return placeholderBridge; }
    public org.bukkit.configuration.file.FileConfiguration getMessages() { return configManager.messages(); }
    public org.bukkit.configuration.file.FileConfiguration getMenus() { return configManager.menus(); }
}