Saida Mama
๐Ÿ“Ž 1 file 4,760 chars
๐Ÿ“„
pasted-code-1788408190462.txt
txt 246 lines
โ–ถ
Create a complete Minecraft PvP Arena plugin for Paper 1.21.11 using Java and Maven.

IMPORTANT:
The plugin MUST automatically generate/build the entire PvP arena in the world.
I do NOT want to manually build the arena.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
AUTOMATIC ARENA GENERATION
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

When the server/plugin starts for the first time, automatically generate a complete PvP arena.

The arena should be a professional-looking circular/large square PvP arena.

Arena design:
- Large fighting area
- Stone/Deepslate floor
- Decorative walls around the arena
- Multiple pillars/structures for cover
- Stairs and small elevated areas
- Open center for PvP
- Arena entrance
- Spawn platform
- Good-looking medieval/fantasy PvP style
- Symmetrical design
- Enough space for many players to fight

The arena should be generated automatically using Minecraft blocks.

Do NOT require WorldEdit or any external plugin.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
ARENA LOCATION
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Add:

/generatearena

Permission:
pvp.admin

When an admin runs `/generatearena`:

1. Find the player's current location.
2. Generate the complete arena around that location.
3. Automatically create the arena floor.
4. Automatically create walls and decorations.
5. Automatically create the arena spawn.
6. Save the arena location to config.yml.

Add:

/setarena

This can manually change the arena teleport location if needed.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
ARENA SAFETY
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

The generated arena should have:
- A protected border.
- No random terrain inside the arena.
- Proper lighting.
- No hostile mobs.
- No natural mob spawning.
- Players cannot break/place blocks inside the arena unless enabled in config.
- PvP is enabled inside the arena.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
SPAWN
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Create a separate server spawn.

Command:

/setspawn

Permission:
pvp.admin

Players can use:

/spawn

to return to the main spawn.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
TELEPORT MENU
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Command:

/menu

Open a GUI.

Add:

โš” PvP Arena

Clicking it:
- Teleports the player to the generated PvP arena.
- Closes the menu.
- Sends a configurable message.

Also add:

๐Ÿ  Spawn

Clicking it:
- Teleports the player to the main spawn.

Players cannot use teleport buttons while in combat.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
PVP SYSTEM
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Inside the generated arena:

- PvP enabled.
- Track kills.
- Track deaths.
- Track kill streaks.
- Send kill messages.
- Respawn players at the arena spawn.
- Configurable keep inventory.
- Configurable item drops.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
COMBAT TIMER
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

When a player damages another player:

Combat mode starts.

Default:
15 seconds.

While in combat:
- `/spawn` is blocked.
- `/menu` teleport is blocked.
- `/arena` teleport is blocked.

Display:

&cCombat: &f15s

Update the timer every second.

Make the combat duration configurable.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
ARENA GENERATION COMMANDS
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

/generatearena
- Generate the arena at the admin's location.

/regeneratearena
- Delete the previous generated arena and generate a new one.

/setarena
- Set the teleport location.

/arena
- Teleport to the arena.

/spawn
- Teleport to spawn.

/setspawn
- Set server spawn.

/menu
- Open teleport menu.

/pvp reload
- Reload configuration.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
CONFIGURATION
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Create config.yml with:

arena:
  size: 80
  wall-height: 12
  floor: DEEPSLATE
  wall: STONE_BRICKS
  generate-on-start: false

combat:
  duration: 15

settings:
  block-break: false
  block-place: false
  mob-spawning: false
  keep-inventory: false

gui:
  title: "&8Teleport Menu"

Make arena size and materials configurable.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
IMPORTANT TECHNICAL REQUIREMENTS
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

- Paper 1.21.11
- Java
- Maven
- No WorldEdit required.
- Generate the arena using the Bukkit/Paper world/block APIs.
- Generate blocks efficiently without freezing the server.
- Use scheduled tasks/chunk-aware generation if necessary.
- Do not generate the arena repeatedly every server restart.
- Save generated-arena information.
- Make `/regeneratearena` safely remove the old generated arena before rebuilding it.
- Do not destroy unrelated player builds outside the generated arena.
- Include plugin.yml.
- Include config.yml.
- Include pom.xml.
- Make the plugin compile into a working .jar.

The final result should be:

PLAYER JOINS
โ†“
MAIN SPAWN
โ†“
/menu
โ†“
โš” PvP Arena
โ†“
AUTOMATICALLY BUILT ARENA
โ†“
PLAYER FIGHTS

I should NOT have to build the arena myself.
Kodari AI
KodariSep 3 at 4:13 am 2
PvPArenaGenerator
Automatically generates a complete medieval-style PvP arena using block APIs without WorldEdit. Includes configurable arena size, materials, and wall height. Provides commands for arena generation, regeneration, spawn management, and teleportation. Features a GUI teleport menu, combat timer system with configurable duration, kill/death tracking, kill streaks, and respawn handling. Protects arena borders with block break/place restrictions, disables mob spawning, and enables PvP. Saves arena locations to config and prevents repeated generation on restart. Includes efficient chunk-aware generation to avoid server lag.
  1. Create the Maven/Paper project and plugin metadata.

  2. Implement persisted arena generation, regeneration, protection, spawn handling, combat, statistics, and respawn flow.

  3. Add commands, configurable teleport GUI, and default configuration.

Implemented the complete Paper 1.21.11 PvP Arena plugin with Maven.

Included:

  • Automatic arena generation with floors, walls, pillars, platforms, lighting, entrance, and spawn platform

  • /generatearena and /regeneratearena

  • /setarena and /arena

  • /setspawn and /spawn

  • /menu teleport GUI

  • Combat timer with action-bar display

  • Combat teleport restrictions

  • PvP enforcement inside the arena

  • Kill, death, and kill-streak tracking

  • Configurable item drops and keep-inventory behavior

  • Arena block protection

  • Mob-spawning protection

  • Respawn handling at the arena

  • Persistent arena and spawn locations

  • Persistent player statistics

  • Configurable arena size, materials, wall height, messages, and combat duration

  • pom.xml, plugin.yml, and config.yml for Paper 1.21.11 Maven builds

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
13 1,023
src/main/java/com/kodari/pvparena/PvpArenaPlugin.java
package com.kodari.pvparena;

import com.kodari.pvparena.arena.ArenaManager;
import com.kodari.pvparena.combat.CombatManager;
import com.kodari.pvparena.command.PvpCommand;
import com.kodari.pvparena.listener.PvpListener;
import com.kodari.pvparena.stats.StatsManager;
import com.kodari.pvparena.gui.TeleportMenu;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;

public final class PvpArenaPlugin extends JavaPlugin {
    private ArenaManager arenaManager;
    private CombatManager combatManager;
    private StatsManager statsManager;
    private TeleportMenu teleportMenu;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.arenaManager = new ArenaManager(this);
        this.combatManager = new CombatManager(this);
        this.statsManager = new StatsManager(this);
        this.teleportMenu = new TeleportMenu(this, arenaManager, combatManager);

        PvpCommand command = new PvpCommand(this, arenaManager, combatManager, teleportMenu);
        String[] commands = {"generatearena", "regeneratearena", "setarena", "arena", "spawn", "setspawn", "menu", "pvp"};
        for (String name : commands) {
            if (getCommand(name) != null) {
                getCommand(name).setExecutor(command);
                getCommand(name).setTabCompleter(command);
            }
        }

        getServer().getPluginManager().registerEvents(
                new PvpListener(this, arenaManager, combatManager, statsManager), this);

        if (getConfig().getBoolean("arena.generate-on-start", false) && !arenaManager.isGenerated()
                && !Bukkit.getWorlds().isEmpty()) {
            World world = Bukkit.getWorlds().get(0);
            Bukkit.getScheduler().runTaskLater(this,
                    () -> arenaManager.generateAt(world.getSpawnLocation(),
                            () -> getLogger().info("The startup PvP arena generation finished.")), 20L);
        }
    }

    @Override
    public void onDisable() {
        if (combatManager != null) {
            combatManager.shutdown();
        }
        if (statsManager != null) {
            statsManager.save();
        }
    }
}