szesc szesc i siedem

albo mam pomysl mod ktory skanuje itemy ktore podniozles z ziemi np gdy zabiles gracza skanuje itemy paczy sell i mowi sume za ile wszystko mozna sprzedac gui zrob pod U dodaj sobie jakies funkcje oraz dodaj kalkulator ze np cena : na 3 i wychodzi odpowiedz oraz laczny zarobek z itemow

Kodari AI
KodariOct 30 at 9:36 pm 1
LootValueScanner
LootValueScanner is a Minecraft plugin that automatically scans items picked up from the ground, such as those dropped by killed players, and calculates their total sell value. The plugin provides a GUI interface accessible via the U key, displaying the scanned items and their individual prices. It includes a built-in calculator that allows players to divide prices by a specified number (e.g., price divided by 3) and shows the resulting answer. Additionally, the plugin displays the total potential earnings from all scanned items, helping players quickly assess the value of their loot before selling. The GUI uses a button-based inventory system with lazy initialization for efficient memory usage.

Plan:

  1. Dodam konfigurację cen i komendę do skanowania ekwipunku oraz kalkulator.

  2. Zrobię stronicowane GUI z sumą wartości przedmiotów.

  3. Dodam śledzenie wartości podniesionych, wycenionych itemów.

Gotowe: /wartosc otwiera GUI z wyceną ekwipunku, a ceny zmienisz w config.yml. Dodane są też kalkulator (/wartosc kalkulator <cena> <ilość>) i śledzenie wartości wycenionych itemów podnoszonych przez gracza; sumę sprawdzisz przez /wartosc zarobek.

Samego klawisza U nie da się przypisać do GUI zwykłym pluginem Bukkit — do tego potrzebny byłby mod po stronie klienta.

Kodari can make mistakes. Review important code before using.
Files
src
Code
7 382
src/main/java/pl/kodari/itemvalue/ItemValuePlugin.java
package pl.kodari.itemvalue;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;

public final class ItemValuePlugin extends JavaPlugin {
    private final Map<Material, Double> prices = new HashMap<>();
    private final Map<UUID, Double> pickupEarnings = new HashMap<>();

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadPrices();
        getServer().getPluginManager().registerEvents(new ValueListener(this), this);
        getCommand("wartosc").setExecutor(new ValueCommand(this));
    }

    private void loadPrices() {
        prices.clear();
        if (getConfig().getConfigurationSection("prices") == null) {
            return;
        }

        getConfig().getConfigurationSection("prices").getKeys(false).forEach(key ->
                XMaterial.matchXMaterial(key).ifPresent(xMaterial -> {
                    Material material = xMaterial.parseMaterial();
                    if (material != null) {
                        prices.put(material, getConfig().getConfigurationSection("prices").getDouble(key));
                    }
                }));
    }

    public Double getUnitPrice(Material material) {
        return prices.get(material);
    }

    public Map<Material, Double> getPrices() {
        return prices;
    }

    public double getItemValue(ItemStack item) {
        if (item == null || item.getType().isAir()) {
            return 0.0;
        }
        Double unitPrice = prices.get(item.getType());
        return unitPrice == null ? 0.0 : unitPrice * item.getAmount();
    }

    public double getPickupEarnings(UUID playerId) {
        return pickupEarnings.getOrDefault(playerId, 0.0);
    }

    public void addPickupEarnings(UUID playerId, double amount) {
        pickupEarnings.merge(playerId, amount, Double::sum);
    }

    public String formatMoney(double amount) {
        return String.format(Locale.US, "%.2f", amount);
    }

    public void openValueMenu(Player player) {
        new ValueMenu(this, player, 0).open();
    }
}