dragonhollo3w

Create me a plugin where every player gets a random active+passive ability to all should 16 abilities and when they join the server for the first time. The ability should be assigned through a spinning wheel animation while the player is floating in the air. And it should not be curropted and make for version 1.21.11

Kodari AI
KodariJun 29 at 8:30 am 3

I’ll create a random ability assignment plugin with a spinning wheel animation where players float while receiving their abilities.

AbilityWheel
A random ability assignment plugin where every new player receives one active and one passive ability from 16 unique abilities via an interactive spinning wheel. Players float in the air during a visually animated wheel ceremony. Features 8 active and 8 passive abilities with cooldowns, persistent data storage, graceful error handling, and corruption-free file-based saving.

Now I need to fix a few things I noticed:

  1. The SpinWheelGUI.start() method opens its own inventory, but PlayerListener.startActiveWheel() also opens an inventory. I need to fix this.

  2. interRoundDelay is used as a field in PlayerListener but should be read from config directly.

  3. The PotionEffect.INFINITE.duration() reference - there’s no such field. I need to use Integer.MAX_VALUE instead.

Let me also fix the Bukkit import in PlayerListener that references Bukkit without importing it.

Let me fix these files

Now let me fix the remaining issues. I’ll re-read the files to verify consistency.

Good - I can see the issues. Let me fix the PotionEffect.INFINITE.duration() calls (that’s not a valid Java - INFINITE is a static int field, not an object with a duration() method) and update the build.gradle for 1.21.1

Now I need to fix a critical bug in the wheel animation — the selector moves randomly but then assigns a pre-selected ability, so the visual landing position won’t match the actual result. I need to guide the animation toward the pre-determined ability in the final portion

All files are created and consistent. Here’s a summary of the complete AbilityWheel plugin:


Project Overview

AbilityWheel — A 1.21.1 Bukkit/Spigot plugin where every new player receives a random active + passive ability via an interactive spinning wheel ceremony. Players float in mid-air while the wheel spins, then land with their unique loadout.

Files Created (11 total)

File
Purpose
build.gradle
Gradle build, Spigot 1.21.1 API, Java 21
plugin.yml
Plugin metadata,
/ability
command
config.yml
Configurable wheel timing, cooldowns, freeze behavior
AbilityType.java
Enum of 16 abilities (8 active + 8 passive) with display info
PlayerAbilityData.java
Per-player data model (UUID, active/passive ability names)
DataManager.java
JSON file persistence with
atomic writes
(tmp + rename) — no corruption
AbilityManager.java
Execute active abilities, apply/remove passive effects, freeze/release player
SpinWheelGUI.java
Animated spinning wheel with guided deceleration toward the pre-selected ability
PlayerListener.java
Join detection, ceremony orchestration, damage/move/inventory blocking, passive reapply
AbilityCommand.java
/ability
and
/ability use
commands
AbilityWheelPlugin.java
Main plugin class, managers initialization

Key Design Decisions

  • No corruption risk: DataManager writes to a .tmp file first, then uses Files.move with ATOMIC_MOVE to replace the real file

  • Crash recovery: If a player disconnects mid-ceremony, wheelInProgress flag persists. On rejoin, the ceremony restarts

  • Guided animation: The wheel animation ramps down naturally — fast swaps early, slowdown at 60% progress, and forces the selector onto the pre-selected slot at 85%+ progress. The visual landing always matches the actual assigned ability

  • Freeze mechanics: Movement, inventory clicks, item drops, interactions, and damage are all blocked during the ceremony via EventPriority.LOWEST cancellation

  • Passive reapplication: Passives re-apply on every join and after respawn

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
11 1,253
src/main/java/com/abilitywheel/AbilityWheelPlugin.java
package com.abilitywheel;

import com.abilitywheel.ability.AbilityManager;
import com.abilitywheel.command.AbilityCommand;
import com.abilitywheel.data.DataManager;
import com.abilitywheel.listener.PlayerListener;
import org.bukkit.plugin.java.JavaPlugin;

public class AbilityWheelPlugin extends JavaPlugin {

    private static AbilityWheelPlugin instance;
    private AbilityManager abilityManager;
    private DataManager dataManager;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        this.dataManager = new DataManager(this);
        this.abilityManager = new AbilityManager(this);

        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);

        AbilityCommand abilityCommand = new AbilityCommand(this);
        getCommand("ability").setExecutor(abilityCommand);
        getCommand("ability").setTabCompleter(abilityCommand);

        getLogger().info("AbilityWheel v" + getDescription().getVersion() + " enabled!");
        getLogger().info("16 abilities loaded (8 active + 8 passive)");
    }

    @Override
    public void onDisable() {
        if (dataManager != null) {
            dataManager.saveAll();
        }
        getLogger().info("AbilityWheel disabled. All player data saved.");
    }

    public static AbilityWheelPlugin getInstance() {
        return instance;
    }

    public AbilityManager getAbilityManager() {
        return abilityManager;
    }

    public DataManager getDataManager() {
        return dataManager;
    }
}