polecam czarek

written in Java, with all the files, ready to compile, not just sample code. Include: custom totems with unique appearances, names, lore, and internal IDs. Effects: fire totem sets nearby mobs on fire. Ice totem slows enemies. Void totem teleports safely and heals, king totem heals more and regenerates, blood moon totem works like a normal totem but gives strength for ten seconds. Additional independent drops: normal totem of undying 0.5 percent, end crystal 1 percent, obsidian 5 percent one to three pieces, creepers drop two to four extra gunpowder. All drops are independent, so they can stack. Add a config file for all chances and effect times. Target Paper 1.21.4, Java 21, full Maven project with plugin yml, and instructions to compile and install. That gives the AI everything it needs.

Kodari AI
KodariOct 21 at 3:30 pm 2
TotemTrove
TotemTrove is a Paper 1.21.4 Minecraft plugin that introduces five unique custom totems with distinct appearances, names, lore, and internal IDs. Each totem provides a unique effect when activated: Fire totem ignites nearby mobs, Ice totem slows enemies, Void totem teleports the user to safety and heals, King totem provides enhanced healing and regeneration, and Blood Moon totem grants temporary strength. The plugin also adds independent drops for vanilla totems, end crystals, obsidian, and extra gunpowder from creepers, all configurable via a YAML file. Built with Maven and Java 21, it includes a plugin.yml and comprehensive installation instructions.
  1. Create the Maven project for Paper 1.21.4 and Java 21.

  2. Implement five uniquely identified custom totems, resurrection effects, and the give command.

  3. Add configurable, independent mob drops and effect settings.

  4. Include plugin metadata and Kodari compile/install instructions.

Created the complete Paper 1.21.4 / Java 21 Maven project, including the plugin, configuration, metadata, and README.

The five custom totems have distinct persistent IDs and custom model data, with fire, ice, void, king, and blood moon resurrection effects. Non-player mob drops use separate chance rolls for totems, end crystals, and obsidian; creepers also receive extra gunpowder. /customtotem give is included.

To compile in Kodari, click Compile (on phone: ⋮ → Compile Project), then click Compile in the window and download the successful build. Install the JAR in the Paper server’s plugins folder and restart.

Custom model data values are configured, but distinct artwork requires matching models in a resource pack. Texture generation is disabled for this project; enable it in project settings → Generation, or for all projects at https://kodari.ai/settings?tab=features.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
5 497
src/main/java/dev/kodari/customtotems/CustomTotemsPlugin.java
package dev.kodari.customtotems;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XPotion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityResurrectEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;

public final class CustomTotemsPlugin extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
    private static final Set<String> HAZARDOUS_BLOCKS = Set.of(
            "CACTUS", "CAMPFIRE", "FIRE", "MAGMA_BLOCK", "SOUL_CAMPFIRE", "SWEET_BERRY_BUSH", "WITHER_ROSE"
    );

    private NamespacedKey totemIdKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        totemIdKey = new NamespacedKey(this, "totem_id");
        getServer().getPluginManager().registerEvents(this, this);

        if (getCommand("customtotem") == null) {
            getLogger().severe("The customtotem command is missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getCommand("customtotem").setExecutor(this);
        getCommand("customtotem").setTabCompleter(this);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onPlayerResurrect(EntityResurrectEvent event) {
        if (!(event.getEntity() instanceof Player player)) {
            return;
        }
        ItemStack item = event.getHand() == EquipmentSlot.OFF_HAND
                ? player.getInventory().getItemInOffHand()
                : player.getInventory().getItemInMainHand();
        String id = getTotemId(item);

        if (id == null && event.getHand() == null) {
            id = getTotemId(player.getInventory().getItemInOffHand());
        }

        TotemType type = TotemType.fromId(id);
        if (type == null) {
            return;
        }

        getServer().getScheduler().runTask(this, () -> {
            if (player.isOnline()) {
                applyTotemEffect(player, type);
            }
        });
    }

    @EventHandler
    public void onEntityDeath(EntityDeathEvent event) {
        Entity entity = event.getEntity();
        if (entity instanceof Player) {
            return;
        }

        if (rollChance(getConfig().getDouble("additional-drops.normal-totem.chance-percent", 0.5))) {
            drop(entity, createVanillaItem("TOTEM_OF_UNDYING", 1));
        }
        if (rollChance(getConfig().getDouble("additional-drops.end-crystal.chance-percent", 1.0))) {
            drop(entity, createVanillaItem("END_CRYSTAL", 1));
        }
        if (rollChance(getConfig().getDouble("additional-drops.obsidian.chance-percent", 5.0))) {
            int amount = randomAmount(
                    getConfig().getInt("additional-drops.obsidian.minimum-amount", 1),
                    getConfig().getInt("additional-drops.obsidian.maximum-amount", 3)
            );
            drop(entity, createVanillaItem("OBSIDIAN", amount));
        }

        if ("CREEPER".equals(entity.getType().name())) {
            int amount = randomAmount(
                    getConfig().getInt("additional-drops.creeper-gunpowder.minimum-extra", 2),
                    getConfig().getInt("additional-drops.creeper-gunpowder.maximum-extra", 4)
            );
            drop(entity, createVanillaItem("GUNPOWDER", amount));
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length < 3 || !args[0].equalsIgnoreCase("give")) {
            sender.sendMessage(color("&cUsage: /customtotem give <player> <fire|ice|void|king|blood_moon> [amount]"));
            return true;
        }

        Player target = Bukkit.getPlayerExact(args[1]);
        if (target == null) {
            sender.sendMessage(color("&cThat player is not online."));
            return true;
        }

        TotemType type = TotemType.fromId(args[2].toLowerCase(Locale.ROOT));
        if (type == null) {
            sender.sendMessage(color("&cUnknown totem type. Use fire, ice, void, king, or blood_moon."));
            return true;
        }

        int amount = 1;
        if (args.length >= 4) {
            try {
                amount = Integer.parseInt(args[3]);
            } catch (NumberFormatException exception) {
                sender.sendMessage(color("&cAmount must be a number from 1 to 64."));
                return true;
            }
        }
        if (amount < 1 || amount > 64) {
            sender.sendMessage(color("&cAmount must be from 1 to 64."));
            return true;
        }

        ItemStack totem = createCustomTotem(type);
        totem.setAmount(amount);
        target.getInventory().addItem(totem).values().forEach(leftover ->
                target.getWorld().dropItemNaturally(target.getLocation(), leftover));
        sender.sendMessage(color("&aGave " + amount + " " + type.displayName + " &ato &f" + target.getName() + "&a."));
        return true;
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        if (args.length == 1) {
            return matching(List.of("give"), args[0]);
        }
        if (args.length == 2 && args[0].equalsIgnoreCase("give")) {
            return matching(Bukkit.getOnlinePlayers().stream().map(Player::getName).toList(), args[1]);
        }
        if (args.length == 3 && args[0].equalsIgnoreCase("give")) {
            return matching(List.of("fire", "ice", "void", "king", "blood_moon"), args[2]);
        }
        return List.of();
    }

    private void applyTotemEffect(Player player, TotemType type) {
        switch (type) {
            case FIRE -> {
                int fireTicks = Math.max(0, getConfig().getInt("effects.fire.duration-seconds", 6)) * 20;
                for (LivingEntity target : nearbyLivingEntities(player, getConfig().getDouble("effects.fire.radius", 8.0), false)) {
                    target.setFireTicks(fireTicks);
                }
            }
            case ICE -> {
                int duration = getConfig().getInt("effects.ice.duration-seconds", 6);
                int amplifier = getConfig().getInt("effects.ice.amplifier", 1);
                for (LivingEntity target : nearbyLivingEntities(player, getConfig().getDouble("effects.ice.radius", 8.0), true)) {
                    applyPotionEffect(target, "SLOWNESS", duration, amplifier);
                }
            }
            case VOID -> {
                teleportToSafeLocation(player);
                heal(player, getConfig().getDouble("effects.void.heal", 8.0));
            }
            case KING -> {
                heal(player, getConfig().getDouble("effects.king.heal", 16.0));
                applyPotionEffect(player, "REGENERATION",
                        getConfig().getInt("effects.king.regeneration-duration-seconds", 10),
                        getConfig().getInt("effects.king.regeneration-amplifier", 1));
            }
            case BLOOD_MOON -> applyPotionEffect(player, "STRENGTH",
                    getConfig().getInt("effects.blood-moon.strength-duration-seconds", 10),
                    getConfig().getInt("effects.blood-moon.strength-amplifier", 1));
        }
    }

    private List<LivingEntity> nearbyLivingEntities(Player player, double radius, boolean includePlayers) {
        double safeRadius = Math.max(0.0, radius);