xbadmas

/sellgui that sells listed sellable items by drag and drop, INVENTORY GUI close auto sell the items and add currency as describe (multi currency supported). shulkerboxes with sellable items inside should sell items and return the shulkerbox if it is not sellable.

Kodari AI
KodariMay 3 at 2:31 pm 8,784 (v2)
SellGuiSystem
A drag-and-drop sell GUI system for Minecraft servers. Players open /sellgui and drag items into a chest inventory — closing the GUI automatically sells all valid items and rewards currency. Supports multiple configurable currencies (e.g. Coins, Tokens) with per-item price and currency assignments. Shulker boxes placed in the GUI are unpacked: sellable contents are sold and the shulker box itself is returned to the player. Unsellable items are always returned.

Here’s my plan:

  • /sellgui opens a 54-slot chest GUI where players drag items in

  • On GUI close, loop all slots: sell valid items, return invalid ones

  • Shulker boxes: read NBT contents via SkBee, sell sellable items inside, return the shulker box

  • Multi-currency: each item maps to a currency type; balances tracked per-player per-currency

Requires: SkBee (for shulker box NBT reading)

Usage instructions:

  1. Place sellgui.sk in plugins/Skript/scripts/

  2. Run /sk reload sellgui

  3. Make sure SkBee is installed for shulker box support


Commands:

Command
Permission
Description
/sellgui
sellgui.use
Opens the sell GUI
/balance [player]
sellgui.balance
View coin/token balance
/addbalance <player> <currency> <amount>
sellgui.admin
Add currency to player
/removebalance <player> <currency> <amount>
sellgui.admin
Remove currency from player

How it works:

  • Open /sellgui, drag items into the top 5 rows, then close the GUI

  • Valid items are sold; coins/tokens are added to your balance

  • Shulker boxes are unpacked — sellable contents are sold, the shulker box is returned to you

  • Unsellable items are always returned to your inventory

To add new sell prices, edit the on script load: section and add:

Plain Text
set {sell::price::your material here} to 50
set {sell::currency::your material here} to "coins"
Kodari can make mistakes. Review important code before using.
Files
sell.sk
sellgui.sk
Code
2 545
sell.sk
# ============================================================
# SellGUI - Drag & Drop Sell System
# Author: Generated
# Version: 1.0
# Requires: SkBee (for shulker box support)
# Place in: plugins/Skript/scripts/
# Reload: /sk reload sellgui
# ============================================================

options:
    # GUI appearance
    gui-title: &8[&6Sell GUI&8]
    gui-rows: 6

    # Message prefix
    prefix: &8[&6Shop&8]&r

    # Filler item in the bottom row (decorative)
    filler-material: gray stained glass pane
    filler-name: &7

    # Info item slot (slot 49 = middle of bottom row)
    info-slot: 49
    info-material: paper
    info-name: &e&lHow to use
    info-lore: &7Drag items into the GUI|&7Close the GUI to sell them!|&7Shulker boxes will be unpacked.

    # Sell area: slots 0-44 (top 5 rows)
    sell-slots-max: 44

    # Currency symbol display
    currency-symbol-coins: &6✦
    currency-symbol-tokens: &bT

# ──────────────────────────────────────────────
# SELL PRICE CONFIGURATION
# Format: set {sell::price::<material>} to <amount>
#         set {sell::currency::<material>} to "<currency>"
# Supported currencies: "coins", "tokens"
# ──────────────────────────────────────────────
on script load:
    # Ores & minerals
    set {sell::price::diamond} to 500
    set {sell::currency::diamond} to "coins"
    set {sell::price::emerald} to 300
    set {sell::currency::emerald} to "coins"
    set {sell::price::gold ingot} to 50
    set {sell::currency::gold ingot} to "coins"
    set {sell::price::iron ingot} to 20
    set {sell::currency::iron ingot} to "coins"
    set {sell::price::coal} to 5
    set {sell::currency::coal} to "coins"
    set {sell::price::lapis lazuli} to 8
    set {sell::currency::lapis lazuli} to "coins"
    set {sell::price::redstone} to 6
    set {sell::currency::redstone} to "coins"
    set {sell::price::quartz} to 15
    set {sell::currency::quartz} to "coins"
    set {sell::price::netherite scrap} to 1000
    set {sell::currency::netherite scrap} to "coins"
    set {sell::price::ancient debris} to 2500
    set {sell::currency::ancient debris} to "coins"

    # Farming
    set {sell::price::wheat} to 3
    set {sell::currency::wheat} to "coins"
    set {sell::price::carrot} to 4
    set {sell::currency::carrot} to "coins"
    set {sell::price::potato} to 4
    set {sell::currency::potato} to "coins"
    set {sell::price::sugar cane} to 3
    set {sell::currency::sugar cane} to "coins"
    set {sell::price::pumpkin} to 10
    set {sell::currency::pumpkin} to "coins"
    set {sell::price::melon slice} to 2
    set {sell::currency::melon slice} to "coins"

    # Mob drops
    set {sell::price::bone} to 5
    set {sell::currency::bone} to "coins"
    set {sell::price::rotten flesh} to 1
    set {sell::currency::rotten flesh} to "coins"
    set {sell::price::string} to 6
    set {sell::currency::string} to "coins"
    set {sell::price::spider eye} to 8
    set {sell::currency::spider eye} to "coins"
    set {sell::price::gunpowder} to 12
    set {sell::currency::gunpowder} to "coins"
    set {sell::price::ender pearl} to 40
    set {sell::currency::ender pearl} to "tokens"
    set {sell::price::blaze rod} to 35
    set {sell::currency::blaze rod} to "tokens"
    set {sell::price::ghast tear} to 80
    set {sell::currency::ghast tear} to "tokens"
    set {sell::price::nether star} to 5000
    set {sell::currency::nether star} to "tokens"

    send "&a[SellGUI] Sell prices loaded successfully." to console

# ──────────────────────────────────────────────
# BALANCE COMMANDS
# ──────────────────────────────────────────────
command /balance [<player=player>]:
    aliases: /bal, /money
    permission: sellgui.balance
    trigger:
        set {_target} to arg-1
        set {_coins} to {balance::%{_target}%::coins} ? 0
        set {_tokens} to {balance::%{_target}%::tokens} ? 0
        if {_target} is player:
            send "{@prefix} &7Your balance:"
            send "  &8» {@currency-symbol-coins} &6Coins: &f%{_coins}%"
            send "  &8» {@currency-symbol-tokens} &bTokens: &f%{_tokens}%"
        else:
            send "{@prefix} &7Balance of &e%{_target}%&7:"
            send "  &8» {@currency-symbol-coins} &6Coins: &f%{_coins}%"
            send "  &8» {@currency-symbol-tokens} &bTokens: &f%{_tokens}%"

command /addbalance <player> <text> <number>:
    aliases: /addbal
    permission: sellgui.admin
    trigger:
        set {_target} to arg-1
        set {_currency} to arg-2 in lowercase
        set {_amount} to arg-3
        if {_currency} is "coins" or "tokens":
            add {_amount} to {balance::%{_target}%::%{_currency}%}
            send "{@prefix} &aAdded &f%{_amount}% %{_currency}% &ato &e%{_target}%&a."
            send "{@prefix} &aYou received &f%{_amount}% %{_currency}%&a from an admin." to {_target}
        else:
            send "{@prefix} &cInvalid currency. Use: coins or tokens"

command /removebalance <player> <text> <number>:
    aliases: /removebal
    permission: sellgui.admin
    trigger:
        set {_target} to arg-1
        set {_currency} to arg-2 in lowercase
        set {_amount} to arg-3
        if {_currency} is "coins" or "tokens":
            remove {_amount} from {balance::%{_target}%::%{_currency}%}
            if {balance::%{_target}%::%{_currency}%} < 0:
                set {balance::%{_target}%::%{_currency}%} to 0
            send "{@prefix} &cRemoved &f%{_amount}% %{_currency}% &cfrom &e%{_target}%&c."
        else:
            send "{@prefix} &cInvalid currency. Use: coins or tokens"

# ──────────────────────────────────────────────
# SELL GUI COMMAND
# ──────────────────────────────────────────────
command /sellgui:
    aliases: /sell, /sellmenu
    permission: sellgui.use
    trigger:
        open chest with 6 rows named "{@gui-title}" to player
        wait 1 tick
        call function fillGuiDecorations(player)

function fillGuiDecorations(p: player):
    # Fill bottom row (slots 45-53) with filler glass
    loop integers from 45 to 53:
        set slot loop-value of {_p}'s current inventory to {@filler-material} named "{@filler-name}"

    # Info item
    set {_info} to {@info-material} named "{@info-name}"
    set lore of {_info} to "{@info-lore}" with newline delimiter "|"
    set slot {@info-slot} of {_p}'s current inventory to {_info}

# ──────────────────────────────────────────────
# GUI CLOSE — PROCESS ITEMS
# ──────────────────────────────────────────────
on inventory close:
    if name of event-inventory contains "{@gui-title}":
        set {_p} to player
        set {_earnedCoins} to 0
        set {_earnedTokens} to 0
        set {_soldCount} to 0
        set {_returnCount} to 0

        loop integers from 0 to {@sell-slots-max}:
            set {_item} to slot loop-value of event-inventory
            if {_item} is not air:
                # Check if it's a shulker box
                if call function isShulkerBox({_item}) is true:
                    call function processShulkerBox({_p}, {_item}, {_earnedCoins}, {_earnedTokens}, {_soldCount}, {_returnCount})
                    # Retrieve updated totals from temp variables
                    add {_shulker::coins} to {_earnedCoins}
                    add {_shulker::tokens} to {_earnedTokens}
                    add {_shulker::sold} to {_soldCount}
                    add {_shulker::returned} to {_returnCount}
                    # Return the shulker box itself
                    add {_item} to {_p}'s inventory
                else:
                    # Normal item — check if sellable
                    set {_material} to type of {_item} in lowercase
                    set {_price} to {sell::price::%{_material}%}
                    if {_price} is set:
                        set {_currency} to {sell::currency::%{_material}%}
                        set {_qty} to amount of {_item}
                        set {_total} to {_price} * {_qty}