S

привет сделай мне скалковый арбалет чтобы он стрелял звуковой атакой вардена

📎 1 file 3,679 chars
📄
pasted-code-1783018656026.txt
txt 144 lines
▶
name: '&3&lСкалковый Арбалет'
lore:
- '&7Оружие, пропитанное энергией глубинного биома.'
- ''
- '&d&lОСОБЕННОСТЬ:'
- '&fПри выстреле выпускает &bЗвуковой бум &fВардена,'
- '&fкоторый прошибает врагов насквозь.'
- ''
- '&7[ПКМ во время зарядки арбалета]'
material: CROSSBOW
glow: true
disableEnchantGlide: false
disableStack: true
keepItemOnDeath: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNotOwner: false
onlyOwnerBlackListedActivators: []
storeItemInfo: false
unbreakable: true
isDurabilityBasedOnUsage: false
cancelEventIfNoPermission: false
whitelistedWorlds: []
chargedProjectiles: []
glider: false
keepDefaultAttributes: true
ignoreKeepDefaultAttributesFeature: false
config_5: true
config_update: true
usageFeatures:
  usage: -1
  isRefreshableClean: true
  usageLimit: -1
dropFeatures:
  glowDrop: true
  glowDropColor: DARK_AQUA
  displayNameDrop: true
enchantments: {}
hiders:
  hideEnchantments: false
  hideUnbreakable: true
  hideAttributes: false
  hideUsage: true
  hideDestroys: false
  hidePlacedOn: false
  hideDye: false
  hideArmorTrim: false
  hideAdditionalTooltip: false
  hideToolTip: false
giveFirstJoinFeatures:
  giveFirstJoin: false
  giveFirstJoinAmount: 1
  giveFirstJoinSlot: 0
restrictions:
  locked-in-inventory: false
variables: {}
activators:
  activator1:
    name: '&bЗвуковой Бум'
    active: true
    activatorType: PLAYER_CLICK
    # Срабатывает только при выстреле из заряженного арбалета
    usageModification: 0
    cancelEvent: true
    silenceOutput: false
    autoUpdateItem: false
    cooldownOptions:
      cooldown: 4
      isCooldownForReady: false
      displayCooldownMessage: true
      cooldownMessage: '&c&lOverstrike &7| &cСпособность перезаряжается! Осталось &e%time_HMMSS%'
    globalCooldownOptions:
      cooldown: 0
      displayCooldownMessage: false
      cooldownMessage: ''
    # Проверка наличия стрел в инвентаре
    itemRequirements:
      requiredItems:
        item0:
          material: ARROW
          amount: 1
          notTakeItem: false
      executableItemsRequirements: []
      cancelEventIfInvalid: true
    # Механика самого луча
    commands:
    - EXECUTE AT_PLAYER
    # Спавним синие частицы взрыва Вардена по линии взгляда (на 15 блоков вперед)
    - psu visualLine particles:SONIC_BOOM count:1 speed:0.0 length:15 space:0.5
    # Наносим урон всем в радиусе луча и откидываем их
    - damageLine damage:15.0 length:15 space:0.5 size:1.0 damageType:SONIC_BOOM
    - knockbackLine length:15 space:0.5 size:1.0 x:1.5 y:0.4 z:1.5
    # Проигрываем кастомные звуки Вардена
    - playsound entity.warden.sonic_boom weapon 1.0 1.0
    - playsound entity.warden.sonic_charge weapon 1.0 1.3
    playerConditions: {}
    worldConditions: {}
    itemConditions: {}
    customConditions: {}
    placeholdersConditions: {}
    detailedSlots:
    - MAIN_HAND
displayConditions:
  playerConditions: {}
  worldConditions: {}
  itemConditions: {}
  placeholdersConditions: {}
  enableFeature: false
foodFeatures:
  isMeat: false
  nutrition: 1
  saturation: 1
  canAlwaysEat: false
consumableFeatures:
  enable: false
  animation: EAT
  hasConsumeParticles: false
  consumeSeconds: 3
weaponFeatures:
  enable: false
  disableBlockingTime: 0
  damagePerAttack: 5
blockAttacksFeatures:
  enable: false
  blockDelay: 0
  disableCooldownScale: 1.0
  damageReductions: {}
repairableFeatures:
  enable: false
  repairCost: 2
  repairableItems: []
itemRarity:
  enableRarity: true
  rarity: EPIC
equippableFeatures:
  enable: false
  slot: CHEST
  enableSound: false
  sound: ITEM.ARMOR.EQUIP_DIAMOND
  damageableOnHurt: false
  dispensable: true
  swappable: true
  allowedEntities:
  - PLAYER
attributes: {}
Kodari AI
KodariJul 2 at 6:59 pm 1

Создам плагин “SculkCrossbow” — самостоятельный Paper-плагин, который реализует арбалет со звуковой атакой Вардена без зависимости от ItemsAdder.

SculkCrossbow
Paper plugin that adds a custom sculk-themed crossbow that fires Warden sonic boom projectiles. Features include configurable damage, knockback, cooldown, visual particles (SONIC_BOOM), warden sound effects, arrow consumption, and a give command. Fully standalone — no external dependencies required.

build.gradle.kts

settings.gradle.kts

src/main/resources/plugin.yml

src/main/resources/config.yml

SculkCrossbowPlugin.java

ItemBuilder.java

SonicBoomUtil.java

CrossbowListener.java

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
settings.gradle.kts
Code
8 506
src/main/java/com/sculkcrossbow/SculkCrossbowPlugin.java
package com.sculkcrossbow;

import com.sculkcrossbow.listener.CrossbowListener;
import com.sculkcrossbow.util.ItemBuilder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public final class SculkCrossbowPlugin extends JavaPlugin {

    private static SculkCrossbowPlugin instance;
    private ItemStack crossbowItem;

    public static SculkCrossbowPlugin getInstance() {
        return instance;
    }

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        this.crossbowItem = buildCrossbowItem();
        getServer().getPluginManager().registerEvents(new CrossbowListener(), this);
        getLogger().info("Скалковый Арбалет загружен!");
    }

    @Override
    public void onDisable() {
        instance = null;
    }

    private ItemStack buildCrossbowItem() {
        ConfigurationSection cfg = getConfig().getConfigurationSection("crossbow");
        if (cfg == null) {
            getLogger().warning("Секция 'crossbow' не найдена в config.yml!");
            return new ItemStack(Material.CROSSBOW);
        }

        String rawName = cfg.getString("name", "&#33&#66&#66&lСкалковый Арбалет");

        // Parse MiniMessage tags: &#RRGGBB → <#RRGGBB>
        String mmName = rawName.replace('&', '#').replace("#", "<#").replace("<<", "<") + "<#>";
        // Fix: replace the last <#> properly
        mmName = mmName.replace("#", "");
        mmName = "<" + mmName;

        // Simpler approach — just use legacy & codes via LegacyComponentSerializer
        Component displayName = LegacyComponentSerializer.legacyAmpersand().deserialize(rawName);

        List</String> rawLore = cfg.getStringList("lore");
        List<Component> loreLines = new ArrayList<>();
        for (String line : rawLore) {
            loreLines.add(LegacyComponentSerializer.legacyAmpersand().deserialize(line));
        }

        boolean glow = cfg.getBoolean("glow", true);
        boolean unbreakable = cfg.getBoolean("unbreakable", true);
        boolean disableStack = cfg.getBoolean("disableStack", true);

        return ItemBuilder.create(Material.CROSSBOW)
                .name(displayName)
                .lore(loreLines)
                .glow(glow)
                .unbreakable(unbreakable)
                .sculkCrossbow()
                .build();
    }

    public ItemStack getCrossbowItem() {
        return crossbowItem.clone();
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
                             @NotNull String label, @NotNull String[] args) {
        if (!command.getName().equalsIgnoreCase("sculkbow")) return false;

        if (args.length < 1 || !args[0].equalsIgnoreCase("give")) {
            sender.sendMessage(LegacyComponentSerializer.legacyAmpersand()
                    .deserialize("&cИспользование: /sculkbow give [игрок]"));
            return true;
        }

        Player target;
        if (args.length >= 2) {
            target = getServer().getPlayer(args[1]);
            if (target == null) {
                sender.sendMessage(LegacyComponentSerializer.legacyAmpersand()
                        .deserialize("&cИгрок не найден!"));
                return true;
            }
        } else if (sender instanceof Player) {
            target = (Player) sender;
        } else {
            sender.sendMessage("Только игрок может использовать эту команду без указания цели.");
            return true;
        }

        target.getInventory().addItem(getCrossbowItem());
        Component msg = LegacyComponentSerializer.legacyAmpersand()
                .deserialize("&aВы получили Скалковый Арбалет!");
        target.sendMessage(msg);

        if (!target.equals(sender)) {
            sender.sendMessage("Арбалет выдан игроку " + target.getName());
        }

        return true;
    }
}