D

Arena System (Not World-Based)

We no longer want duels to be world-based.

We need a proper arena system.

Arena Creation

Add a command to create arenas:

/arena create <arenaName>

Use WorldEdit selection to define the arena:

Use //wand

Left click → Position 1

Right click → Position 2

The selected positions should be saved to the config under the arena name.

Player Spawn Points

Allow setting spawn points for both players:

/arena setspawn <arenaName> p1 /arena setspawn <arenaName> p2

Player 1 and Player 2 should always teleport to their respective spawn points when the duel starts.

Duel Start & End Behavior

When the duel starts:

Do NOT teleport players 10 blocks up

Do NOT give Slow Falling effect

When the duel ends:

The duel must end properly (winner & loser decided).

The arena should be fully reset to its original state.

Remove any duel effects.

Teleport players based on config settings (spawn / lobby).

Arena Reset

After each duel:

Reset the arena blocks back to how they were before the duel.

Make sure no blocks remain broken or placed.

Config Options

Add options in the config to:

Enable / disable arena reset

Enable / disable teleport after duel

Edit win and loss messages

Enable / disable duel messages

Kodari AI
KodariJan 3 at 1:03 pm 41,845 (v2)

I’ll convert this plugin from world-based duels to a proper arena system with WorldEdit integration, block restoration, and spawn points.

I need to read more files to understand the complete structure before implementing the arena system.

Now I’ll implement the arena system with WorldEdit integration, block restoration, and spawn points.

Plan:

  • Create Arena data class with positions and spawn points

  • Create ArenaManager to handle arena creation, storage, and block restoration

  • Create ArenaCommand for /arena create, /arena setspawn

  • Update DuelDataManager to track arena usage and block snapshots

  • Replace world-based system with arena-based system in GUIs

  • Update AcceptDuelGUI to use arena spawn points (no teleport up, no slow falling)

  • Add arena reset functionality after duel ends

  • Update config with arena settings

  • Add WorldEdit soft dependency

Arena System Implementation Complete

The plugin now uses a proper arena system instead of world-based duels:

Arena Commands:

  • /arena create <name> - Create arena from WorldEdit selection

  • /arena setspawn <arena> p1/p2 - Set spawn points for players

  • /arena list - View all arenas

  • /arena info <name> - View arena details

Key Changes:

  • Players teleport directly to arena spawn points (no 10 blocks up, no slow falling)

  • Arena blocks are captured before duel and restored after

  • Arenas require both spawn points to be set before use

  • Config option to enable/disable arena reset

  • Messages updated to use “arena” instead of “world”

  • WorldEdit soft dependency added for region selection

Config Options:

  • arena.reset-enabled - Enable/disable block restoration

  • duel-end.win-message-enabled - Toggle win messages

  • duel-end.loss-message-enabled - Toggle loss messages

  • duel-end.teleport-to-spawn - Teleport players back after duel

D

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 3 error(s):

ERROR in src/main/java/com/lemonduel/arena/ArenaManager.java at line 191: cannot find symbol
    @AllArgsConstructor
     ^
  symbol: class AllArgsConstructor
  location: class ArenaManager

ERROR in   src/main/java/com/lemonduel/arena/ArenaManager.java at line 191: cannot find symbol
      @AllArgsConstructor
       ^
  symbol: class AllArgsConstructor
  location: class ArenaManager

ERROR in src/main/java/com/lemonduel/arena/ArenaManager.java at line 191: cannot find symbol
    @AllArgsConstructor
     ^
  symbol: class AllArgsConstructor
  location: class ArenaManager


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - AllArgsConstructor
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/lemonduel/arena/ArenaManager.java
  -   src/main/java/com/lemonduel/arena/ArenaManager.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJan 3 at 1:04 pm 5,843 (v2)

I need to read ArenaManager.java to check the missing Lombok import.

The issue is clear - ArenaManager.java is missing the import for @AllArgsConstructor. I need to add the Lombok import.

Fixed - added missing import lombok.AllArgsConstructor; to ArenaManager.java.

D
📎 1 file 2,452 chars
📄
pasted-code-1767445762479.txt
txt 24 lines
▶
[13:08:47 INFO]: [LemonDuel] Enabling LemonDuel v1.0.0
[13:08:47 ERROR]: Error occurred while enabling LemonDuel v1.0.0 (Is it up to date?)
java.lang.NoClassDefFoundError: com/sk89q/worldedit/IncompleteRegionException
        at com.lemonduel.LemonDuel.registerCommands(LemonDuel.java:63) ~[LemonDuel-1.0.0 (3).jar:?]
        at com.lemonduel.LemonDuel.onEnable(LemonDuel.java:39) ~[LemonDuel-1.0.0 (3).jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-196]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:642) ~[paper-1.20.1.jar:git-Paper-196]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-196]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.sk89q.worldedit.IncompleteRegionException
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        ... 14 more
[13:08:47 INFO]: [LemonDuel] Disabling LemonDuel v1.0.0
[13:08:47 INFO]: [LemonDuel] LemonDuel has been disabled!
Kodari AI
KodariJan 3 at 1:10 pm 13,214 (v2)

I need to check the files to understand the WorldEdit dependency issue.

Analysis

The error is clear: ArenaCommand.java imports and uses WorldEdit classes (com.sk89q.worldedit.IncompleteRegionException), but WorldEdit is marked as compileOnly in build.gradle. This means:

  1. WorldEdit is available at compile time but NOT bundled with the plugin

  2. At runtime, if WorldEdit is not installed on the server, the plugin crashes when trying to load ArenaCommand

  3. The plugin should either make WorldEdit required (hard dependency) or make it optional (soft dependency with runtime checks)

Since plugin.yml lists WorldEdit as softdepend, the plugin intends WorldEdit to be optional. The fix is to make the arena command handle the case where WorldEdit is not present.

Solution Plan

  • Make ArenaCommand check if WorldEdit is available before using it

  • If WorldEdit is not present, show an error message instead of crashing

  • Move WorldEdit-specific code into a try-catch or conditional check

Fixed! The plugin will now:

  • Check if WorldEdit is installed at runtime

  • Use reflection to access WorldEdit classes (avoiding compile-time dependency issues)

  • Show a clear error message if WorldEdit is missing when trying to create arenas

  • All other arena commands (setspawn, list, info) work without WorldEdit

D

i already selected worldedit rg but arena is not createing

1 image attached
Kodari AI
KodariJan 3 at 1:22 pm 8,741 (v2)

I need to check the arena creation logic to see why it’s not detecting your WorldEdit selection.

I found the issue! The code is catching the exception silently when it fails to get the WorldEdit selection. Looking at your error message “You must make a WorldEdit selection first!”, the code is throwing an exception during the reflection calls.

The problem is likely that you’re using WorldEdit 7.3+ which changed the API structure. Let me fix the arena creation to properly support both old and new WorldEdit versions:

Fixed! The issue was:

  1. Old reflection-based code - Was trying to use reflection to support all WorldEdit versions, but it was failing silently

  2. Direct API usage - Now uses WorldEdit’s modern API directly with proper imports

  3. Better error handling - Shows the actual error message instead of generic “must make selection”

Now it will properly detect your WorldEdit selection and create the arena!

D

Arena Duplication & Multiple Duels Fix Problem

When an arena is already in use by an active duel, another duel cannot use the same arena.

Required Fix (Solution)

If an arena is already in use:

Create a temporary copy of the arena (copy–paste).

Paste the arena at a random available location (far from the original arena).

Start the duel in the copied arena.

This allows multiple duels at the same time using the same arena layout.

Behavior Details

Use the original arena as a template.

Each duel gets its own pasted arena instance.

After the duel ends:

Reset / delete the pasted arena.

Free memory properly to avoid lag.

Random Paste Location

Paste the arena at a random safe location:

Far from other arenas

No overlap

Same Y-level or configured Y-level

Performance

Make sure arena copy–paste is:

Optimized

Async-safe (no server lag)

Does not cause high CPU usage

Kodari AI
KodariJan 3 at 1:42 pm 28,741 (v2)

I’ll implement arena duplication for concurrent duels. The system will:

  • Create temporary arena copies when original is in use

  • Paste at random safe locations

  • Clean up after duel ends

  • Use async operations to prevent lag

Arena duplication system implemented with:

  • ArenaInstance - tracks temporary arena copies with unique IDs

  • ArenaCopyManager - handles async copy/paste operations (1000 blocks/tick to prevent lag)

  • Random placement - 500-2000 blocks away from original, collision detection

  • Automatic cleanup - deletes temporary arenas after duel ends

  • Memory efficient - snapshots cleared after deletion

  • Multi-duel support - unlimited concurrent duels per arena template

D

Final Arena & Duel Fixes (No Duplication) Arena Usage (No Duplication)

Do NOT duplicate arenas.

If an arena is already in use by an active duel:

Mark the arena as BUSY.

Do not show this arena in the arena selection menu.

Only show arenas that are FREE.

Duel End Conditions

If a player leaves the server during a duel:

End the duel immediately.

The remaining player wins the duel.

Remove both players from the active duel list.

Free the arena so it becomes available again.

Arena Availability

When a duel ends (kill / leave / cancel):

Set arena status back to FREE.

Make the arena selectable again in the menu.

Performance

This system must be lightweight and optimized.

Avoid heavy tasks that cause server lag or high CPU usage.

Plugin Files & Structure

Edit the plugin messages and config properly according to the plugin folder structure.

All messages must be configurable.

Ensure the plugin name is LemonDuel everywhere:

Plugin name

Folder name

Config

Messages

Code

Commands

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
38 3,054
src/main/java/com/lemonduel/LemonDuel.java
package com.lemonduel;

import com.lemonduel.arena.ArenaManager;
import com.lemonduel.command.*;
import com.lemonduel.config.ConfigManager;
import com.lemonduel.data.DuelDataManager;
import com.lemonduel.inventory.gui.GUIListener;
import com.lemonduel.inventory.gui.GUIManager;
import com.lemonduel.listener.ChatListener;
import com.lemonduel.listener.EnderPearlListener;
import com.lemonduel.listener.JoinQuitListener;
import com.lemonduel.listener.MoveListener;
import com.lemonduel.listener.PlayerDeathListener;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class LemonDuel extends JavaPlugin {
    
    @Getter
    private GUIManager guiManager;
    
    @Getter
    private DuelDataManager dataManager;
    
    @Getter
    private ConfigManager configManager;
    
    @Getter
    private ArenaManager arenaManager;
    
    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.guiManager = new GUIManager();
        this.dataManager = new DuelDataManager();
        this.arenaManager = new ArenaManager(this);
        
        registerCommands();
        registerListeners();
        
        getLogger().info("LemonDuel has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (arenaManager != null && arenaManager.getCopyManager() != null) {
            arenaManager.getCopyManager().cleanupAll();
        }
        if (dataManager != null) {
            dataManager.clearAll();
        }
        if (guiManager != null) {
            guiManager.cleanup();
        }
        getLogger().info("LemonDuel has been disabled!");
    }
    
    private void registerCommands() {
        getCommand("duel").setExecutor(new DuelCommand(this));
        getCommand("duelaccept").setExecutor(new DuelAcceptCommand(this));
        getCommand("togglechat").setExecutor(new ToggleChatCommand(this));
        getCommand("dueltoggle").setExecutor(new DuelToggleCommand(this));
        getCommand("stats").setExecutor(new StatsCommand(this));
        getCommand("lemonduel").setExecutor(new LemonDuelCommand(this));
        getCommand("arena").setExecutor(new ArenaCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new ChatListener(this), this);
        Bukkit.getPluginManager().registerEvents(new MoveListener(this), this);
        Bukkit.getPluginManager().registerEvents(new JoinQuitListener(dataManager), this);
        Bukkit.getPluginManager().registerEvents(new EnderPearlListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
    }
    
    public void reload() {
        configManager.loadConfigs();
    }
}