Damians

can you make a plugin that when you do the command /boom it makes it so when you drop an item it dupes it so if you drop 1 it actually drops 2, and do that for every digit up untill 64, so 2 will drop 4, 4 will drop 8, and so on untill 64 and then when you do /explosion it gets rid of this feature

Kodari AI
KodariOct 11 at 4:36 pm 1
ItemDuplicationToggle
Adds two commands to a Minecraft server. /boom activates a duplication feature where any dropped item stack is duplicated, doubling the quantity (1 becomes 2, 2 becomes 4, up to 64). /explosion deactivates this feature, restoring normal item drop behavior. The plugin tracks the active state and intercepts item drop events to apply the duplication logic.
  1. Create the Gradle and plugin metadata.

  2. Add /boom to enable stack doubling and /explosion to disable it, splitting doubled drops at the stack limit.

Created BoomDrop. Use /boom to double each dropped stack; drops over the item’s stack limit are split into separate stacks. Use /explosion to turn doubling off.

Damians

can you rename it to smpES

Kodari AI
KodariOct 11 at 4:37 pm 1
  1. Rename the Gradle project and Minecraft plugin display name to smpES; keep its main class and commands unchanged.

Renamed the project and Minecraft plugin to smpES. /boom and /explosion are unchanged.

Damians

can you make it so only people with the username ___l1 can run these 2 commands

Kodari AI
KodariOct 11 at 4:48 pm 1
  1. Check both command handlers.

  2. Restrict /boom and /explosion to the exact username ___l1.

Both /boom and /explosion are now restricted to the player ___l1. Everyone else—including console—gets a denial message. Username matching is case-insensitive.

Damians

i mean so only i can see the command only i can access it and see the command so if someone else does /boom it says it doesnt exist same with /explosion

Kodari AI
KodariOct 11 at 4:51 pm 1
  1. Hide both commands from other players’ command suggestions.

  2. Intercept attempts (including namespaced forms) and reply with the normal unknown-command message.

Players other than ___l1 no longer see /boom or /explosion in command suggestions. If they try either command—including a namespaced form—they get an “Unknown command” message. ___l1 can still use both commands.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 132
src/main/java/com/example/boomdrop/BoomDropPlugin.java
package com.example.boomdrop;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerCommandSendEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Locale;

public final class BoomDropPlugin extends JavaPlugin implements Listener, CommandExecutor {
    private boolean doublingEnabled;

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("boom").setExecutor(this);
        getCommand("explosion").setExecutor(this);
    }

    @EventHandler
    public void onPlayerDropItem(PlayerDropItemEvent event) {
        if (!doublingEnabled) {
            return;
        }

        Item droppedItem = event.getItemDrop();
        ItemStack stack = droppedItem.getItemStack();
        int doubledAmount = stack.getAmount() * 2;
        int maxStackSize = stack.getMaxStackSize();

        stack.setAmount(Math.min(doubledAmount, maxStackSize));
        droppedItem.setItemStack(stack);

        int remainder = doubledAmount - maxStackSize;
        if (remainder > 0) {
            ItemStack extraStack = stack.clone();
            extraStack.setAmount(remainder);
            droppedItem.getWorld().dropItemNaturally(droppedItem.getLocation(), extraStack);
        }
    }

    @EventHandler
    public void onPlayerCommandSend(PlayerCommandSendEvent event) {
        if (event.getPlayer().getName().equalsIgnoreCase("___l1")) {
            return;
        }

        event.getCommands().removeIf(command -> command.equalsIgnoreCase("boom")
                || command.equalsIgnoreCase("explosion")
                || command.toLowerCase(Locale.ROOT).endsWith(":boom")
                || command.toLowerCase(Locale.ROOT).endsWith(":explosion"));
    }

    @EventHandler
    public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
        if (event.getPlayer().getName().equalsIgnoreCase("___l1")) {
            return;
        }

        String commandName = event.getMessage().substring(1).split("\\s+", 2)[0];
        if (commandName.contains(":")) {
            commandName = commandName.substring(commandName.lastIndexOf(':') + 1);
        }
        commandName = commandName.toLowerCase(Locale.ROOT);

        if (commandName.equals("boom") || commandName.equals("explosion")) {
            event.setCancelled(true);
            event.getPlayer().sendMessage(ChatColor.RED + "Unknown command. Type \"/help\" for help.");
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player) || !player.getName().equalsIgnoreCase("___l1")) {
            sender.sendMessage(ChatColor.RED + "Unknown command. Type \"/help\" for help.");
            return true;
        }

        if (command.getName().equalsIgnoreCase("boom")) {
            doublingEnabled = true;
            sender.sendMessage(ChatColor.GREEN + "Item-drop doubling enabled.");
        } else if (command.getName().equalsIgnoreCase("explosion")) {
            doublingEnabled = false;
            sender.sendMessage(ChatColor.YELLOW + "Item-drop doubling disabled.");
        }
        return true;
    }
}