brenqzy
📎 1 file 1,807 chars
📄
pasted-code-1772217768599.txt
txt 49 lines
▶
Create a Minecraft Spigot (or Paper) plugin for version 1.20+.

Plugin name: BrenqzyParlama

Core Functionality:
- Admins can set a specific item as the "glow item".
- Any player who has that item anywhere in their inventory (not just main hand) will receive the glowing effect.
- If the player no longer has the item in their inventory, the glowing effect is removed.
- The glowing effect must use PotionEffectType.GLOWING.
- The glow status must update automatically using a repeating Bukkit task.

Coordinates Feature:
- When a player is glowing because of the item:
    - Their current coordinates (X, Y, Z) should be displayed.
    - The coordinates should update in real time.
- Provide two display modes:
    1) Send coordinates periodically in chat.
    2) Display coordinates in a BossBar.
- Add a config option to choose the display mode:
    display-mode: CHAT or BOSSBAR
- BossBar must update smoothly and disappear when the player stops glowing.

Implementation Requirements:
- Use a repeating Bukkit task to:
    - Check all online players' inventories.
    - Apply/remove glowing effect.
    - Update coordinates display.
- The task must be efficient and not cause lag.
- Properly compare items (Material + ItemMeta if available).
- Save the selected item in config.yml so it persists after restart.
- Handle server reload safely.
- Remove glow and BossBar cleanly when needed.

Commands:
- /setglowitem → Sets the item in the admin’s main hand as the glow item.
- /clearglowitem → Removes the configured glow item.

Permissions:
- glowitem.admin → Required to use both commands.

Provide:
- Main plugin class
- Command executor
- Repeating inventory check task
- BossBar manager class
- plugin.yml
- config.yml example
- Clean, well-structured Java code
- Comments explaining important logic
Kodari AI
KodariFeb 27 at 6:45 pm 22,984 (v2)

I’ll create a Minecraft Spigot plugin for tracking players with a specific glow item.

BrenqzyParlama
A comprehensive player tracking plugin that applies glowing effects to players carrying a specific admin-defined item. Features real-time coordinate display via chat or BossBar, automatic inventory monitoring, and efficient task-based scanning. Supports full item metadata matching including display names, lore, enchantments, and custom model data for precise item identification.

Let me create the plugin structure:

Now I’ll create all the necessary files for the plugin:

Plugin created successfully! Here’s what was implemented:

Core Features:

  • Admin sets glow item with /setglowitem (item in main hand)

  • Players with that exact item in inventory receive glowing effect via XPotion

  • Automatic inventory scanning via efficient BukkitRunnable task

  • Precise item matching: Material, display name, lore, enchantments, and custom model data

Coordinate Display:

  • BOSSBAR mode: Real-time updating yellow BossBar with coordinates

  • CHAT mode: Periodic chat messages (configurable interval)

  • BossBar automatically removed when player stops glowing or quits

Configuration:

  • display-mode: BOSSBAR or CHAT

  • update-interval: Task frequency in ticks (default 20 = 1 second)

  • chat-message-interval: How often to send chat messages (default every 5 task runs)

  • glow-item: Automatically saved/loaded ItemStack

Commands & Permissions:

  • /setglowitem - Requires glowitem.admin

  • /clearglowitem - Requires glowitem.admin

The plugin uses XSeries for cross-version compatibility and properly handles cleanup on disable and player quit.

brenqzy

can you make it so other players can see the glowing players coordinates on the bossbar?

Kodari AI
KodariFeb 27 at 6:55 pm 16,552 (v2)

I’ll modify the plugin so

Done! Now when a player has the glow item, all other online players will see boss bars showing that glowing player’s name and coordinates in real-time.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 475
src/main/java/com/brenqzy/parlama/BrenqzyParlama.java
package com.brenqzy.parlama;

import com.brenqzy.parlama.commands.GlowItemCommand;
import com.brenqzy.parlama.listeners.PlayerQuitListener;
import com.brenqzy.parlama.managers.GlowBossBarManager;
import com.brenqzy.parlama.tasks.GlowCheckTask;
import com.cryptomorin.xseries.XPotion;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;

@Getter
public class BrenqzyParlama extends JavaPlugin {
    private ItemStack glowItem;
    private GlowBossBarManager bossBarManager;
    private BukkitTask glowTask;
    private PotionEffectType glowingEffectType;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        XPotion.matchXPotion("GLOWING").ifPresent(xp -> {
            glowingEffectType = xp.getPotionEffectType();
        });
        
        if (glowingEffectType == null) {
            getLogger().severe("GLOWING effect not available! Plugin disabled.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        
        loadGlowItemFromConfig();
        
        bossBarManager = new GlowBossBarManager();
        
        GlowItemCommand commandExecutor = new GlowItemCommand(this);
        getCommand("setglowitem").setExecutor(commandExecutor);
        getCommand("clearglowitem").setExecutor(commandExecutor);
        
        Bukkit.getPluginManager().registerEvents(new PlayerQuitListener(this), this);
        
        startGlowTask();
        
        getLogger().info("BrenqzyParlama has been enabled!");
    }

    @Override
    public void onDisable() {
        if (glowTask != null) {
            glowTask.cancel();
        }
        
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (player.hasPotionEffect(glowingEffectType)) {
                player.removePotionEffect(glowingEffectType);
            }
        }
        
        bossBarManager.removeAll();
        
        getLogger().info("BrenqzyParlama has been disabled!");
    }

    public void loadGlowItemFromConfig() {
        if (getConfig().contains("glow-item")) {
            glowItem = getConfig().getItemStack("glow-item");
            getLogger().info("Loaded glow item from config: " + (glowItem != null ? glowItem.getType() : "null"));
        }
    }

    public void saveGlowItemToConfig() {
        if (glowItem != null) {
            getConfig().set("glow-item", glowItem);
        } else {
            getConfig().set("glow-item", null);
        }
        saveConfig();
    }

    public void setGlowItem(ItemStack item) {
        this.glowItem = item;
        saveGlowItemToConfig();
    }

    public void clearGlowItem() {
        this.glowItem = null;
        saveGlowItemToConfig();
        
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (player.hasPotionEffect(glowingEffectType)) {
                player.removePotionEffect(glowingEffectType);
            }
        }
        
        bossBarManager.removeAll();
    }

    private void startGlowTask() {
        int interval = getConfig().getInt("update-interval", 20);
        glowTask = new GlowCheckTask(this).runTaskTimer(this, 0L, interval);
    }

    public void restartGlowTask() {
        if (glowTask != null) {
            glowTask.cancel();
        }
        startGlowTask();
    }
}