GhostRift St
πŸ“Ž 1 file 7,163 chars
πŸ“„
pasted-code-1790177830603.txt
txt 384 lines
β–Ά
πŸŒ™ UNIVERSAL SERVER SUPPORT + COMPLETE ITEM PRICING DATABASE

🌐 46. SERVER NAME MUST BE FULLY CONFIGURABLE

This plugin must NOT permanently use the name Dreamlands.

The plugin is designed for ANY Minecraft server.

The server owner must be able to change the server name from configuration and/or the owner control panel.

Example:

server:
  name: "Dreamlands"

Another server could use:

server:
  name: "DonutCraft"

or:

server:
  name: "SkyRealms"

Every player-facing system must automatically use the configured server name where appropriate.

This includes:

* GUIs
* Messages
* Scoreboards
* Item lore
* Leaderboards
* Economy messages
* Sell GUI
* Shop
* Marketplace
* Orders
* Bounties
* Shards
* Player profiles
* Nametags
* Plugin messages
* API responses

DO NOT hardcode Dreamlands throughout the Java source.

Use a centralized server/plugin configuration service.

The plugin should work correctly even if the server owner changes the name after installation.

Existing player data MUST remain connected to UUIDs when the server name changes.

Changing the server name must NOT reset:

* Balances
* Playtime
* Statistics
* Listings
* Orders
* Bounties
* Shards
* Transactions
* Item price overrides

βΈ»

πŸ“ 47. DEDICATED ITEM PRICING DIRECTORY

Create a dedicated pricing directory inside the plugin’s data/config structure.

Example:

plugins/
└── /
    β”œβ”€β”€ config.yml
    β”œβ”€β”€ database/
    β”œβ”€β”€ pricing/
    β”‚   β”œβ”€β”€ items.yml
    β”‚   β”œβ”€β”€ overrides.yml
    β”‚   └── categories.yml
    β”œβ”€β”€ shop/
    β”œβ”€β”€ economy/
    β”œβ”€β”€ marketplace/
    β”œβ”€β”€ orders/
    β”œβ”€β”€ bounties/
    └── logs/

The exact folder structure may be adapted to the existing Dreamlands architecture, but pricing MUST have its own clearly separated directory.

βΈ»

πŸ’Ž 48. AUTOMATIC COMPLETE ITEM PRICE GENERATION

The plugin must automatically create a built-in price definition for EVERY normal Minecraft item supported by the target Paper/Minecraft version.

Do NOT manually define only:

* Diamond
* Emerald
* Netherite
* Gold
* Iron
* Ancient Debris

The system must cover the entire normal Minecraft item/material registry.

This includes ordinary and frequently obtained items.

Examples include:

* Dirt
* Stone
* Cobblestone
* Sand
* Gravel
* Logs
* Planks
* Sticks
* Coal
* Iron
* Copper
* Gold
* Redstone
* Lapis
* Quartz
* Diamonds
* Emeralds
* Netherite-related items
* Food
* Crops
* Seeds
* Mob drops
* Building blocks
* Ores
* Nether items
* End items
* Tools
* Weapons
* Armor
* Utility items
* Decoration items
* Transportation items
* Redstone components
* Potions where safely identifiable
* Other normal registered Minecraft items

The implementation must use the actual Material/item registry available in the target Minecraft/Paper API instead of relying on a tiny manually typed list.

βΈ»

🧠 49. AUTOMATIC DEFAULT PRICE ENGINE

Every normal item must receive a sensible built-in default price.

The plugin should generate or initialize the pricing file automatically if it does not exist.

Example:

items:
  DIAMOND:
    price: 250
    category: VALUABLE
  IRON_INGOT:
    price: 25
    category: NORMAL
  COBBLESTONE:
    price: 0.10
    category: VERY_COMMON
  DIRT:
    price: 0.05
    category: NEARLY_USELESS

The exact values must be generated intelligently rather than using one identical price for everything.

βΈ»

πŸ“Š 50. COMPLETE PRICE SPECTRUM

Prices must cover the entire progression:

ULTRA RARE
EXTREMELY RARE
VERY VALUABLE
VALUABLE
NORMAL
COMMON
VERY COMMON
CHEAP
NEARLY USELESS

The pricing engine should consider relevant characteristics such as:

* Rarity
* Natural availability
* Mining difficulty
* Mob drop difficulty
* Dimension requirements
* Progression requirements
* Renewable status
* Non-renewable status
* Crafting requirements
* Resource scarcity
* Utility
* Typical acquisition quantity
* Whether the item is easily farmable
* Whether the item requires dangerous/endgame progression
* Whether the item is a finished crafted item or raw resource

These factors should produce reasonable starting prices.

They are DEFAULT prices only.

Server owners must be able to change them.

βΈ»

πŸ’° 51. EXTREMELY RARE ITEM SUPPORT

The system must allow extremely rare legitimate items to have very high values.

For example:

items:
  :
    price: 1000000

This means:

1 item  = $1M
2 items = $2M
16 items = $16M
64 items = $64M
160 items = $160M

IMPORTANT:

1000000 means ONE MILLION.

Do not accidentally interpret this as one billion.

The system must use exact monetary calculations.

βΈ»

πŸ“¦ 52. EVERY ITEM GETS A DEFINITION

The generated pricing database should contain a definition for every normal supported item.

Example structure:

items:
  DIRT:
    price: 0.05
    category: NEARLY_USELESS
  COBBLESTONE:
    price: 0.10
    category: VERY_COMMON
  COAL:
    price: 5
    category: COMMON
  IRON_INGOT:
    price: 25
    category: NORMAL
  GOLD_INGOT:
    price: 50
    category: VALUABLE
  DIAMOND:
    price: 250
    category: VERY_VALUABLE
  EMERALD:
    price: 500
    category: VERY_VALUABLE
  NETHERITE_INGOT:
    price: 100000
    category: EXTREMELY_RARE

These are examples of the structure only.

The actual generated database must contain the complete supported item registry.

Do NOT stop after these examples.

βΈ»

πŸ”„ 53. AUTOMATIC VERSION-AWARE ITEM GENERATION

The item database must be compatible with the actual Minecraft/Paper version being used.

Target:

Paper Minecraft 26.3

If the Minecraft API changes between versions, detect the available registered materials/items from the running server/API.

When a new supported normal item exists and no pricing definition exists:

1. Detect the item.
2. Classify it.
3. Generate a safe sensible default price.
4. Add it to the pricing database.
5. Make it available to the centralized pricing service.

Do NOT assign an enormous value to newly discovered items.

Unknown/custom items should remain at the configured safe fallback until explicitly priced.

βΈ»

πŸ›‘οΈ 54. PRICE DATABASE SAFETY

The pricing database must NEVER overwrite authorized administrator overrides.

Priority:

ADMIN OVERRIDE
      ↓
BUILT-IN ITEM PRICE
      ↓
SAFE FALLBACK

Example:

items:
  DIAMOND:
    price: 250

Owner changes it:

overrides:
  DIAMOND:
    price: 500

Effective price:

$500

If the built-in database is regenerated, the $500 administrator override MUST remain.

βΈ»

🧩 55. CUSTOM ITEM SAFETY

Do not assume that every item with the same Material is identical.

When necessary, item identity must account for:

* Material
* Amount
* Enchantments
* Custom Name
* Lore
* PersistentDataContainer
* Custom Model Data
* Potion data
* Relevant item components
* Other meaningful server-defined metadata

The pricing system must not accidentally merge different custom items.

A custom item without an authorized price definition must use the configured safe fallback.

Example:

unknown-item:
  fallback-price: 0

Never automatically give an unknown/custom item:

$1M
$1B
$1T

βΈ»

πŸ“ 56. AUTOMATIC PRICE FILE INITIALIZATION

On first startup, if the pricing files do not exist:

1. Create the pricing directory.
2. Detect the supported item registry.

Kodari AI
KodariSep 23 at 3:39 pm 2
  1. Add a Paper plugin foundation and configurable server-name service.

  2. Build a version-aware pricing database with preserved admin overrides, safe custom-item fallback, and exact BigDecimal totals.

Created the UniversalPricing plugin foundation.

  • Reads the server name from config.yml and provides {server} substitution through ServerSettings.

  • Creates pricing/items.yml, pricing/overrides.yml, and pricing/categories.yml. On startup, it adds definitions for registered, non-legacy items without replacing existing prices.

  • Applies material overrides before built-in prices, uses a configurable safe fallback for unknown or custom items, and calculates stack totals with BigDecimal. Custom-item overrides are keyed by metadata fingerprint via PricingService.getCustomOverridePath(ItemStack).

The project is configured against Paper API 1.21.4; pricing generation enumerates the running server’s material registry. I did not run a build.

GhostRift St

Build everything

Kodari AI
KodariSep 23 at 3:47 pm 2
  1. Inspect the existing plugin foundation and build configuration.

  2. Complete server-name configuration and the version-aware pricing system, including file initialization and override safety.

  3. Verify the implementation against the attached requirements and fix any missing pieces.

Implemented the configurable server-name and pricing foundation.

  • /up reload reloads config.yml and the pricing files, so a changed server.name takes effect without a restart.

  • /up price <material> [amount|clear] manages material price overrides; /up held <amount|clear> manages an override for the held custom item.

  • Pricing initialization generates definitions for every registered, non-legacy item material, fills missing categories without replacing existing prices, and keeps overrides separate from generated defaults.

  • Custom-item pricing uses a metadata-sensitive fingerprint and falls back safely when no explicit override exists. Stack totals use BigDecimal.

The project has no shop, marketplace, scoreboard, bounty, or other player-facing modules yet, so those systems could not be wired to the server-name service. I did not run a build; the existing Paper API dependency remains pinned to 1.21.4.

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

import com.kodari.universalpricing.pricing.PricingService;
import com.kodari.universalpricing.server.ServerSettings;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.math.BigDecimal;
import java.util.Locale;

public final class UniversalPricingPlugin extends JavaPlugin {
    private ServerSettings serverSettings;
    private PricingService pricingService;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        serverSettings = new ServerSettings(this);
        pricingService = new PricingService(this);
        pricingService.initialize();
        getCommand("universalpricing").setExecutor(this::executeCommand);
    }

    public ServerSettings getServerSettings() {
        return serverSettings;
    }

    public PricingService getPricingService() {
        return pricingService;
    }

    private boolean executeCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 0) {
            return false;
        }

        switch (args[0].toLowerCase(Locale.ROOT)) {
            case "reload" -> {
                if (args.length != 1) {
                    return false;
                }
                reloadConfig();
                pricingService.reload();
                sender.sendMessage(message("&aConfiguration reloaded for {server}."));
            }
            case "price" -> handleMaterialPrice(sender, args);
            case "held" -> handleHeldItemPrice(sender, args);
            default -> {
                return false;
            }
        }
        return true;
    }

    private void handleMaterialPrice(CommandSender sender, String[] args) {
        if (args.length < 2 || args.length > 3) {
            sender.sendMessage(message("&cUsage: /universalpricing price <material> [amount|clear]"));
            return;
        }
        Material material = Material.matchMaterial(args[1]);
        if (material == null || !material.isItem() || material.isAir()) {
            sender.sendMessage(message("&cThat is not a registered item material."));
            return;
        }
        if (args.length == 2) {
            sender.sendMessage(message("&e" + material.name() + " costs $"
                    + pricingService.getUnitPrice(new ItemStack(material)).toPlainString() + " per item."));
            return;
        }
        if (args[2].equalsIgnoreCase("clear")) {
            pricingService.clearMaterialOverride(material);
            sender.sendMessage(message("&aRemoved the price override for " + material.name() + "."));
            return;
        }
        try {
            BigDecimal price = new BigDecimal(args[2]);
            pricingService.setMaterialOverride(material, price);
            sender.sendMessage(message("&aSet " + material.name() + " to $" + price.toPlainString() + " per item."));
        } catch (IllegalArgumentException exception) {
            sender.sendMessage(message("&cEnter a valid non-negative decimal price."));
        }
    }

    private void handleHeldItemPrice(CommandSender sender, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage(message("&cThis command must be used in-game."));
            return;
        }
        if (args.length != 2) {
            sender.sendMessage(message("&cUsage: /universalpricing held <amount|clear>"));
            return;
        }
        ItemStack heldItem = player.getInventory().getItemInMainHand();
        try {
            if (args[1].equalsIgnoreCase("clear")) {
                pricingService.clearCustomOverride(heldItem);
                sender.sendMessage(message("&aRemoved the held custom item's price override."));
                return;
            }
            BigDecimal price = new BigDecimal(args[1]);
            pricingService.setCustomOverride(heldItem, price);
            sender.sendMessage(message("&aSet the held custom item's price to $" + price.toPlainString() + " per item."));
        } catch (IllegalArgumentException exception) {
            sender.sendMessage(message("&cHold a modified item and enter a valid non-negative decimal price."));
        }
    }

    private String message(String text) {
        return ChatColor.translateAlternateColorCodes('&', serverSettings.applyServerName(text));
    }
}