MINI ZERO

ZeroRitual – Advanced Minecraft Ritual Plugin

Platform: Paper 1.21.11 Plugin Name: ZeroRitual

Create a fully functional, advanced Minecraft ritual plugin for Paper 1.21.11.

  1. Ritual Creation (Operator Only)
  • Only OP players can create rituals.
  • Command: "/zeroritual <time>"
  • The player must hold an item in their main hand.
  • The entire held item, including its custom name, enchantments, lore, attributes, and other metadata, must be converted into a ritual.
  • The item must disappear from the player's inventory when the ritual starts.
  • The time argument determines the ritual duration in seconds or minutes.
  • Example: "/zeroritual 300" starts a 300-second ritual.
  1. Ritual BossBar

Display a live BossBar to every online player.

The BossBar must show:

  • Name of the ritual item.
  • Remaining ritual time.
  • Ritual coordinates (X, Y, Z).

Example: "SWORD SMP | DIAMOND SWORD | 04:59 | X: 120 Y: 65 Z: -240"

Requirements:

  • Update every second.
  • Show accurate countdown.
  • Remove the BossBar when the ritual ends.
  • Never disappear while the ritual is active.
  1. Global Ritual Announcement

Immediately after a ritual starts, announce it to every online player.

Example:

"SWORD SMP" "A NEW RITUAL HAS STARTED!" "ITEM: DIAMOND SWORD" "LOCATION: X: 120 Y: 65 Z: -240" "TIME: 05:00"

Keep the ritual's item name, coordinates, and remaining time visible to everyone throughout the ritual using the BossBar and a suitable additional display if needed.

  1. Ritual Item Display
  • Display the actual ritual item at the ritual location.
  • Make it visually attractive using floating item entities or an equivalent display.
  • The item must remain at the ritual location until the countdown finishes.
  • Prevent players from picking it up before the ritual ends.
  • Preserve the complete original item data.
  1. Circular Particle Effects

Create a continuous circular particle animation around the ritual item.

Requirements:

  • Particles should rotate around the item.
  • Use attractive particles such as END_ROD, SOUL_FIRE_FLAME, ENCHANT, and PORTAL.
  • Create multiple circular particle layers.
  • Keep the animation running until the ritual ends.
  • Make the circle centered perfectly around the ritual item.
  1. Ritual Difficulty – Mob Waves

Make every ritual challenging and dangerous.

During the ritual, periodically summon:

  • Charged Creepers.
  • Skeletons.
  • Zombies.
  • Spiders.
  • Other suitable hostile mobs.

Requirements:

  • Mobs should spawn around the ritual location.
  • Make them attack nearby players.
  • Spawn mobs in waves throughout the countdown.
  • Charged Creepers should appear occasionally as rare threats.
  • Prevent mobs from spawning inside blocks or in unsafe locations.
  • Clean up ritual-related mobs when the ritual ends.
  1. Lightning Effects
  • Periodically summon lightning around the ritual area.
  • Lightning should create dramatic visual effects.
  • Avoid damaging the ritual item.
  • Make lightning part of the ritual's atmosphere.
  1. Ritual Completion

When the countdown reaches zero:

  • Stop all particle animations.
  • Stop the BossBar.
  • Stop mob spawning.
  • Broadcast a global completion announcement.
  • Drop the original ritual item naturally on the ground at the ritual location.
  • Make the item available for players to collect.
  • Preserve all item metadata, enchantments, custom names, and lore.

Completion announcement:

"SWORD SMP" "RITUAL COMPLETED!" "ITEM: [ITEM NAME]" "LOCATION: X: 120 Y: 65 Z: -240" "THE ITEM HAS BEEN RELEASED!"

  1. Additional Commands
  • "/zeroritual <time>" – Start a ritual using the item in the operator's hand.
  • "/zeroritual cancel" – Cancel the active ritual (OP only).
  • "/zeroritual reload" – Reload configuration (OP only).
  1. Technical Requirements
  • Fully compatible with Paper 1.21.11.
  • Java plugin, not Skript.
  • Use Adventure API for messages and BossBar.
  • Use efficient scheduled tasks.
  • Support custom-named and enchanted items.
  • Correctly handle server restarts and ritual state.
  • Prevent item duplication and loss.
  • Only one active ritual at a time.
  • Save ritual information safely.
  • Provide configurable mob waves, particle effects, lightning frequency, and spawn radius in config.yml.
  • Include permissions and proper command handling.
  • No console errors or memory leaks.

Final Goal

Create a polished, production-ready plugin called ZeroRitual with an exciting SMP event experience. The ritual should feel like a rare, dangerous world event where every player receives the announcement, sees the countdown and coordinates, and fights hostile mobs to obtain the final released item.

Kodari AI
KodariNov 3 at 6:10 am 2
ZeroRitual
A Paper 1.21.11 plugin that transforms held items into dangerous world events. Operators start rituals via /zeroritual command, converting their held item into a floating display at the ritual location. The plugin broadcasts global announcements, shows a live BossBar countdown with coordinates to all players, and creates rotating circular particle effects. Hostile mob waves spawn around the ritual site while lightning strikes periodically. When the countdown ends, the original item drops naturally for players to collect. Features configurable mob waves, particle effects, lightning frequency, and spawn radius. Includes cancel/reload commands, Adventure API integration, and safe ritual state persistence.
  1. Create the ritual command, persistent state, and restart recovery.

  2. Add the global boss bar, item display, effects, and configurable mob waves.

  3. Add the Paper plugin configuration and permissions.

Created ZeroRitual with ritual commands, boss bars, item displays, configurable effects and mob waves, and restart recovery.

Limitation: Item transfer is not transactional across crashes, so duplication or loss cannot be ruled out during a server crash at ritual start or release. The plugin should not yet be considered production-ready.

MINI ZERO

Add a thing in it annusment when ritual start annusment the cords and ritual time

Kodari AI
KodariNov 3 at 6:05 pm 1

Ritual start announcements already show all online players the coordinates and ritual time, along with the item name.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 387
src/main/java/com/zeroritual/ZeroRitual.java
package com.zeroritual;

import com.cryptomorin.xseries.particles.XParticle;
import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemDisplay;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;

public final class ZeroRitual extends JavaPlugin implements Listener {
    private ItemStack item;
    private Location location;
    private long endTime;
    private long durationMillis;
    private BossBar bar;
    private ItemDisplay display;
    private BukkitTask task;
    private final List<Mob> mobs = new ArrayList<>();
    private long ticks;
    private long nextWave;
    private long nextLightning;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        Bukkit.getPluginManager().registerEvents(this, this);
        loadRitual();
    }

    @Override
    public void onDisable() {
        if (item != null) {
            saveRitual();
            cleanup();
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player) || !player.isOp() || !player.hasPermission("zeroritual.admin")) {
            sender.sendMessage(Component.text("Only operators can manage rituals.", NamedTextColor.RED));
            return true;
        }
        if (args.length != 1) {
            player.sendMessage(Component.text("Usage: /zeroritual <seconds|1m|cancel|reload>", NamedTextColor.RED));
            return true;
        }
        if (args[0].equalsIgnoreCase("reload")) {
            reloadConfig();
            player.sendMessage(Component.text("Configuration reloaded.", NamedTextColor.GREEN));
            return true;
        }
        if (args[0].equalsIgnoreCase("cancel")) {
            if (item == null) player.sendMessage(Component.text("There is no active ritual.", NamedTextColor.RED));
            else finish(false);
            return true;
        }
        if (item != null) {
            player.sendMessage(Component.text("A ritual is already active.", NamedTextColor.RED));
            return true;
        }
        long seconds;
        try {
            String input = args[0].toLowerCase(Locale.ROOT);
            long multiplier = input.endsWith("m") ? 60 : 1;
            if (input.endsWith("m") || input.endsWith("s")) input = input.substring(0, input.length() - 1);
            seconds = Math.multiplyExact(Long.parseLong(input), multiplier);
            if (seconds < 1 || seconds > 604800) throw new NumberFormatException();
        } catch (NumberFormatException | ArithmeticException ex) {
            player.sendMessage(Component.text("Enter a duration from 1 second to 7 days, such as 300 or 5m.", NamedTextColor.RED));
            return true;
        }
        ItemStack held = player.getInventory().getItemInMainHand();
        if (held.getType().isAir() || held.getAmount() <= 0) {
            player.sendMessage(Component.text("Hold an item in your main hand.", NamedTextColor.RED));
            return true;
        }
        item = held.clone();
        location = player.getLocation().getBlock().getLocation().add(0.5, 0, 0.5);
        durationMillis = seconds * 1000L;
        endTime = System.currentTimeMillis() + durationMillis;
        if (!saveRitual()) {
            item = null;
            location = null;
            player.sendMessage(Component.text("Could not save the ritual; your item was not taken.", NamedTextColor.RED));
            return true;
        }
        player.getInventory().setItemInMainHand(null);
        startVisuals();
        announce(true, false);
        return true;
    }

    private void startVisuals() {
        ticks = 0;
        nextWave = Math.max(1, getConfig().getLong("waves.interval-seconds", 30)) * 20;
        nextLightning = Math.max(1, getConfig().getLong("lightning.interval-seconds", 15)) * 20;
        display = location.getWorld().spawn(location.clone().add(0, 1.2, 0), ItemDisplay.class, entity -> {
            entity.setItemStack(item.clone());
            entity.setPersistent(false);
            entity.setInvulnerable(true);
        });
        bar = BossBar.bossBar(Component.empty(), 1f, BossBar.Color.PURPLE, BossBar.Overlay.PROGRESS);
        updateBar();
        for (Player player : Bukkit.getOnlinePlayers()) player.showBossBar(bar);
        task = Bukkit.getScheduler().runTaskTimer(this, this::tick, 1L, 1L);
    }

    private void tick() {
        ticks++;
        if (System.currentTimeMillis() >= endTime) {
            finish(true);
            return;
        }
        if (ticks % 20 == 0) updateBar();
        if (getConfig().getBoolean("particles.enabled", true) && ticks % Math.max(1, getConfig().getInt("particles.interval-ticks", 5)) == 0) particles();
        if (ticks >= nextWave) {
            nextWave = ticks + Math.max(1, getConfig().getLong("waves.interval-seconds", 30)) * 20;
            if (getConfig().getBoolean("waves.enabled", true)) spawnWave();
        }
        if (ticks >= nextLightning) {
            nextLightning = ticks + Math.max(1, getConfig().getLong("lightning.interval-seconds", 15)) * 20;
            if (getConfig().getBoolean("lightning.enabled", true)) lightning();
        }
    }

    private void updateBar() {
        long remaining = Math.max(0, (endTime - System.currentTimeMillis() + 999) / 1000);
        bar.name(Component.text(getConfig().getString("announcement-title", "SWORD SMP") + " | ", NamedTextColor.LIGHT_PURPLE)
                .append(itemName()).append(Component.text(" | " + formatTime(remaining) + " | " + coordinates(), NamedTextColor.WHITE)));
        bar.progress((float) Math.max(0, Math.min(1, (double) (endTime - System.currentTimeMillis()) / durationMillis)));
    }

    private void particles() {
        List<String> types = getConfig().getStringList("particles.types");
        if (types.isEmpty()) return;
        int points = Math.max(1, Math.min(100, getConfig().getInt("particles.points", 24)));
        double radius = Math.max(0.1, Math.min(32, getConfig().getDouble("particles.radius", 2)));
        for (int layer = 0; layer < types.size() && layer < 8; layer++) {
            final int currentLayer = layer;
            XParticle.of(types.get(layer)).ifPresent(particle -> {
                for (int i = 0; i < points; i++) {
                    double angle = Math.PI * 2 * i / points + ticks * 0.04 * (currentLayer % 2 == 0 ? 1 : -1);
                    Location at = location.clone().add(Math.cos(angle) * radius, 0.35 + currentLayer * 0.45, Math.sin(angle) * radius);
                    location.getWorld().spawnParticle(particle.get(), at, 1, 0, 0, 0, 0);
                }
            });
        }
    }

    private void spawnWave() {
        mobs.removeIf(mob -> !mob.isValid() || mob.isDead());
        List<String> types = getConfig().getStringList("waves.types");
        if (types.isEmpty()) return;
        int count = Math.max(0, Math.min(50, getConfig().getInt("waves.mobs-per-wave", 5)));
        int radius = Math.max(2, Math.min(64, getConfig().getInt("waves.spawn-radius", 8)));
        ThreadLocalRandom random = ThreadLocalRandom.current();
        for (int i = 0; i < count; i++) {
            EntityType type;
            try { type = EntityType.valueOf(types.get(random.nextInt(types.size())).toUpperCase(Locale.ROOT)); }
            catch (IllegalArgumentException ex) { continue; }
            if (!type.isAlive() || !type.isSpawnable() || type.getEntityClass() == null || !Mob.class.isAssignableFrom(type.getEntityClass())) continue;
            Location spawn = safeSpawn(radius);
            if (spawn == null) continue;
            Mob mob = (Mob) spawn.getWorld().spawnEntity(spawn, type);
            mob.setPersistent(false);
            if (mob instanceof Creeper creeper && random.nextDouble() < Math.max(0, Math.min(1, getConfig().getDouble("waves.charged-creeper-chance", 0.08)))) creeper.setPowered(true);
            Player target = null;
            double nearest = 48 * 48;
            for (Player player : spawn.getWorld().getPlayers()) {
                if (player.isDead() || player.getGameMode() == org.bukkit.GameMode.CREATIVE || player.getGameMode() == org.bukkit.GameMode.SPECTATOR) continue;
                double distance = player.getLocation().distanceSquared(spawn);
                if (distance < nearest) { nearest = distance; target = player; }
            }
            if (target != null) mob.setTarget(target);