Alim Kegaduev

Plintus Visuals

Kodari AI
KodariOct 29 at 8:36 am 1
PlintusVisuals
PlintusVisuals is a Minecraft plugin that provides an advanced visual effects system for enhancing player experiences. It offers customizable particle effects, dynamic lighting systems, and immersive visual feedback for game events. The plugin includes configurable particle emitters, color-shifting aura effects, and interactive visual responses to player actions. Administrators can define custom visual profiles, trigger effects through commands or events, and manage performance through adjustable particle density settings. The system supports multiple effect layers, smooth transitions, and real-time preview capabilities for testing visual configurations before deployment.
  • Create the Gradle project and plugin metadata for Plintus Visuals.

  • Add a configurable particle-trail toggle with /visuals and /visuals reload.

  • Set up permission checks and cleanup when the plugin disables.

Created Plintus Visuals with configurable XSeries particle trails. Players can toggle their trail with /visuals; admins can reload the config with /visuals reload.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 159
src/main/java/com/plintus/visuals/PlintusVisualsPlugin.java
package com.plintus.visuals;

import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public final class PlintusVisualsPlugin extends JavaPlugin {
    private final Set<UUID> trailPlayers = new HashSet<>();
    private XParticle trailParticle;
    private BukkitTask trailTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadTrailParticle();
        trailTask = Bukkit.getScheduler().runTaskTimer(this, this::spawnTrails, 0L, 5L);
    }

    @Override
    public void onDisable() {
        if (trailTask != null) {
            trailTask.cancel();
        }
        trailPlayers.clear();
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
            if (!sender.hasPermission("plintusvisuals.reload")) {
                sendConfiguredMessage(sender, "messages.no-permission");
                return true;
            }

            reloadConfig();
            loadTrailParticle();
            sendConfiguredMessage(sender, "messages.reloaded");
            return true;
        }

        if (args.length > 0) {
            sendConfiguredMessage(sender, "messages.usage");
            return true;
        }

        if (!(sender instanceof Player player)) {
            sendConfiguredMessage(sender, "messages.players-only");
            return true;
        }

        if (!player.hasPermission("plintusvisuals.use")) {
            sendConfiguredMessage(sender, "messages.no-permission");
            return true;
        }

        if (trailPlayers.add(player.getUniqueId())) {
            sendConfiguredMessage(sender, "messages.enabled");
        } else {
            trailPlayers.remove(player.getUniqueId());
            sendConfiguredMessage(sender, "messages.disabled");
        }
        return true;
    }

    private void spawnTrails() {
        if (trailParticle == null) {
            return;
        }

        for (UUID playerId : trailPlayers) {
            Player player = Bukkit.getPlayer(playerId);
            if (player == null) {
                continue;
            }

            Location location = player.getLocation().add(0, 0.1, 0);
            player.getWorld().spawnParticle(trailParticle.get(), location, 1, 0.12, 0.08, 0.12, 0);
        }
    }

    private void loadTrailParticle() {
        String particleName = getConfig().getString("trail.particle", "FLAME");
        trailParticle = XParticle.of(particleName).orElse(null);
        if (trailParticle == null) {
            getLogger().warning("Unknown trail particle '" + particleName + "'; trails are disabled until a valid particle is configured.");
        }
    }

    private void sendConfiguredMessage(CommandSender sender, String path) {
        String message = getConfig().getString(path, "");
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
    }
}