gg2982

emon koro je buildwands give command diye buildwands dewar somoi jodi inventory full takhe tahole oigula dibe nah. inventory-full message dibe target ke and je lekhse takhe. koita lost hoise oitao dibe target ke and cmd-sender ke.

Kodari AI
KodariApr 9 at 3:51 pm 4,486 (v2)
  • giveToEmptySlot বর্তমানে inventory full হলে ground-এ drop করে, কিন্তু কোনো message পাঠায় না

  • দেওয়ার আগে free slots count করে কতটা দেওয়া গেছে/যায়নি track করতে হবে

  • config.yml-এ নতুন inventory-full message key যোগ করতে হবে

Now update the give command logic to track lost wands and send the messages:

এখন থেকে:

  • Target পাবে: কতটা wand পেয়েছে (give-self message) + কতটা lost হয়েছে (inventory-full-target message)

  • Sender পাবে: কতটা দেওয়া সফল হয়েছে (give-sender message) + কতটা lost হয়েছে (inventory-full-sender message)

  • Ground-এ drop করা বন্ধ, inventory full হলে শুধু message যাবে, items হারিয়ে যাবে না (দেওয়াই হবে না)

gg2982

and emon koro je builderswand pick korbe jokhon, tokhon jeita pick korbe oita inventory er empty slot e asbe. and akta BuildersWand arekta BuildersWand er upore mouse er pointer diye click korle kono tai gayeb hobe nah. configure kora max-uses: sesh hoye gele BuildersWand inventory tekhe gayeb hoye jabe and akta sound korbe onno items gula bangle jemon sound kore oirokom. and config er sob soun off kora jave ("") othoba null kore.

Kodari AI
KodariApr 9 at 3:57 pm 13,525 (v2)

Let me read all the relevant files first.

এখন সব ফাইল পড়লাম। পরিকল্পনা:

  • Pickup fix: onPickup তে cancel করে manually first empty slot এ wand place করব

  • Wand-on-Wand click: SWAP_WITH_CURSOR ছাড়া সব cancel, PICKUP_ALL ও allow করব যাতে কিছু গায়েব না হয়

  • Max-uses শেষ: ইতিমধ্যে setItemInMainHand(null) আছে — sound null/empty হলে NPE হয়, সেটা fix করব এবং shatter sound টা properly play করব

  • Sound off support: sounds গুলো null default দিয়ে load করব, empty/null হলে play হবে না

এই পরিবর্তনগুলো করা হয়েছে:

  1. Pickup → empty slot: onPickup এ event cancel করে manually first empty slot খুঁজে সেখানে wand রাখা হয়; যদি empty slot না থাকে তাহলে ground এ থেকে যাবে

  2. Wand-on-Wand click: SWAP_WITH_CURSOR ও PICKUP_ALL/HALF/ONE/SOME allow করা হয়েছে, বাকি সব cancel — কোনো wand গায়েব হবে না

  3. Max-uses শেষ: removeWandFromInventory() helper দিয়ে inventory scan করে exact wand টা remove করে, শুধু shatter sound বাজে (place sound বাজে না)

  4. Sound off করা: sounds null default দিয়ে load হয়, empty string "" বা সরিয়ে দিলেও কোনো sound বাজবে না — playSound() helper দিয়ে সব জায়গায় null/empty check হয়

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
13 1,727
src/main/java/com/builderswand/BuildersWandPlugin.java
package com.builderswand;

import com.builderswand.command.BuildersWandCommand;
import com.builderswand.hook.LuckPermsHook;
import com.builderswand.hook.PlaceholderAPIHook;
import com.builderswand.listener.WandListener;
import com.builderswand.task.PreviewTask;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class BuildersWandPlugin extends JavaPlugin {

    private ConfigManager configManager;
    private WandManager wandManager;
    private LuckPermsHook luckPermsHook;
    private PlaceholderAPIHook placeholderAPIHook;
    private NamespacedKey wandUsesKey;
    private PreviewTask previewTask;

    @Override
    public void onEnable() {
        LicenseManager licenseManager = new LicenseManager(this);
        boolean firstRun = licenseManager.isFirstRun();

        if (!licenseManager.verify()) {
            if (firstRun) {
                getLogger().info("Plugin is disabled. Set your license key in plugins/BuildersWand/license.yml and restart.");
            }
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        this.wandUsesKey = new NamespacedKey(this, "wand_uses");
        this.configManager = new ConfigManager(this);
        this.wandManager = new WandManager(this);
        this.luckPermsHook = new LuckPermsHook(this);

        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            this.placeholderAPIHook = new PlaceholderAPIHook(this);
            this.placeholderAPIHook.register();
        }

        if (configManager.isRecipeEnabled()) {
            wandManager.registerRecipe();
        }

        Bukkit.getPluginManager().registerEvents(new WandListener(this), this);

        startPreviewTask();

        BuildersWandCommand cmd = new BuildersWandCommand(this);
        getCommand("builderswand").setExecutor(cmd);
        getCommand("builderswand").setTabCompleter(cmd);
        getCommand("bw").setExecutor(cmd);
        getCommand("bw").setTabCompleter(cmd);
    }

    @Override
    public void onDisable() {
        if (previewTask != null) {
            previewTask.cancel();
        }
    }

    public void startPreviewTask() {
        if (previewTask != null) {
            previewTask.cancel();
        }
        if (configManager.isPreviewEnabled()) {
            previewTask = new PreviewTask(this);
            previewTask.runTaskTimer(this, 0L, configManager.getPreviewInterval());
        }
    }

    public void reload() {
        configManager.reload();
        startPreviewTask();
        if (configManager.isRecipeEnabled()) {
            try {
                getServer().removeRecipe(new NamespacedKey(this, "builders_wand"));
            } catch (Exception ignored) {
            }
            wandManager.registerRecipe();
        } else {
            try {
                getServer().removeRecipe(new NamespacedKey(this, "builders_wand"));
            } catch (Exception ignored) {
            }
        }
    }
}