jake jimyy

make me a plugin to where you can do /steak and it fill up every empty space in your inventory with 64 steak

Kodari AI
KodariOct 4 at 2:28 am 1
SteakFill
A Minecraft plugin that adds a single command, /steak, which fills every empty inventory slot with 64 steak. The command instantly populates all available spaces in the player's hotbar and main inventory with stacks of cooked beef. It respects existing items, only filling empty slots, and provides immediate feedback to the player upon execution. The plugin is lightweight, requires no configuration, and works seamlessly with any server version supporting the Bukkit/Spigot API.

I’ll create the plugin entry point, /steak command registration, and the Gradle setup. The command will fill empty storage slots with 64 cooked beef each.

Created the /steak plugin. It fills every empty hotbar and main-inventory slot with a stack of 64 cooked beef.

jake jimyy

can you make me a plugin to where if you do /mend and it mends every tool in your inventory

Kodari AI
KodariOct 4 at 2:36 am 1
  1. Add /mend and register it alongside /steak.

  2. Make it repair each damaged, durability-bearing item in the player’s inventory; leave /steak unchanged.

Added /mend. It repairs all damaged durability-bearing items in your inventory, including tools and armor. /steak still works as before.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 101
src/main/java/com/kodari/steakfiller/SteakFillerPlugin.java
package com.kodari.steakfiller;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public final class SteakFillerPlugin extends JavaPlugin implements CommandExecutor {
    @Override
    public void onEnable() {
        getCommand("steak").setExecutor(this);
        getCommand("mend").setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can use this command.");
            return true;
        }

        if (command.getName().equalsIgnoreCase("mend")) {
            int mended = 0;
            ItemStack[] contents = player.getInventory().getStorageContents();
            for (ItemStack item : contents) {
                if (item == null || item.getType().isAir()) {
                    continue;
                }

                ItemMeta meta = item.getItemMeta();
                if (meta instanceof Damageable damageable && damageable.getDamage() > 0) {
                    damageable.setDamage(0);
                    item.setItemMeta(meta);
                    mended++;
                }
            }
            player.getInventory().setStorageContents(contents);
            player.sendMessage("Mended " + mended + " damaged item(s) in your inventory.");
            return true;
        }

        ItemStack steak = XMaterial.matchXMaterial("COOKED_BEEF")
                .map(XMaterial::parseItem)
                .orElse(null);
        if (steak == null) {
            player.sendMessage("Steak is unavailable on this server version.");
            return true;
        }

        int filled = 0;
        ItemStack[] contents = player.getInventory().getStorageContents();
        for (int slot = 0; slot < contents.length; slot++) {
            if (contents[slot] == null || contents[slot].getType().isAir()) {
                ItemStack stack = steak.clone();
                stack.setAmount(64);
                contents[slot] = stack;
                filled++;
            }
        }
        player.getInventory().setStorageContents(contents);
        player.sendMessage("Filled " + filled + " empty slot(s) with 64 steak.");
        return true;
    }
}