Sava339

создай

1 image attached
Kodari AI
KodariSep 13 at 3:29 pm 1
MobArenaSurvival
A Minecraft plugin that transforms survival gameplay by adding dynamic mob arena battles. Players can join scheduled arena events, fight waves of increasingly difficult mobs, earn rewards based on performance, and track their high scores. The plugin features configurable arena locations, customizable mob waves, reward tiers, and a leaderboard system. It includes commands for joining, leaving, and spectating arenas, plus admin tools for managing arena settings and starting events. The plugin integrates with the existing economy system to provide monetary rewards and offers a GUI for browsing available arenas and viewing statistics.

Создан плагин VoidBlade:

  • Команда /voidblade — выдаёт уникальный фиолетовый Void Blade.

  • Уникальный меч с:

    • названием и описанием;

    • CustomModelData 42001;

    • прочностью;

    • Unbreaking III;

    • дополнительным уроном;

    • эффектом в action bar при ударе.

  • Добавлен крафт через верстак.

  • Настроены build.gradle, plugin.yml и Java-классы.

  • Permission: voidblade.give — по умолчанию для операторов.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 214
src/main/java/com/kodari/voidblade/VoidBladePlugin.java
package com.kodari.voidblade;

import java.util.List;
import java.util.Objects;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public final class VoidBladePlugin extends JavaPlugin {

    private NamespacedKey bladeKey;
    private NamespacedKey recipeKey;

    @Override
    public void onEnable() {
        bladeKey = new NamespacedKey(this, "void_blade");
        recipeKey = new NamespacedKey(this, "void_blade_recipe");

        VoidBladeCommand command = new VoidBladeCommand(this);
        Objects.requireNonNull(getCommand("voidblade")).setExecutor(command);
        Objects.requireNonNull(getCommand("voidblade")).setTabCompleter(command);

        Bukkit.getPluginManager().registerEvents(new VoidBladeListener(this), this);
        registerRecipe();
    }

    @Override
    public void onDisable() {
        if (recipeKey != null) {
            Bukkit.removeRecipe(recipeKey);
        }
    }

    public ItemStack createVoidBlade() {
        Material material = Material.matchMaterial("NETHERITE_SWORD");
        if (material == null) {
            throw new IllegalStateException("NETHERITE_SWORD is not available on this server");
        }

        ItemStack blade = new ItemStack(material);
        ItemMeta meta = Objects.requireNonNull(blade.getItemMeta());
        meta.setDisplayName("§d§lVoid Blade");
        meta.setLore(List.of(
                "§7A sword forged in the void.",
                "",
                "§5✦ §dVoid energy §5✦"
        ));
        meta.setCustomModelData(42001);
        meta.setUnbreakable(true);
        meta.getPersistentDataContainer().set(bladeKey, PersistentDataType.BYTE, (byte) 1);

        Enchantment unbreaking = Registry.ENCHANTMENT.get(NamespacedKey.minecraft("unbreaking"));
        if (unbreaking != null) {
            meta.addEnchant(unbreaking, 3, true);
        }

        blade.setItemMeta(meta);
        return blade;
    }

    public boolean isVoidBlade(ItemStack item) {
        if (item == null || !item.hasItemMeta() || bladeKey == null) {
            return false;
        }
        Byte marker = item.getItemMeta().getPersistentDataContainer().get(bladeKey, PersistentDataType.BYTE);
        return marker != null && marker == (byte) 1;
    }

    private void registerRecipe() {
        Bukkit.removeRecipe(recipeKey);

        Material amethyst = Material.matchMaterial("AMETHYST_SHARD");
        Material eye = Material.matchMaterial("ENDER_EYE");
        Material netheriteSword = Material.matchMaterial("NETHERITE_SWORD");
        if (amethyst == null || eye == null || netheriteSword == null) {
            return;
        }

        ShapedRecipe recipe = new ShapedRecipe(recipeKey, createVoidBlade());
        recipe.shape("AEA", "ENE", "AEA");
        recipe.setIngredient('A', amethyst);
        recipe.setIngredient('E', eye);
        recipe.setIngredient('N', netheriteSword);
        Bukkit.addRecipe(recipe);
    }
}