N

Create a Minecraft 1.21.8 plugin called “Purpur”, the concept of which will revolve around a new item 'Glowing Brush'. If you paint a chest with this brush and then the player who last took something from it, they will glow. To craft it, you’ll need to combine the brush with glowing ink on top, bottom and sides

Kodari AI
KodariMay 1 at 11:56 pm 9,887 (v2)

I’ll create a Minecraft plugin that introduces a Glowing Brush item which can paint chests to track and glow the last player who took items from them.

Purpur
A unique chest tracking plugin featuring the Glowing Brush item. Paint chests with this special brush to automatically apply a glowing effect to the last player who removes items from them. The brush is crafted by surrounding a regular brush with glow ink sacs in a cross pattern. Perfect for catching thieves or monitoring chest access in creative ways.
N

If this player was the last one to take items from or put resources into the chest, then they get highlighted. If not, they don’t.

Kodari AI
KodariMay 2 at 12:12 am 34,149 (v2)

I need to read the current implementation to understand how to modify the logic.

I’ll modify the logic so that:

  1. The chest tracks the last player who interacted with it (taking or putting items)

  2. When a player interacts, they only glow if they were the LAST person to interact with that chest

  3. After checking, update them as the new last interactor

All files have been created! The plugin is now complete with the updated logic:

Key Changes Made:

  • Modified ChestInventoryListener to track the last player who interacted with a painted chest (both taking AND putting items)

  • Only applies the glow effect if the current player matches the last player who interacted

  • Stores the last interacting player’s UUID in the chest’s persistent data container

How it works:

  1. Craft the Glowing Brush by surrounding a regular brush with glow ink sacs in a cross pattern (top, bottom, left, right)

  2. Right-click a chest with the Glowing Brush to paint it

  3. When a player takes or puts items in the painted chest, their UUID is stored

  4. When any player opens the chest again, if they were the last one to interact with it, they glow for 30 seconds

  5. If they weren’t the last player, nothing happens

The plugin supports chests, trapped chests, barrels, and ender chests!

N

It should work so that you tap the chest you want, and then tap a player; if that player wasn't the last one to take items from it or put items in it, nothing happens, but if they were, that player's name will be highlighted

Kodari AI
KodariMay 2 at 12:19 am 17,980 (v2)

I need to read the current implementation to understand the complete rewrite needed.

I understand now! The workflow should be:

  1. Right-click a chest with the brush to select it

  2. Right-click a player with the brush to check if they were the last one to interact with that chest

  3. If they were, they glow; if not, nothing happens

Let me rewrite the listeners to implement this two-step targeting system:

Perfect! I’ve completely rewritten the plugin to work with a two-step targeting system:

How it now works:

  1. Chests auto-paint: Any chest/barrel/ender chest automatically becomes “painted” when first opened (no manual painting needed)

  2. Select a chest: Right-click a chest with the Glowing Brush to select it as your target

  3. Check a player: Right-click any player with the brush to check if they were the last to interact with the selected chest

  4. Results:

    • ✓ If they WERE the last person → They glow for 30 seconds + you both get messages

    • ✗ If they were NOT → You get a negative message, nothing happens to them

Tracking:

  • Chests track the last player who took OR put items in them

  • The brush checks this stored UUID when you tap a player

  • Selection is cleared after each check

The plugin now perfectly implements the detective/investigation gameplay you wanted!

N

Accept any messages in the chat. And make sure it’s not just a matter of clicking on players and storage units, but that the brush animation plays when you drag it over suspicious gravel.

Kodari AI
KodariMay 2 at 12:28 am 40,600 (v2)

I need to read the current implementation to add the brushing animation mechanic and chat message acceptance.

I’ll add brush animations (like suspicious gravel) and make all messages configurable in the config.

All files have been updated! The plugin now includes:

✅ Brushing Animation System - When you right-click suspicious gravel with the Glowing Brush, it plays the vanilla brushing animation with particles and sounds for 3 seconds ✅ Configurable Messages - All messages are now in config.yml and support color codes (&) and the {player} placeholder ✅ Two-Step Detection System:

  1. Right-click a chest to select it

  2. Right-click a player to check if they were the last to interact

  3. If they were, they glow; if not, nothing happens

The brushing animation uses the vanilla Minecraft 1.21 brush mechanics with the SCRAPE particle effect and ITEM_BRUSH_BRUSHING_GRAVEL sound, making it feel authentic to the game!

N

No, the animation should be the same as when you rub the suspicious gravel when you search a chest or a player

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 772
src/main/java/com/purpur/plugin/Purpur.java
package com.purpur.plugin;

import com.purpur.plugin.item.GlowingBrush;
import com.purpur.plugin.listener.ChestInteractListener;
import com.purpur.plugin.listener.ChestInventoryListener;
import com.purpur.plugin.manager.BrushAnimationManager;
import com.purpur.plugin.manager.PaintedChestManager;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

public class Purpur extends JavaPlugin {
    
    private PaintedChestManager paintedChestManager;
    private BrushAnimationManager brushAnimationManager;
    private NamespacedKey glowingBrushKey;
    private NamespacedKey paintedChestKey;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.glowingBrushKey = new NamespacedKey(this, "glowing_brush");
        this.paintedChestKey = new NamespacedKey(this, "painted_chest");
        this.paintedChestManager = new PaintedChestManager(this);
        this.brushAnimationManager = new BrushAnimationManager(this);
        
        registerRecipe();
        registerListeners();
        
        getLogger().info("Purpur plugin enabled!");
    }
    
    @Override
    public void onDisable() {
        brushAnimationManager.cancelAll();
        getLogger().info("Purpur plugin disabled!");
    }
    
    private void registerRecipe() {
        ShapedRecipe recipe = GlowingBrush.createRecipe(this);
        if (recipe != null) {
            Bukkit.addRecipe(recipe);
            getLogger().info("Glowing Brush recipe registered!");
        }
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new ChestInteractListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ChestInventoryListener(this), this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("glowingbrush")) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("Only players can use this command!");
                return true;
            }
            
            Player player = (Player) sender;
            player.getInventory().addItem(GlowingBrush.create(this));
            player.sendMessage("§aYou received a Glowing Brush!");
            return true;
        }
        return false;
    }
    
    public PaintedChestManager getPaintedChestManager() {
        return this.paintedChestManager;
    }
    
    public NamespacedKey getGlowingBrushKey() {
        return this.glowingBrushKey;
    }
    
    public NamespacedKey getPaintedChestKey() {
        return this.paintedChestKey;
    }
    
    public BrushAnimationManager getBrushAnimationManager() {
        return this.brushAnimationManager;
    }
}