dragonhollo3w

Create me a plugin for a plugin where every player gets a random passive + active ability total should be 12 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. Make it for version 1.21.11

Kodari AI
KodariJun 29 at 7:10 am 2

I’ll build an ability assignment plugin with a spinning wheel animation and floating effect.

AbilityWheel
A first-join ability assignment plugin featuring a spinning wheel animation. Each player receives a random passive and active ability from a pool of 12 (6 passive, 6 active). The assignment process includes a levitation effect and a visual inventory wheel that cycles through abilities, gradually slowing to a stop. Active abilities have cooldowns and can be triggered via compass item or command. Passive abilities provide permanent buffs.

Creating all project files from scratch:

Wait, I have an issue - ItemStack is not imported in PlayerListener.java. Also, the compass detection logic needs to be more reliable since we’re using MiniMessage. Let me also reconsider the ability compass detection approach. Instead of comparing serialized MiniMessage, I’ll use a persistent data container tag or just check if it’s a compass and the lore matches.

Actually, let me fix the compass interaction detection. The simplest approach: right-clicking any compass while holding it triggers the ability. If they don’t have an active ability or abilities, nothing happens (the /ability activate command handles that). This way I don’t need to match display names exactly.

Let me also fix a few things I noticed:

  1. The PlayerInteractEvent for the compass - the item check needs fixing

  2. The ItemStack import in PlayerListener

Let me also reconsider the wheel animation. The key issue is: in the startWheel method, I build spinningItems with all 12 ability items + fillers. The updateDisplay method populates the middle row (except the winning slot) with items from spinningItems based on scrollOffset. The winning slot has the selector arrow.

But when the animation finishes, the player needs to see which ability they got. Currently the winning slot always has the arrow, not the actual ability item. The ability items are in the other 8 slots around it. This is confusing.

Let me redesign the display:

  • After animation stops, replace the center slot with the actual ability item

  • Or better: before closing the inventory, update the display to show the selected ability prominently

Actually, let me simplify the approach: the 8 items around the winning slot are scrolling. The winning slot has a “▼” indicator. When the animation stops, the item DIRECTLY ABOVE the winning slot (slot 4 in the middle row, which is index 12, wait no - let me think again.

Layout:

Plain Text
Row 0 (slots 0-8):   [G][G][G][G][G][G][G][G][G]
Row 1 (slots 9-17):  [I][I][I][I][S][I][I][I][I]
Row 2 (slots 18-26): [G][G][G][G][G][G][G][G][G]

S = selector at slot 13 (WINNING_SLOT) I = items scrolling

So the 8 I slots hold the cycling items. But wait, how do we show which item is “selected”? The selector points at slot 13? And item scrolls through the slots… so the item at slot 13 IS the selected one, but we have a selector there instead of an item.

Let me rethink the visual. Better approach:

Plain Text
[I][I][I][I][I]
    [▼]

The items scroll left-to-right through the middle row. The position directly below the “▼” (slot 13) shows the currently “selected” item. The arrow should be in the row ABOVE the items (or BELOW). Let me put the arrow in slot 13 and the items scroll through the surrounding slots? No, that’s confusing.

Better redesign:

5-row chest (54 slots):

Plain Text
Row 0: [  ][  ][  ][ ][ ][ ][  ][  ][  ]
Row 1: [  ][  ][  ][ ][▼][  ][  ][  ][  ]
Row 2: [  ][  ][I1][I2][I3][I4][I5][  ][  ]
Row 3: [  ][  ][  ][ ][▲][  ][  ][  ][  ]  
Row 4: [  ][  ][  ][ ][  ][  ][  ][  ][  ]

This is getting complex. Let me just use the simplest approach:

3-row chest (27 slots):

Plain Text
Row 0: [G][G][G][G][G][G][G][G][G]    border
Row 1: [G][I][I][I][I][I][I][I][G]    items scrolling, with glass at edges
Row 2: [G][G][G][G][G][G][G][G][G]    border

Wait, this doesn’t have a selector/indicator. Let me use a 5-row chest:

Plain Text
Row 0: [G][G][G][G][G][G][G][G][G]    
Row 1: [G][G][G][G][▼][G][G][G][G]    indicator 
Row 2: [G][I][I][I][I][I][I][I][G]    items scrolling
Row 3: [G][G][G][G][G][G][G][G][G]    

Here, the arrow is at slot 13 (center of row 1), pointing down at slot 22 (center of row 2). The items scroll through row 2 (slots 19-25, 7 items visible). The item directly below the arrow at slot 22 is the “selected” one.

But this means items only scroll through 7 positions, which is fine.

Actually, let me simplify even more. I’ll use a 27-slot chest with:

Plain Text
Row 0: [G][G][G][G][G][G][G][G][G]    border
Row 1: [G][G][I][I][I][I][I][G][G]    5 items + wide border
Row 2: [G][G][G][G][G][G][G][G][G]    border

And put a selector ARROW in slot 4 (row 0, column 4). Wait, slot 4 is above slot 13…

OK I’m overcomplicating this. Let me go with the simplest clean approach:

27-slot chest:

  • Row 0: all glass (border)

  • Row 1: glass, glass, 5 ability items, glass, glass → winning slot is the CENTER of these 5

  • Row 2: all glass (border)

Wait, 5 items in a 9-slot row means indices 2-6. Center of those is index 4 (which is ROW_SIZE + 4 = 13). That’s WINNING_SLOT.

Let me use a selector ABOVE the winning slot, at slot 4 (row 0, column 4):

Plain Text
Row 0: [G][G][G][G][▼][G][G][G][G]
Row 1: [G][G][I][I][I][I][I][G][G]   ← winning slot is 13 (center of row 1)
Row 2: [G][G][G][G][G][G][G][G][G]

But I need 9 slots of items to get a nice scrolling effect. Let me make row 1 have all items (9 items) with winning slot being slot 13 (center).

Plain Text
Row 0: [G][G][G][G][▼][G][G][G][G]
Row 1: [I][I][I][I][I][I][I][I][I]   ← 9 items, center = slot 13
Row 2: [G][G][G][G][G][G][G][G][G]

And I won’t put the selector at slot 13 - I’ll put it ABOVE at slot 4, pointing down.

The winning slot is slot 13 (center of row 1). The arrow at slot 4 points to it.

When items scroll left/right through row 1, the item at slot 13 when animation stops is the winner. The arrow stays at slot 4 as a pointer.

This is clean! Let me update the code.

For items scrolling: I’ll have 9 visible slots in row 1. Items scroll left. After N left scrolls, the item originally at position P in my cycling list will be at slot position (P + N) % listSize.

Wait, more precisely: the 9 visible slots map to positions in the cycling list starting at scrollOffset % listSize.

Visible slot 9 (row 1, index 0) shows items[(scrollOffset + 0) % listSize] Visible slot 10 (row 1, index 1) shows items[(scrollOffset + 1) % listSize] … Visible slot 13 (row 1, index 4) shows items[(scrollOffset + 4) % listSize] … Visible slot 17 (row 1, index 8) shows items[(scrollOffset + 8) % listSize]

I want selectedAbility (which is at items0) to appear at slot 13 (index 4). So (scrollOffset + 4) % listSize = 0 => scrollOffset % listSize = (0 - 4 + listSize) % listSize = listSize - 4

If listSize is 18 (12 abilities + 6 fillers, or 6 of the opposite type + fillers… actually let me use a reasonable number).

Let me use listSize = 18 items total.

targetOffset = (0 - 4 + 18) % 18 = 14

So after the animation, scrollOffset should be 14 (or 14 + 18k).

Total shifts needed: some number N where N % 18 == 14.

Let me recalculate:

  • Minimum shifts: plugin config’s fast-shifts (25) + some slow shifts

  • Total = 25 + slowShifts, and (25 + slowShifts) % 18 should equal 14

  • So (25 + slowShifts) % 18 = 14

  • 25 % 18 = 7

  • (7 + slowShifts) % 18 = 14

  • slowShifts % 18 = 7

  • So slowShifts = 7 + 18*k for some k

  • If k=1, slowShifts = 25. Total = 25 + 25 = 50. 50 % 18 = 14 ✓

So: fastShifts = 25, slowShifts = 25, total = 50.

This gives a smooth animation: 25 fast shifts + 25 slowing-down shifts.

OK let me just rewrite the entire GUI class and the affected code. Let me start over with cleaner code.

Actually, I think the cleanest approach is:

  1. Build the items list (list of 18 items, with selectedAbility guaranteed at position 0)

  2. Pre-calculate the total number of shifts needed

  3. First X shifts happen fast (every 2 ticks)

  4. Remaining shifts gradually slow down

Let me rewrite everything now. I’ll create all the corrected files. I’ll also make sure to include paper-api classes properly.

One more thing - I need to handle the case where INVENTORY_TYPE for a chest creates a 27-slot inventory properly. Bukkit.createInventory(null, 27, title) creates a 3-row chest inventory. ✓

Let me also handle the sound for Minecraft 1.21. In 1.21, some sounds might use the old names. Let me use namespaces. Actually, let me just use Sound.ENTITY_PLAYER_LEVELUP or the NamespacedKey approach… Actually in Paper 1.21, I should be able to use org.bukkit.Sound.ENTITY_PLAYER_LEVELUP. If that fails, I can use the key directly.

Actually, in recent Paper versions, sounds are referenced by their namespaced key:

Java
player.playSound(Sound.ENTITY_PLAYER_LEVELUP);

In Paper 1.21.4+, Sound enum should have ENTITY_PLAYER_LEVELUP. Let me use it.

Also, PotionEffectType.LEVITATION - in Paper 1.21.4+, PotionEffectType is still available but the API might have shifted. Let me check… In Paper API 1.21+, PotionEffectType is the standard way. Some things moved to Registry, but the old PotionEffectType static fields should still be available.

Wait, actually in Paper 1.21+, PotionEffectType has changed. The static fields like PotionEffectType.LEVITATION were deprecated in favor of PotionEffectType.LEVITATION (which redirects through the registry). They should still work.

Actually, in very recent Paper versions (1.20.5+), several PotionEffectType constants were deprecated but still work. Let me use PotionEffectType by name:

Java
PotionEffectType byName = PotionEffectType.getByName("LEVITATION");

Or:

Java
Registry.EFFECT.get(NamespacedKey.minecraft("levitation"));

For simplicity and 1.21 compatibility, let me use the namespace approach which is the most future-proof. Actually, let me just use PotionEffectType constants - they still work in 1.21.4 Paper.

OK, I’ve spent way too long thinking. Let me just write the code and create the files. I’ll make reasonable choices and ensure everything compiles.

Let me list the final set of files and create them:

  1. build.gradle

  2. src/main/resources/plugin.yml

  3. src/main/resources/config.yml

  4. src/main/resources/messages.yml

  5. src/main/java/com/abilitywheel/AbilityWheelPlugin.java

  6. src/main/java/com/abilitywheel/Ability.java

  7. src/main/java/com/abilitywheel/AbilityType.java

  8. src/main/java/com/abilitywheel/AbilityManager.java

  9. src/main/java/com/abilitywheel/PlayerData.java

  10. src/main/java/com/abilitywheel/PlayerDataManager.java

  11. src/main/java/com/abilitywheel/AbilityWheelGUI.java

  12. src/main/java/com/abilitywheel/PlayerListener.java

  13. src/main/java/com/abilitywheel/AbilityCommand.java

13 files total. Let me write them all now.

Wait, I already wrote them above. The issue is the AbilityWheelGUI.java has some logic bugs I need to fix. Let me rewrite just that file and make sure the display/selector logic is correct.

Actually, let me recreate ALL files cleanly to ensure everything is consistent.Let me create all the files from scratch with a clean, consistent design.

Now let me add the plugin.yml with the /ability command registration:

I caught a bug in AbilityManager.getRandomPassive() — it’s calling passives.size() as an index which is out of bounds. Let me fix that:

dragonhollo3w

Can u send all the abiltiies

Kodari AI
KodariJun 29 at 7:17 am 1

6 Active Abilities (triggered with compass right-click or /ability activate):

Ability
Effect
Cooldown
Burst Dash
Launch forward 10 blocks in the direction you’re looking
8s
Healing Wave
Heal 6 HP instantly, nearby allies get 3 HP
20s
Force Push
Knock back all nearby enemies 6 blocks
12s
Invisibility
Turn invisible for 6 seconds
30s
Lightning Strike
Strike the nearest enemy with lightning dealing 4 ❤️ damage
15s
Time Warp
Teleport back to where you were 5 seconds ago
25s

6 Passive Abilities (always active, no cooldown):

Ability
Effect
Vampiric Touch
15% chance to heal 1❤️ when dealing damage
Fortitude
+4 max hearts permanently
Swift Feet
+30% permanent speed boost
Thorns Aura
Reflect 3❤️ damage back to attackers
Lucky Miner
+15% chance to double any block drop
Dodge
10% chance to negate incoming damage entirely
dragonhollo3w

Can ya make it active + passive all the abiltiies

Kodari AI
KodariJun 29 at 7:22 am 4

I’ll update all abilities to match your exact list. Let me read the files I need to modify.

Now I’ll update all files with your selected 12 abilities (6 active + 6 passive).

Now I’ll update all files to use your specific 12 abilities

Now update PlayerData to store lastLocation, and update the listener for the new passives.

Now update config and messages to match the new ability set

Everything is updated. Here’s the complete ability list integrated into the plugin:

6 Active Abilities (trigger via compass right-click or /ability activate):

Ability
Icon
Effect
Cooldown
Burst Dash
Feather
Launch forward 10 blocks
8s
Healing Wave
Nether Star
Heal 6❤ self + 3❤ nearby allies
20s
Force Push
Slime Ball
Knock back enemies 6 blocks
12s
Invisibility
Glass Bottle
Invisible for 6 seconds
30s
Lightning Strike
Lightning Rod
Strike nearest enemy for 4❤
15s
Time Warp
Clock
Teleport to where you were 5s ago
25s

6 Passive Abilities (always active):

Ability
Icon
Effect
Vampiric Touch
Redstone
15% chance to heal 1❤ per hit
Fortitude
Diamond Chestplate
+4 max hearts (12 total)
Swift Feet
Sugar
Permanent +30% speed boost
Thorns Aura
Cactus
Reflect 3❤ back to attackers
Lucky Miner
Diamond Pickaxe
15% chance for double block drops
Dodge
Shield
10% chance to negate all damage

The spin wheel plays twice on first join — once for the passive assignment, then once for the active — while the player floats in the air with levitation + slow falling. Each ability’s item scrolls through the wheel slots and gradually slows to a stop on the winning ability.

dragonhollo3w

Compile it

Kodari AI
KodariJun 29 at 7:25 am 1

No Java or Gradle is installed in this environment, so I can’t compile here. To build on your machine:

  1. Ensure JDK 17+ and Gradle are installed

  2. Run:

Shell
cd /home/user
gradle build

The JAR will be at build/libs/AbilityWheel-1.0.jar. Drop it in your server’s plugins/ folder and restart.

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

import lombok.Getter;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

@Getter
public final class AbilityWheelPlugin extends JavaPlugin {

    private AbilityManager abilityManager;
    private PlayerDataManager playerDataManager;
    private AbilityWheelGUI abilityWheelGUI;
    private PlayerListener playerListener;

    private File messagesFile;
    private YamlConfiguration messagesConfig;

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

        this.abilityManager = new AbilityManager(this);
        this.playerDataManager = new PlayerDataManager(this);
        this.abilityWheelGUI = new AbilityWheelGUI(this);
        this.playerListener = new PlayerListener(this);

        getCommand("ability").setExecutor(new AbilityCommand(this));
        getServer().getPluginManager().registerEvents(playerListener, this);
        getServer().getPluginManager().registerEvents(abilityWheelGUI, this);

        getLogger().info("AbilityWheel enabled — 12 abilities (6 passive + 6 active)");
    }

    @Override
    public void onDisable() {
        if (abilityWheelGUI != null) abilityWheelGUI.cancelAll();
        if (playerDataManager != null) playerDataManager.saveAll();
    }

    private void saveDefaultMessages() {
        messagesFile = new File(getDataFolder(), "messages.yml");
        if (!messagesFile.exists()) {
            saveResource("messages.yml", false);
        }
        messagesConfig = YamlConfiguration.loadConfiguration(messagesFile);
    }

    public String msg(String path) {
        String msg = messagesConfig.getString("messages." + path);
        return msg != null ? msg : "&cMissing message: " + path;
    }

    public String msg(String path, String... replacements) {
        String msg = msg(path);
        for (int i = 0; i < replacements.length - 1; i += 2) {
            msg = msg.replace(replacements[i], replacements[i + 1]);
        }
        return msg;
    }
}