Viraj peta

Make a legendary weapons pulgin with 4 unique weapons and need ritual to obtain

Kodari AI
KodariSep 27 at 9:15 pm 1
LegendaryArsenal
A Minecraft plugin introducing four unique legendary weapons, each requiring a special ritual to obtain. Players must gather specific materials and perform a ceremonial crafting sequence at designated altars to unlock weapons like the Inferno Blade, Frostbite Bow, Thunder Hammer, and Shadow Dagger. Each weapon features distinct abilities, particle effects, and cooldowns. The plugin includes configurable ritual recipes, custom item lore, and permission-based access for server administrators.
  1. Add the Paper plugin setup and four custom weapons.

  2. Implement each weapon’s ability with cooldowns.

  3. Add a Nether Star altar ritual and in-game instructions.

Created LegendaryWeapons with four custom weapons: Sunfang, Tempest Bow, Earthshatter, and Voidcaller, each with a cooldown-based ability.

To claim one, hold a Nether Star and right-click an enchanting table surrounded by crying obsidian two blocks out on each cardinal side and soul lanterns on the four diagonals. The ritual grants a weapon you don’t already own. Use /legendaryweapons (or /lw) for the layout and instructions.

Viraj peta

How he works?

Kodari AI
KodariSep 27 at 9:17 pm 1

The plugin adds four special weapons. Right-click while holding one in your main hand to use its ability:

  • Sunfang (diamond sword): burns and damages nearby enemies — 12-second cooldown.

  • Tempest Bow: gives you Speed for 8 seconds — 15-second cooldown.

  • Earthshatter (netherite axe): damages and knocks back nearby enemies — 18-second cooldown.

  • Voidcaller (trident): damages and pulls nearby enemies toward you — 20-second cooldown.

To obtain one, hold a Nether Star and right-click an enchanting table surrounded by:

  • Crying obsidian two blocks away on each of the four cardinal sides.

  • Soul lanterns on the four diagonal blocks next to the table.

The ritual randomly gives you a weapon you don’t already have and consumes one Nether Star. Use /legendaryweapons or /lw in-game to see the ritual instructions.

One detail: cooldowns are shared between weapons, so using one temporarily prevents you from using another until that cooldown ends.

Viraj peta

Virsion?

Kodari AI
KodariSep 28 at 4:56 am 1

It’s built for Minecraft 1.21.4 and uses Java 21. The plugin version is 1.0.0.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 380
src/main/java/com/kodari/legendaryweapons/LegendaryWeaponsPlugin.java
package com.kodari.legendaryweapons;

import com.cryptomorin.xseries.XMaterial;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public final class LegendaryWeaponsPlugin extends JavaPlugin {
    private NamespacedKey weaponKey;

    @Override
    public void onEnable() {
        weaponKey = new NamespacedKey(this, "legendary_weapon");
        getServer().getPluginManager().registerEvents(new WeaponListener(this), this);
        getServer().getPluginManager().registerEvents(new RitualListener(this), this);
        getLogger().info("LegendaryWeapons enabled.");
    }

    public NamespacedKey weaponKey() {
        return weaponKey;
    }

    public ItemStack createWeapon(WeaponType type) {
        Material material = XMaterial.matchXMaterial(type.material())
                .map(XMaterial::parseMaterial)
                .orElse(null);
        if (material == null) {
            getLogger().warning("Could not resolve weapon material: " + type.material());
            return null;
        }

        ItemStack item = new ItemStack(material);
        ItemMeta meta = item.getItemMeta();
        if (meta == null) {
            return null;
        }

        meta.setDisplayName(color(type.displayName()));
        meta.setLore(List.of(
                color("&8Legendary Weapon"),
                color("&r"),
                color(type.abilityDescription()),
                color("&7Cooldown: &f" + type.cooldownSeconds() + " seconds")
        ));
        meta.getPersistentDataContainer().set(weaponKey, PersistentDataType.STRING, type.id());
        item.setItemMeta(meta);
        return item;
    }

    public WeaponType getWeaponType(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return null;
        }
        String id = item.getItemMeta().getPersistentDataContainer().get(weaponKey, PersistentDataType.STRING);
        return id == null ? null : WeaponType.fromId(id);
    }

    public boolean hasWeapon(Player player, WeaponType type) {
        for (ItemStack item : player.getInventory().getContents()) {
            if (getWeaponType(item) == type) {
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        sender.sendMessage(color("&6&lLegendary Weapons"));
        sender.sendMessage(color("&eRitual: &fBuild an enchanting table altar with crying obsidian 2 blocks away on each cardinal side and soul lanterns on the four diagonal sides."));
        sender.sendMessage(color("&fHold a Nether Star and right-click the enchanting table to claim a weapon you don't already own."));
        sender.sendMessage(color("&7Weapons: &6Sunfang &7| &bTempest Bow &7| &6Earthshatter &7| &5Voidcaller"));
        return true;
    }

    public static String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }
}