angad5061
📎 1 file 1,166 chars
📄
pasted-code-1782276352998.txt
txt 27 lines
▶
Create a Minecraft Paper 1.21.11 plugin called "LoreMOTD" that shows an animated MOTD on the server list.

Plugin Requirements:
- Plugin name: LoreMOTD
- Main class: dev.loremotd.plugin.LoreMOTD
- api-version: 1.21
- Java 21, Maven build

MOTD Animation Features:
1. ANIMATED TEXT - Scrolling rainbow/gradient colors cycling every 500ms
2. MOVING SYMBOLS - Decorative symbols like ✦ ✧ ⊱ ⊰ ★ that shift/pulse
3. PARTICLES EFFECT - Fake particle effect using text characters (dots moving)
4. SOUND - Play a sound to player when they join after seeing MOTD
5. TITLE + SUBTITLE popup on join:
   - Title: "✦ Welcome ✦" (gold, bold)
   - Subtitle: "✧ Enjoy your stay ✧" (light purple, italic)
6. ACTION BAR - Animated scrolling text on action bar after join

MOTD Line 1: Rainbow animated server name with moving stars ★
MOTD Line 2: Animated player count display with decorative border

Animation cycles through these colors: GOLD → YELLOW → GREEN → AQUA → LIGHT_PURPLE → RED → back to GOLD

Please:
1. Write all Java source files
2. Write plugin.yml and pom.xml  
3. Compile and provide final LoreMOTD.jar ready for Paper 1.21.4 plugins folder
Kodari AI
KodariJun 24 at 4:47 am 12

Here are all the source files for LoreMOTD. Note: I can write and deliver the complete source — compiling to a .jar requires a local build environment (mvn package), which I’ll walk you through at the end.



Building the JAR

Since you specified Maven, run these commands from the project root (where pom.xml lives):

Shell
# Requires JDK 21 and Maven installed
mvn clean package

The output JAR will be at:

Plain Text
target/LoreMOTD.jar

Drop it into your server’s plugins/ folder and restart. No extra dependencies — Paper bundles Adventure/MiniMessage natively.


What each effect does

Feature
Implementation
Animated MOTD
MOTDAnimator
advances a
frame
counter every 500 ms; each
ServerListPingEvent
call renders the current frame
Rainbow text
Each character of the server name picks
color[(charIndex + frame) % 6]
, creating a wave that marches left→right
Moving symbols
✦ ✧ ⊱ ⊰ ★
rotate through an array each frame so they appear to shift
Particle dots
Four dot patterns (
· ˙ ·
etc.) cycle every frame on MOTD line 2
Title/Subtitle
<gold><bold>
title +
<light_purple><italic>
subtitle via Adventure
Title.title()
Sound
BLOCK_NOTE_BLOCK_PLING
at 1.2 pitch on join (configurable)
Action bar
Per-player
BukkitRunnable
at 1-tick interval; string rotates left each
scroll-speed
ticks to produce a scrolling marquee

All text values and timings are configurable in config.yml — reload with /loremotd reload.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
13 825
src/main/java/dev/loremotd/plugin/LoreMOTD.java
package dev.loremotd.plugin;

import dev.loremotd.plugin.listener.JoinListener;
import dev.loremotd.plugin.listener.MOTDListener;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.NotNull;

public class LoreMOTD extends JavaPlugin implements CommandExecutor {

    private MOTDAnimator motdAnimator;
    private BukkitTask animationTask;

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

        this.motdAnimator = new MOTDAnimator(this);

        getServer().getPluginManager().registerEvents(new MOTDListener(this), this);
        getServer().getPluginManager().registerEvents(new JoinListener(this), this);

        getCommand("loremotd").setExecutor(this);

        startAnimationTask();

        getLogger().info("LoreMOTD enabled — animated MOTD is running.");
    }

    @Override
    public void onDisable() {
        if (animationTask != null) {
            animationTask.cancel();
        }
        getLogger().info("LoreMOTD disabled.");
    }

    private void startAnimationTask() {
        if (animationTask != null) {
            animationTask.cancel();
        }
        int interval = getConfig().getInt("motd.frame-interval", 10);
        animationTask = getServer().getScheduler().runTaskTimer(this, () -> motdAnimator.nextFrame(), interval, interval);
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
            reloadConfig();
            motdAnimator.reload();
            startAnimationTask();
            sender.sendMessage("§aLoreMOTD configuration reloaded.");
            return true;
        }
        sender.sendMessage("§eUsage: /loremotd reload");
        return true;
    }

    public MOTDAnimator getMotdAnimator() {
        return motdAnimator;
    }
}