workinghome63-design

Act as an expert Minecraft Java Plugin Developer. Create a Spigot plugin named "OptionAnimation" for version 1.20.1+.

  1. ARCHITECTURE & LOGIC (Crucial Change):
  • Save animations in "/plugins/OptionAnimation/animations/" as individual .yml files.
  • Config structure: enabled (boolean), type, text (RAW TEXT ONLY), color1 (Hex), color2 (Hex), speed, and stay.
  • AUTO-GRADIENT RENDERING: The AnimationManager must NOT simply display the stored "text". Instead, for every frame it renders, it must automatically create a gradient using Kyori MiniMessage.
  • The logic should be: Wrap the current frame text like this: "<gradient:" + config.color1 + ":" + config.color2 + ">" + frameText + "</gradient>". This applies the gradient automatically over the RAW text.
  1. COMMAND SYSTEM (Permission: optionanimation.admin):
  • /openanimation create <name> <type> <text...>:

* Creates <name>.yml, sets enabled: true. Sets default hex colors for color1/2. Saves the provided text as RAW text (without tags). Starts the auto-gradient loop.

  • /openanimation edit <name> <text|type|color1|color2> <value...>:

* 'text': Update the RAW text and restart loop. User just types normal text. * 'type': Update type (typewriter/blink/random). * 'color1' or 'color2': Update the respective hex color field. The loop will instantly use the new color for the auto-gradient. User provides just hex like "##FF0000".

  1. ANIMATION MODES (All using Auto-Gradient):
  • Typewriter: builds raw text word-by-word, waits 'stay', then erases word-by-word. Gradient automatically adjusts over current visible words.
  • Blink: Toggles raw text on/off. Gradient applied when on.
  • Random: Raw words appear randomly. Gradient applied over visible words.
  1. PLACEHOLDERAPI:
  • Register placeholder: %optionanim_<filename>%
  1. TAB COMPLETER:
  • Suggestions for animation files, 'text/type/color1/color2' options, and animation types.

Deliverables: Full Java Source Code (Main, Manager, CommandExecutor, TabCompleter, Expansion) and plugin.yml.

Kodari AI
KodariApr 28 at 2:22 pm 11,092 (v2)
OptionAnimation
A Spigot plugin for creating animated text placeholders via PlaceholderAPI. Supports three animation modes: Typewriter (builds/erases word-by-word), Blink (toggles visibility), and Random (words appear in random order). Each animation stores raw text with configurable hex gradient colors applied automatically every frame via MiniMessage. Animations are saved as individual .yml files and managed through the /openanimation command with full tab completion.

Plan:

  • AnimationData — Lombok data class for animation config fields

  • AnimationManager — loads/saves .yml files, runs per-animation BukkitRunnable tasks with state machines, stores current rendered MiniMessage frame string

  • AnimationCommand + AnimationTabCompleter — CRUD commands

  • AnimationExpansion — PAPI %optionanim_<name>% returning live frame string

  • OptionAnimation — main plugin wiring everything together

Here’s a summary of what was built:

AnimationData — Lombok @Data class holding all 8 config fields per animation.

AnimationManager — Core of the plugin:

  • Loads/saves individual .yml files from /plugins/OptionAnimation/animations/

  • Runs one BukkitRunnable per animation using internal state machines for each type

  • renderFrame() wraps current visible text with <gradient:color1:color2>…</gradient> automatically every frame

  • stayFrames() converts the stay tick value into frame counts relative to speed

Animation logic:

  • Typewriter — word-by-word build → hold → word-by-word erase loop

  • Blink — full text for stay frames → blank for one frame → repeat

  • Random — random word insertion until full → hold → clear and restart

AnimationExpansion — Returns the live MiniMessage gradient string for %optionanim_<name>%; downstream plugins supporting MiniMessage (e.g. via PAPI’s MiniMessage hook or DecentHolograms) will render it with full gradient color.

AnimationCommand — Handles create and edit subcommands; color1/color2 values are normalized to strip duplicate # signs before saving.

workinghome63-design

The hologram is not showing any text and there is no reload command.

Kodari AI
KodariApr 30 at 6:41 am 16,942 (v2)

The two problems are:

  • The placeholder returns raw MiniMessage tags (<gradient:…>) which hologram plugins can’t render — need to compute a real per-character gradient using Spigot’s native §x hex color codes instead

  • No reload subcommand

I’ll fix renderFrame() to produce legacy §x§R§R§G§G§B§B gradient codes per character, and add /openanimation reload.

Now add a reload() method to AnimationManager and the reload subcommand to the command handler and tab completer:

Now add reload to the command:

Add reload to tab completions:

Here’s what changed and why:

Hologram fix — renderFrame() in AnimationManager: The old code returned raw MiniMessage tags <gradient:#FF…>text</gradient>). Hologram plugins (DecentHolograms, FancyHolograms, etc.) read the PAPI string as plain text — they don’t parse MiniMessage. The fix replaces renderFrame() with a manual per-character gradient engine (applyLegacyGradient) that:

  1. Parses both hex colors into RGB components

  2. Linearly interpolates R/G/B across every character in the visible text

  3. Prepends each character with §x§R§R§G§G§B§B — Spigot’s native 1.16+ hex color format understood by all hologram plugins

Reload command:

  • AnimationManager.reload() — stops all tasks, clears in-memory state, re-reads every .yml from disk, starts fresh loops

  • AnimationCommand — added case "reload" that calls it and sends confirmation

  • AnimationTabCompleter — reload added to the subcommands list

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 691
src/main/java/com/optionanimation/OptionAnimation.java
package com.optionanimation;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class OptionAnimation extends JavaPlugin {

    private AnimationManager animationManager;

    @Override
    public void onEnable() {
        animationManager = new AnimationManager(this);
        animationManager.loadAll();

        getCommand("openanimation").setExecutor(new AnimationCommand(this));
        getCommand("openanimation").setTabCompleter(new AnimationTabCompleter(this));

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new AnimationExpansion(this).register();
            getLogger().info("PlaceholderAPI found — registered %optionanim_<name>% placeholder.");
        }

        getLogger().info("OptionAnimation enabled. Loaded " + animationManager.getAnimationNames().size() + " animation(s).");
    }

    @Override
    public void onDisable() {
        animationManager.stopAll();
        getLogger().info("OptionAnimation disabled. All animation tasks stopped.");
    }

    public AnimationManager getAnimationManager() {
        return animationManager;
    }
}