Henry Heffernan

make a god potato and a god carrot with density 5 sharpness 5 knockback 1 mending unbreaking 3 sweeping edge 3 wind burst 2 fire aspect 2

Kodari AI
KodariSep 19 at 12:49 am 1
GodProduceWeapons
Creates two legendary food-based weapons: the God Potato and God Carrot. Each item is a custom sword with Density 5, Sharpness 5, Knockback 1, Mending, Unbreaking 3, Sweeping Edge 3, Wind Burst 2, and Fire Aspect 2 enchantments. Players receive the items via a /godpotato and /godcarrot command, with permission checks and glowing enchanted item visuals.

I’ll create a Paper plugin that registers /goditems, generates one God Potato and one God Carrot with all requested enchantments, and includes the Gradle/plugin metadata needed to build and load it.

Created a Paper plugin with:

  • /goditems command

  • God Potato and God Carrot generation

  • Enchantments:

    • Density V

    • Sharpness V

    • Knockback I

    • Mending I

    • Unbreaking III

    • Sweeping Edge III

    • Wind Burst II

    • Fire Aspect II

  • Permission: goditems.use

  • Automatic inventory overflow dropping

  • Gradle build configuration and plugin.yml

Henry Heffernan

make them have +11 attack damage

Kodari AI
KodariSep 19 at 1:13 am 1

Added +11 attack damage to both the God Potato and God Carrot using a main-hand attribute modifier.

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

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XAttribute;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Map;

public final class GodItemsPlugin extends JavaPlugin implements CommandExecutor {

    private static final Map<String, Integer> ENCHANTMENTS = Map.of(
            "DENSITY", 5,
            "SHARPNESS", 5,
            "KNOCKBACK", 1,
            "MENDING", 1,
            "UNBREAKING", 3,
            "SWEEPING_EDGE", 3,
            "WIND_BURST", 2,
            "FIRE_ASPECT", 2
    );

    @Override
    public void onEnable() {
        if (getCommand("goditems") != null) {
            getCommand("goditems").setExecutor(this);
        }
    }

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

        if (!player.hasPermission("goditems.use")) {
            player.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
            return true;
        }

        giveItem(player, createGodItem("POTATO", ChatColor.GOLD + "God Potato"));
        giveItem(player, createGodItem("CARROT", ChatColor.YELLOW + "God Carrot"));
        player.sendMessage(ChatColor.GREEN + "You received a God Potato and a God Carrot!");
        return true;
    }

    private ItemStack createGodItem(String materialName, String displayName) {
        ItemStack item = XMaterial.matchXMaterial(materialName)
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Missing material: " + materialName));

        ItemMeta meta = item.getItemMeta();
        if (meta == null) {
            throw new IllegalStateException("Material has no item metadata: " + materialName);
        }

        meta.setDisplayName(displayName);
        ENCHANTMENTS.forEach((enchantmentName, level) ->
                XEnchantment.matchXEnchantment(enchantmentName)
                        .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), level, true)));
        XAttribute.of("GENERIC_ATTACK_DAMAGE").ifPresent(attribute -> meta.addAttributeModifier(
                attribute.get(),
                new AttributeModifier(
                        new NamespacedKey(this, "god_produce_attack_damage"),
                        11.0,
                        AttributeModifier.Operation.ADD_NUMBER,
                        EquipmentSlotGroup.MAINHAND)));
        item.setItemMeta(meta);
        return item;
    }

    private void giveItem(Player player, ItemStack item) {
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(item);
        leftovers.values().forEach(leftover ->
                player.getWorld().dropItemNaturally(player.getLocation(), leftover));
    }
}