.tvlx

A elemental plugin with 8 different elements each having 2 spark effects and 1 passive ability and the spark ability has a 30second cool down each. You get a random ability when you join you can change it by using 4diamond blocks a etable and 4quartz. Which lets you reroll once by right clicking once.

Kodari AI
KodariJul 28 at 1:17 am 5
ElementalSparks
ElementalSparks is a Minecraft plugin that assigns every player one of eight elemental powers: Fire, Water, Earth, Air, Lightning, Shadow, Ice, or Nature. Each element provides two unique spark abilities with independent 30-second cooldowns and a permanent passive effect. Players receive a random element when they first join, can view their powers with /element, and can craft a single-use reroll item from four diamond blocks, four quartz, and a crafting table, then right-click it to receive a new element.
.tvlx

in the crafting recipe replace the crafting table with a enchanting table and replace the quartz with gold ingots, and also make the reroll have a small animation kinda like a gambling machine going through all the elements until it stops on one

Kodari AI
KodariJul 28 at 12:14 pm 3
  1. Update the reroll recipe to use 4 diamond blocks, 1 enchanting table, and 4 gold ingots.

  2. Add a short element-preview animation that cycles through elements before assigning the final reroll result.

  1. Updated the recipe to use:

    • 4 Diamond Blocks

    • 1 Enchanting Table

    • 4 Gold Ingots

  2. Added a reroll animation:

    • Cycles through all 8 elements twice.

    • Displays the current element in the action bar.

    • Stops on a new randomly selected element.

    • Prevents multiple rerolls from running simultaneously.

    • Consumes the reroll item immediately when activated.

.tvlx

it doesnt show a reroll animation and when i activated the elemental reroll its stuck and is not rerolling and says your element already rerolled please fix this

Kodari AI
KodariJul 28 at 12:25 pm 3
  1. Fix the reroll state so activation is not rejected as already used before the animation starts.

  2. Make the animation run asynchronously on the server scheduler, update the action bar during each step, and finalize the new element reliably.

  3. Ensure the item is consumed exactly once and the player cannot start overlapping rerolls.

Fixed the reroll flow:

  • The reroll item is consumed only once when activated.

  • The animation now visibly cycles through all eight elements using both the action bar and title display.

  • The animation starts after one server tick and cycles every 3 ticks.

  • A player cannot start another reroll while one is active.

  • The reroll state is cleared when the player disconnects or if an error occurs.

  • The final element is saved and its passive ability is reapplied automatically.

  • If the player disconnects, the animation safely stops instead of becoming stuck.

.tvlx

there is no animation and it never stops rerolling for some reason

Kodari AI
KodariJul 28 at 12:37 pm 5
  1. Inspect the current reroll listener and scheduler flow.

  2. Fix the animation task so it visibly advances and always terminates.

  3. Ensure the final element is assigned once and the reroll lock is cleared on every exit path.

The current task has no protected failure path: an exception inside a tick can stop the scheduler while leaving the reroll state active. I’m replacing it with a bounded task that cancels before finalizing, catches failures, and guarantees the lock is removed.Fixed the reroll loop:

  • The animation now has a guaranteed limit of 16 preview steps.

  • Each step updates the action bar and title with the current element.

  • The task cancels before assigning the final element.

  • Exceptions now cancel the task and clear the player’s reroll lock.

  • Offline players also clear the lock safely.

  • The final element is assigned only once after the animation finishes.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
13 1,000
src/main/java/com/kodari/elementalsparks/ElementalSparksPlugin.java
package com.kodari.elementalsparks;

import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ElementalSparksPlugin extends JavaPlugin {

    private ElementManager elementManager;
    private CooldownManager cooldownManager;
    private SparkAbilityService sparkAbilityService;
    private NamespacedKey rerollKey;

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

        rerollKey = new NamespacedKey(this, "elemental_reroll");
        elementManager = new ElementManager(this);
        elementManager.load();

        long cooldownSeconds = getConfig().getLong("spark-cooldown-seconds", 30L);
        cooldownManager = new CooldownManager(cooldownSeconds);
        sparkAbilityService = new SparkAbilityService();

        getServer().getPluginManager().registerEvents(
                new ElementListener(this, elementManager, cooldownManager, sparkAbilityService, rerollKey),
                this
        );

        new RerollRecipe(this, rerollKey).register();

        PluginCommand command = getCommand("element");
        if (command != null) {
            command.setExecutor(new ElementCommand(elementManager));
        }
    }

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

    public ElementManager getElementManager() {
        return elementManager;
    }

    public NamespacedKey getRerollKey() {
        return rerollKey;
    }
}