S

Create a Wireless Totem Detection plugin.

This plugin allows players to "shadow" a Totem of Undying into a barrel. When the player uses a totem in the field, the corresponding "shadow" in the barrel vanishes, allowing for wireless redstone signals across any distance.

How to use:

Open a Barrel.

Shift-Click a Totem of Undying from your inventory (by named Kryzi_ and .Drixzafor, that name is the only one who can use linked it). Totem stays in your inventory, but a "ghost" appears in the barrel.

When your totem pops, the ghost vanishes, triggering your Redstone Comparators!

Features:

Zero Duplication: Secure logic ensures no extra totems are created.

Anti-Grief: The link resets on logout to prevent "ghost" items from staying in the world.

Vanilla Feel: No commands required.

Kodari AI
KodariOct 16 at 2:29 am 2
TotemShadowLink
Wireless totem detection plugin enabling players to link a named Totem of Undying to a barrel. Shift-clicking a totem named Kryzi_ and .Drixzafor creates a ghost item in the barrel while the original stays in inventory. When the player's totem activates, the ghost vanishes, triggering redstone comparators for wireless signals across any distance. Features zero duplication through secure linking logic, anti-grief with automatic link reset on logout, and vanilla feel with no commands required. Uses inventory GUI framework for barrel interaction and event-driven architecture for totem consumption detection.
  1. Create a Paper plugin skeleton with no commands.

  2. Add secure, inventory-backed totem shadows and remove them on totem use or logout.

  3. Protect shadows from inventory transfers and clean orphaned shadows after reloads.

Created the Wireless Totem Detection plugin. Authorized players can shift-click a totem into an open barrel to leave a protected comparator-visible shadow; it disappears when that linked totem pops, the player logs out, or the barrel is broken. Orphaned shadows are cleaned up on chunk load and plugin startup.

Note: Vanilla Minecraft usernames cannot start with a period, so .Drixzafor will not match a standard Java account name.

S

what I mean is that the only player who can link a it to the barrel is a player named Kryzi_ and .Drixzafor

Kodari AI
KodariOct 16 at 2:29 am 1

The plugin already restricts linking to Kryzi_ and .Drixzafor. One caveat: Minecraft usernames can’t contain a period, so .Drixzafor won’t match a normal player account. If the second player’s actual username is Drixzafor (without the dot), tell me and I’ll adjust it.

S

make this plugin doesnt generate any file on the server file. I also want you to change the name of this plugin into VanillaLike plugin with a description "Bringing Vanilla feature to PaperMC" with a author Velrion/Kryzi (one person)

Kodari AI
KodariOct 16 at 2:32 am 1
  1. Keep the plugin free of plugin-generated config or data files; its link tracking is in memory.

  2. Update the plugin metadata to VanillaLike, the requested description, and author Velrion/Kryzi.

Updated the plugin metadata to VanillaLike, description “Bringing Vanilla feature to PaperMC”, and author Velrion/Kryzi.

The plugin creates no separate config or data files. Link tracking stays in memory; the shadow and link marker are stored with the barrel and totem in the normal world data.

S

make sure that the linking will be stay intact even if the server restart or the player leave, the only that makes it unlink is when the totem got popped that link to a certain barrel (thats the only way to unlink it or either destroy the barrel)

Kodari AI
KodariOct 16 at 2:39 am 1

The link now survives player logout and server restarts. Its token ID and barrel location are stored in the totem and shadow’s persistent item data, which is saved with normal player and world data—no separate plugin files are created.

The shadow is removed when its linked totem pops or the barrel is broken.

S

make it that only Kryzi_ and .Drixzafor can link it (Kryzi_ is a cracked/offline account and .Drixzafor is a bedrock account, make it work)

Kodari AI
KodariOct 16 at 2:49 am 1
  1. Keep Kryzi_ authorized by exact username, including offline-mode servers.

  2. Verify the Bedrock player through Floodgate and match their raw gamertag, so the prefix setting does not block .Drixzafor.

  3. Make Floodgate an optional soft dependency; no change to the link persistence behavior.

Linking is now limited to Kryzi_ by username and the Floodgate-verified Bedrock account Drixzafor (including the usual .Drixzafor server prefix). Floodgate is an optional dependency for the plugin, but must be installed on the server for Bedrock account recognition.

On an offline-mode server, usernames aren’t authenticated, so another player could impersonate Kryzi_ by joining with that name.

S

make the totem on the barrel put on the center when it got linked and also make it also when a player open the barrel, it appears no totem inside of it (even the administrator/op can not bypass this, even if they tried to put items on it, it will do nothing, the knly player who can see the shadow totem is the one who linked it)

Kodari AI
KodariOct 16 at 3:43 am 2
  1. Replace the shared barrel screen with a viewer-specific barrel view so only the linker sees the shadow.

  2. Reserve the center slot while linked and block all attempts to move items into or out of it.

  3. Keep the real shadow in the barrel inventory for comparator output and persistent across restarts.

Updated the barrel interface to show the shadow in the center slot only to the player who linked it. Other players—including OPs—see that slot as empty, and clicks, drags, and shift-click transfers cannot put items into it. The real shadow remains in the barrel’s inventory for comparator signals and survives restarts.

S

replace all the files name "Wireless totem" into VanillaLike inside on the file on the plugin (replace the name of file only, make sure that it doednt break anything inside on the plugin)

Kodari AI
KodariOct 16 at 3:59 am 1

Renamed WirelessTotemPlugin.java to VanillaLike.java and updated the Java class name and plugin.yml entry so the plugin still loads correctly. The plugin’s behavior and display metadata are unchanged.

S

I want that this will work on different worlds, whenever you are if the totem pops, it will work

Kodari AI
KodariOct 17 at 2:18 pm 1
  1. Make a successful totem-pop event remove its linked shadow directly, without checking the player’s post-pop inventory.

  2. Resolve the barrel using the link’s stored world and coordinates, independent of the player’s current world.

A totem pop now removes its linked shadow using the barrel’s saved world and coordinates, regardless of which world the player is in. The link is removed on the successful pop, without relying on the player’s post-pop inventory check.

S

Every totem that has been link into a barrel make sure that it has a unique id/tag so that even if the totem has the same name the only totem that will work is the one that has a unique id/tag. I also want you to make this totem will work even you are in differen dimension just like how a fishing rod stasis chamber work.

Kodari AI
KodariOct 19 at 2:37 am 1
  1. Give each linked totem a persistent unique ID and validate that exact ID when it pops.

  2. Keep the link’s barrel destination world-aware so a pop in any dimension removes the matching shadow.

Each linked totem already receives its own persistent UUID tag, and the barrel location includes its world UUID. I updated pop handling so it removes only the shadow matching the totem used—not every linked totem the player is holding. The saved world location lets the removal work when the pop happens in another dimension.

S

Make sure that this still work even if the holder of the totem that has been link into a barrel will still work.

Kodari AI
KodariOct 19 at 2:39 am 1

The linked totem works when another player holds it. Pop handling checks the totem’s unique ID, not the holder’s identity; the saved owner ID only controls who can see the shadow in the barrel. No code change was needed.

S

can you make the totem inside on the barrel replicates what totem I linked into it

Kodari AI
KodariOct 25 at 11:09 pm 1
  • Make the barrel’s protected shadow a clone of the linked totem, preserving its visible name, lore, enchantments, and other item metadata while retaining its shadow-only tag.

The barrel shadow now copies the linked totem’s item appearance and metadata, including its custom name, lore, and enchantments. It keeps a separate shadow tag and does not retain the usable totem’s link tags.

S

and also I wanted you to make the totem linked has its own database without generating a files into the server so that every totem will store into that database so if ever the server restarts, the totem will be still going to be linked without worrying of getting unlinked

Kodari AI
KodariOct 25 at 11:10 pm 1

This is already handled without creating a plugin database file. The linked totem stores its unique ID and barrel location in persistent item data; the barrel’s shadow stores the matching ID. Minecraft saves these with the player and world data, so the link survives restarts and player logout. A separate database file would conflict with your no-plugin-files requirement.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 644
src/main/java/com/kodari/wirelesstotem/VanillaLike.java
package com.kodari.wirelesstotem;

import com.cryptomorin.xseries.XMaterial;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.block.Barrel;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.entity.EntityResurrectEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;
import java.util.UUID;

public final class VanillaLike extends JavaPlugin implements Listener {
    private static final int CENTER_SLOT = 13;

    private NamespacedKey tokenKey;
    private NamespacedKey shadowKey;
    private NamespacedKey locationKey;
    private NamespacedKey ownerKey;

    @Override
    public void onEnable() {
        tokenKey = new NamespacedKey(this, "linked-totem");
        shadowKey = new NamespacedKey(this, "totem-shadow");
        locationKey = new NamespacedKey(this, "totem-location");
        ownerKey = new NamespacedKey(this, "totem-owner");
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onBarrelOpen(InventoryOpenEvent event) {
        if (!(event.getPlayer() instanceof Player player)
                || !(event.getView().getTopInventory().getHolder() instanceof Barrel barrel)) {
            return;
        }

        Block block = barrel.getBlock();
        event.setCancelled(true);
        Bukkit.getScheduler().runTask(this, () -> {
            if (!player.isOnline()) {
                return;
            }
            BlockState state = block.getState();
            if (state instanceof Barrel currentBarrel) {
                player.openInventory(createBarrelView(player, currentBarrel));
            }
        });
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryClick(InventoryClickEvent event) {
        Inventory top = event.getView().getTopInventory();
        if (isShadow(event.getCursor())
                || (event.getAction() == org.bukkit.event.inventory.InventoryAction.COLLECT_TO_CURSOR && containsShadow(top))) {
            event.setCancelled(true);
            return;
        }

        if (isShadow(event.getCurrentItem())) {
            event.setCancelled(true);
            return;
        }

        if (!(top.getHolder() instanceof BarrelView view)) {
            return;
        }

        if (view.linked && event.getRawSlot() == CENTER_SLOT) {
            event.setCancelled(true);
            return;
        }

        if (event.getClickedInventory() != null
                && event.getClickedInventory() != top
                && event.isShiftClick()
                && event.getWhoClicked() instanceof Player player
                && isAllowed(player)
                && isTotem(event.getCurrentItem())) {
            linkTotem(event, player, top, view);
            return;
        }

        if (view.linked && event.getClickedInventory() != top && event.isShiftClick()) {
            shiftIntoBarrelView(event, view);
            return;
        }

        Bukkit.getScheduler().runTask(this, () -> syncBarrelView(view));
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryDrag(InventoryDragEvent event) {
        Inventory top = event.getView().getTopInventory();
        if (isShadow(event.getOldCursor())) {
            event.setCancelled(true);
            return;
        }
        for (int rawSlot : event.getRawSlots()) {
            if (rawSlot >= 0 && rawSlot < top.getSize()
                    && (isShadow(top.getItem(rawSlot))
                    || (top.getHolder() instanceof BarrelView view && view.linked && rawSlot == CENTER_SLOT))) {
                event.setCancelled(true);
                return;
            }
        }
        if (top.getHolder() instanceof BarrelView view) {
            Bukkit.getScheduler().runTask(this, () -> syncBarrelView(view));
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryMove(InventoryMoveItemEvent event) {
        if (isShadow(event.getItem())) {
            event.setCancelled(true);
        }
    }

    @EventHandler(ignoreCancelled = true)
    public void onInventoryPickup(InventoryPickupItemEvent event) {
        Item item = event.getItem();
        if (isShadow(item.getItemStack())) {
            event.setCancelled(true);
        }
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onTotemPop(EntityResurrectEvent event) {
        if (!(event.getEntity() instanceof Player player)) {
            return;
        }
        ItemStack usedTotem = isTotem(player.getInventory().getItemInMainHand())
                ? player.getInventory().getItemInMainHand()
                : player.getInventory().getItemInOffHand();
        UUID token = readToken(usedTotem, tokenKey);
        LinkLocation location = readLocation(usedTotem);
        if (token == null || location == null) {
            return;
        }

        Bukkit.getScheduler().runTask(this, () -> removeShadow(location, token));
    }

    @EventHandler(ignoreCancelled = true)
    public void onBarrelBreak(BlockBreakEvent event) {
        BlockState state = event.getBlock().getState();
        if (state instanceof Barrel barrel) {
            LinkLocation location = locationOf(event.getBlock());
            closeBarrelViews(location);
            Inventory inventory = barrel.getInventory();
            for (int slot = 0; slot < inventory.getSize(); slot++) {
                if (isShadow(inventory.getItem(slot))) {
                    inventory.setItem(slot, null);
                }
            }
        }
    }

    private void linkTotem(InventoryClickEvent event, Player player, Inventory viewInventory, BarrelView view) {
        event.setCancelled(true);
        Barrel barrel = findBarrel(view.location);
        if (barrel == null) {
            player.sendMessage("§e[Wireless Totem] §cThat barrel is no longer available.");
            return;
        }

        Inventory barrelInventory = barrel.getInventory();
        moveShadowToCenter(barrelInventory);
        if (isShadow(barrelInventory.getItem(CENTER_SLOT))) {
            player.sendMessage("§e[Wireless Totem] §cThis barrel already has a linked totem.");
            return;
        }

        ItemStack source = event.getCurrentItem().clone();
        if (source.getAmount() != 1) {
            player.sendMessage("§e[Wireless Totem] §cLink one Totem of Undying at a time.");
            return;
        }