Items

This file is the heart of your market. Here, you define every possible item that can appear, its rarity, its price, and what happens when a player buys it. This configuration allows for a deeply custo

Pricing Systems

NightMarket supports two mutually exclusive pricing systems per item. You can mix and match these systems within the same items.yml file.

Economy Price (price)

  • A standard numerical price that uses your configured economy provider (e.g., Vault, PlayerPoints). This is the most common method for a traditional server economy.

Item Price (Barter) (required_items)

  • A barter system where the price is defined by one or more in-game items. This is perfect for creating immersive, thematic economies or allowing players to trade resources for special goods.

IMPORTANT: If an item definition contains the required_items section, the price key will be completely ignored for that item.

Parameter Breakdown

price-placeholders

This global section defines the format for the %price_placeholder% variable used in item lores for economy-priced items only.

normal

  • Type: String

  • Description: The format for a standard price.

  • Placeholder: %final_price% (the calculated price of the item).

discounted

  • Type: String

  • Description: The format used when an item is on sale.

  • Placeholders: %original_price% (the price before the discount) and %final_price% (the new, discounted price).

reroll-item

Configure a custom physical item that players can use to reset their personal market offerings.

enabled

  • Type: Boolean

  • Default: true

  • Description: If true, players can use the reroll item. If false, the feature is disabled.

display

  • Type: Object

  • Description: Defines the appearance of the reroll item. Supports material, name, lore, and enchanted (true/false).

success_effects

  • Type: Object

  • Description: Defines the title, subtitle, and sound played on a successful reroll.

items

This is the main section containing a list of all your potential market items. Each item is defined by a unique key (e.g., legendary_sword, common_food).

global

  • Type: Boolean

  • Default: false

  • Description: If true, this item becomes a candidate for a "global" slot, which appears for all players. The selection is weighted based on its chance.

chance

  • Type: Double

  • Description: A numerical weight that determines the rarity of the item. This is not a percentage. The chance of an item appearing is its weight divided by the sum of all weights in its pool (personal or global). A higher number means the item is more common.

price

  • Type: Double

  • Description: The cost of the item when using a standard economy plugin. This key is ignored if required_items is present.

required_items

  • Type: List of Objects

  • Description: A list of items required for a barter trade. Each object in the list represents one required item type and contains:

    • material: The material of the required item.

    • amount: The quantity required.

    • name (Optional): A specific display name the required item must have.

    • lore (Optional): A specific lore the required item must have.

    Using name and lore allows you to create unique custom currency items (e.g., Event Tokens, Ancient Coins).

stock

  • Type: Integer

  • Description: The number of times an item can be purchased. Use -1 for infinite stock. Its behavior depends on the stock_system mode in config.yml.

discount

  • Type: Object (Optional)

  • Description: Gives an item a chance to be offered at a reduced price.

    • chance: The percentage chance (e.g., 25.0 for 25%) that the item will be on sale for a player.

    • percentage: The discount amount as a percentage (e.g., 50.0 for 50% off).

permission

  • Type: Object (Optional)

  • Description: Restricts the purchase of an item to players with a specific permission node.

    • node: The exact permission node required (e.g., nightmarket.item.vip).

    • invert: (true/false) Flips the logic. If true, players with the permission are blocked from buying. Useful for starter items.

display_item

  • Type: Object

  • Description: Defines the appearance of the item for sale in the GUI.

    • material: The material of the item. You can use shorthand for Custom Model Data: 'DIAMOND_SWORD:10001'.

    • name: The display name.

    • lore: The lore. Supports placeholders like %price_placeholder% and %stock%.

    • custom_model_data (Optional): An integer for Custom Model Data. This is an alternative to the shorthand method and is overridden by it.

    • enchantments (Optional): A list of enchantments to apply (e.g., SHARPNESS:5).

commands_on_click

  • Type: List of Strings

  • Description: A list of commands to be executed by the console when the item is purchased. Use %player% as a placeholder for the player's name.

Full Example: items.yml

This is an example of a complete items.yml file, showcasing a variety of features and configurations.

# -------------------------------------------------- #
#                NightMarket Item Config             #
# -------------------------------------------------- #

# Defines the formatting for the %price_placeholder% variable in item lores.
price-placeholders:
  normal: "&ePrice: &6%final_price%"
  discounted: "&ePrice: &m&6%original_price%&r &a%final_price%"

# Configures the item players can use to reroll their personal market offerings.
reroll-item:
  enabled: true
  display:
    material: NETHER_STAR
    name: '&d&lOrb of Alteration'
    lore:
      - '&7Right-click to reroll your'
      - '&7Night Market offerings.'
    enchanted: true
  success_effects:
    title: '&a&lRerolled!'
    subtitle: '&7Your offerings have changed.'
    sound:
      name: ENTITY_PLAYER_LEVELUP
      volume: 1.0
      pitch: 1.2

# This is the main list of all possible items that can appear in the market.
items:
  # Example 1: A rare, GLOBAL item with a standard economy price and a discount chance.
  elytra_deal:
    global: true
    chance: 2.0 # Low chance to be the featured global item.
    price: 20000.0
    stock: 3 # Only 3 available server-wide.
    discount:
      chance: 50.0 # 50% chance for a discount.
      percentage: 25.0 # 25% off.
    display_item:
      material: ELYTRA
      name: '&b&lWings of the Sky'
      lore:
        - '&7Freedom awaits.'
        - ''
        - '%price_placeholder%'
        - '&8Global Stock: &c%stock%'
    commands_on_click:
      - 'give %player% elytra 1'

  # Example 2: A VIP-exclusive item using the per-item permission system.
  vip_sword:
    chance: 5.0
    price: 15000.0
    stock: 1 # In PLAYER mode, each VIP could buy this once.
    permission:
      node: 'nightmarket.item.vip'
      invert: false # Only players with the permission can buy.
    display_item:
      material: DIAMOND_SWORD:1001 # Shorthand CustomModelData format.
      name: '&a&lVIP Blade'
      lore:
        - '&7A special reward for supporters.'
        - ''
        - '%price_placeholder%'
    commands_on_click:
      - 'give %player% diamond_sword{CustomModelData:1001,Enchantments:[{id:sharpness,lvl:7}]} 1'

  # Example 3: A common item using the barter system (item price).
  spectral_arrows:
    chance: 20.0 # High chance, very common.
    stock: -1 # Infinite personal stock.
    required_items:
      - material: GLOWSTONE_DUST
        amount: 32
    display_item:
      material: SPECTRAL_ARROW
      name: '&fSpectral Arrows (x16)'
      lore:
        - '&7Makes your targets glow.'
        - ''
        - '&ePrice:'
        - '&7- 32 Glowstone Dust'
        - '&8Your Stock: &a%stock%'
    commands_on_click:
      - 'give %player% spectral_arrow 16'

  # Example 4: A custom currency barter trade. Requires an item with a specific name.
  event_token_trade:
    chance: 10.0
    stock: 5
    required_items:
      - material: GOLD_NUGGET
        amount: 3
        name: '&e&lEvent Token'
    display_item:
      material: DIAMOND
      name: '&bPolished Diamond'
      lore:
        - '&7Trade your event tokens for gems!'
        - ''
        - '&ePrice:'
        - '&7- 3 Event Tokens'
        - '&8Your Stock: &a%stock%'
    commands_on_click:
      - 'give %player% diamond 1'

Last updated