z-shop-maker.sk

Created by Zabrid

Other available versions. Ordered by newest to oldest versions:

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

options:
# ###################################################################

# Zabrid's Shop Maker
# Author(s): {zabrid}#3433
# Version: 1.0.0
# Date 5/24/22

# ###################################################################

    # If you want to use a custom skript currency you can do:
    # currency: {gems::%player's uuid%} # for example
    currency: player's balance

    # Individual shop configurations "/shop {shopname}" (Permission: zshopmaker.open.{shopname})
    individual shop menu name: "&6&lSHOP: &7{shopname}"
    individual shop menu size: 6
    individual shop menu fill item: 1 of black stained glass pane named "&7" # set to air to have no fill item

    #Individual Shop Item Configurations
    individual shop item lore [BuyAndSell]: "&8&m----------------------" and "" and "&8 -> &7Buy Price: &a&l$&a{buyPrice}" and "&8 -> &7Sell Price: &a&l$&a{sellPrice}" and "" and "&8&m----------------------" and "&bLeft Click to purchase this item." and "&bRight Click to sell this item."

    # Buy menu configurations | The gui that opens when a player tries to buy an item
    buy menu name: "&8Purchasing Item..." # make sure this value is different then the `sell menu name`
    buy menu purchase [1 item]: 1 of lime stained glass pane named "&aPurchase &n1x&a Item(s)" with lore "" and "&8 -> &7Buy Price: &a&l$&a{buyPrice}" and "" and "&7Click to purchase 1x item(s)"
    buy menu purchase [16 item]: 1 of green stained glass pane named "&2Purchase &n16x&2 Item(s)" with lore "" and "&8 -> &7Buy Price: &a&l$&a{buyPrice}" and "" and "&7Click to purchase 16x item(s)"
    buy menu purchase [64 item]: 1 of orange stained glass pane named "&6Purchase &n64x&6 Item(s)" with lore "" and "&8 -> &7Buy Price: &a&l$&a{buyPrice}" and "" and "&7Click to purchase 64x item(s)"
    buy menu purchase [full inv]: 1 of minecart with chest named "&bPurchase &n2,304&b Item(s)" with lore "" and "&8 -> &7Buy Price: &a&l$&a{buyprice}" and "" and "&7Click to purchase {itemAmount}x item(s)"
    buy menu cancel transaction: 1 of red stained glass pane named "&cCancel Transaction" with lore "&7Click to cancel this transaction."
    buy menu outline item: 1 of black stained glass pane named "&7" # set to air to have no fill item

    # Sell menu configurations | The gui that opens when a player tries to sell an item
    sell menu name: "&8Selling Item..." # make sure this value is different then the `buy menu name`
    sell menu sell [1 item]: 1 of lime stained glass pane named "&aSell &n1x&a Item(s)" with lore "" and "&8 -> &7Sell Price: &a&l$&a{sellPrice}" and "" and "&7Click to sell 1x item(s)"
    sell menu sell [16 item]: 1 of green stained glass pane named "&2Sell &n16x&2 Item(s)" with lore "" and "&8 -> &7Sell Price: &a&l$&a{sellPrice}" and "" and "&7Click to sell 16x item(s)"
    sell menu sell [64 item]: 1 of orange stained glass pane named "&6Sell &n64x&6 Item(s)" with lore "" and "&8 -> &7Sell Price: &a&l$&a{sellPrice}" and "" and "&7Click to sell 64x item(s)"
    sell menu sell [full inv]: 1 of minecart with chest named "&bSell &n{itemAmount}&b Item(s)" with lore "" and "&8 -> &7Sell Price: &a&l$&a{sellprice}" and "" and "&7Click to sell {itemAmount}x item(s)"
    sell menu cancel transaction: 1 of red stained glass pane named "&cCancel Transaction" with lore "&7Click to cancel this transaction."
    sell menu outline item: 1 of black stained glass pane named "&7" # set to air to have no fill item

    # Message configurations
    # Only messages that will be seen by players can be configured, if you really care you can look thru the source and change them.
    message [help]: "" and "&e&lZabrid Shop Maker" and "&7 Author: &e{zabrid}##3433" and "" and "&6 -> &e/shop createshop <name> &7&o(zshopmaker.createshop)" and "&6 -> &e/shop deleteshop <name> &7&o(zshopmaker.deleteshop)" and "&6 -> &e/shop additem <shop> <buyPrice> <sellPrice> &7&o(zshopmaker.additem)" and "&6 -> &e/shop removeitem <shop> &7&o(zshopmaker.removeitem)" and "&6 -> &e/shop list &7&o(zshopmaker.list)" and "&6 -> &e/shop open <shop> &7&o(zshopmaker.open.<shop>)" and ""
    message [no-permissions]: "&cYou do not have the required permissions"
    message [purchase]: "&a&l(!)&7 You have purchased &a&n{amt}x {item}&7 for &c-${money}&7."
    message [sold]: "&a&l(!)&7 You have sold &a&n{amt}x {item}&7 for &a+${money}&7."
    message [not-enough-money]: "&cYou do not have enough money to purchase this."
    message [not-enough-space]: "&cYou do not have enough space to purchase this."
    message [not-enough-items]: "&cYou do not have enough items to sell."
    message [item-cant-be-bought]: "&cThis item cannot be purchased."
    message [item-cant-be-sold]: "&cThis item cannot be sold."

# ###################################################################

# Zabrid's Shop Maker
# Source Code

# Feel free to change anything below this point.
# Although, beware you might break something!

# ###################################################################

command /shop [<text>] [<text>] [<text>] [<text>] [<text>]:
    aliases: /shopmaker, /zshop, /zshopmaker
    trigger:
        
        if arg 1 is "createshop":
            set {_name} to arg 2 in lowercase
            if player does not have permission "zshopmaker.createshop":
                send {@message [no-permissions]}
                stop
            if arg 2 is not set:
                send "&cYou must specify a shop name."
                send "&8 -> &7/shop createshop <name>"
                stop
            if {zshopmaker.shops::%{_name}%} is set:
                send "&cA shop by this name already exists."
                send "&8 -> &7Delete this shop with &e/shop deleteshop %{_name}%&7."
                stop
            set {zshopmaker.shops::%{_name}%} to true
            send ""
            send "&a&lYOU HAVE CREATED A NEW SHOP"
            send ""
            send "&eYou can add items to this shop with:"
            send "&8 -> &7/shop additem %{_name}% <buyPrice> <sellPrice>"
            send ""
            send "&eYou can remove items from this shop with:"
            send "&8 -> &7/shop removeitem %{_name}%"
            send ""
            send "&eYou can delete this shop with:"
            send "&8 -> &7/shop deleteshop %{_name}%"
            send ""
            send "&8 -> &7Shop Name: &e%{_name}%"
            send ""

        else if arg 1 is "deleteshop":
            set {_name} to arg 2 in lowercase
            if player does not have permission "zshopmaker.deleteshop":
                send {@message [no-permissions]}
                stop
            if arg 2 is not set:
                send "&cYou must specify a shop name."
                send "&8 -> &7/shop deleteshop <name>"
                stop
            if {zshopmaker.shops::%{_name}%} is not set:
                send "&cNo shop by this name currently exists."
                stop
            delete {zshopmaker.shops::%{_name}%}
            delete {zshopmaker.shop.items.%{_name}%::*}
            send ""
            send "&c&lYOU HAVE DELETED A NEW SHOP"
            send ""
            send "&8 -> &7Shop Name: &e%{_name}%"
            send ""

        else if arg 1 is "additem":
            set {_name} to arg 2 in lowercase
            set {_buyPrice} to arg 3 parsed as number
            set {_sellPrice} to arg 4 parsed as number
            if player does not have permission "zshopmaker.additem":
                send {@message [no-permissions]}
                stop
            if arg 2 is not set:
                send "&cYou must specify a shop name."
                send "&8 -> &7/shop additem <name> <buyPrice> <sellPrice>"
                stop
            if {zshopmaker.shops::%{_name}%} is not set:
                send "&cNo shop by this name currently exists."
                send "&8 -> &7/shop createshop <name>"
                stop
            if {_buyPrice} is not set:
                send "&cYou must specify a purchasing price."
                send "&8 -> &7If you do not want a purchasing price set it to -1"
                send "&8 -> &7/shop additem <name> <buyPrice> <sellPrice>"
                stop
            if {_sellPrice} is not set:
                send "&cYou must specify a selling price."
                send "&8 -> &7If you do not want a selling price set it to -1"
                send "&8 -> &7/shop additem <name> <buyPrice> <sellPrice>"
                stop
            if player's tool is air:
                send "&cPlease put an item in your hand."
                stop
            set {_a} to ( {zshopmaker.shop.items.%{_name}%::counting} ? 0 ) + 1
            set {_lore::*} to player's tool's lore ? ""
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-type} to player's tool's type
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-name} to player's tool's name
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-lore} to join {_lore::*} with "$||$"
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-nbt} to player's tool's full nbt
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-sellPrice} to {_sellPrice}
            set {zshopmaker.shop.items.%{_name}%::%{_a}%-buyPrice} to {_buyPrice}
            set {zshopmaker.shop.items.%{_name}%::counting} to {_a}
            set {_nameU} to arg 2 in uppercase
            send ""
            send "&a&lYOU HAVE ADDED AN ITEM TO %{_nameU}%"
            send ""
            send "&8 -> &7Buy Price: &c&l$&c%{_buyPrice}%"
            send "&8 -> &7Sell Price: &c&l$&c%{_sellPrice}%"
            send ""
            send "&7Open the shop with &e/shop open %{_name}%"
            send ""
            
        else if arg 1 is "removeitem":
            if player does not have permission "zshopmaker.removeitem":
                send {@message [no-permissions]}
                stop
            if arg 2 is not set:
                send "&cPlease specify a shop to remove items from."
                stop
            zshopmaker_openRemoveItemGUI(player, arg 2)

        else if arg 1 is "open":
            if arg 2 is not set:
                send "&cYou must specify a shop name to open."
                stop
            zshopmaker_openshop(arg 2, player)
        
        else if arg 1 is "list":
            if player does not have permission "zshopmaker.list":
                send {@message [no-permissions]}
                stop
            send "" and "&e&lZabrid Shop Maker" and "&7 Author: &e{zabrid}##3433" and ""
            send "&eList of Shops:"
            loop {zshopmaker.shops::*}:
                add "&6%loop-index%&7" to {_list::*}
            send "&7  %{_list::*} ? "No shops have been created."%&7"
            send ""
        else:
            send formatted {@message [help]}

function zshopmaker_openshop(shop: text, p: player):
    set {_shop} to {_shop} in lowercase
    if {zshopmaker.shops::%{_shop}%} is not set:
        send "&cThe shop you're trying to open does not exist." to {_p}
        stop
    if {_p} does not have permission "zshopmaker.open.%{_shop}%":
        send {@message [no-permissions]} to {_p}
        stop
    set {_name} to {@individual shop menu name}
    replace all "{shopname}" in {_name} with {_shop} in strict proper case
    set {_gui} to chest inventory with {@individual shop menu size} rows named {_name}
    set slot (all integers between 0 and 54) of {_gui} to {@individual shop menu fill item}

    set {_slot} to -1
    set {_loop::*} to all integers between 1 and {zshopmaker.shop.items.%{_shop}%::counting}
    loop {_loop::*}:
        if {zshopmaker.shop.items.%{_shop}%::%loop-value%-type} is set:
            add 1 to {_slot}
            set {_item} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-type}
            set {_name} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-name}
            set {_lore::*} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-lore} split by "$||$"
            set {_nbt} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-nbt}
            set {_sell} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-sellPrice}
            set {_buy} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-buyPrice}

            set {_shopLore::*} to {@individual shop item lore [BuyAndSell]}
            replace all "{buyPrice}" in {_shopLore::*} with zshopmaker_formatcommas("%{_buy}%")
            replace all "{sellPrice}" in {_shopLore::*} with zshopmaker_formatcommas("%{_sell}%")
            
            set {_chicken} to 1 of {_item}
            if {_name} is set:
                set {_chicken} to {_chicken} named {_name}
            set {_chicken} to {_chicken} named {_name} with lore {_lore::*} and {_shopLore::*} with nbt "{zshopmaker.buyPrice:%{_buy}%,zshopmaker.sellPrice:%{_sell}%,zshopmaker.index:%loop-value%,zshopmaker.shop:""%{_shop}%""}"

            set slot {_slot} of {_gui} to 1 of {_chicken}

    open {_gui} to {_p}
    set metadata tag "zshopmaker-lastopenedshop" of {_p} to {_gui}

on inventory click:
    if player's current inventory = (metadata tag "zshopmaker-lastopenedshop" of player):
        cancel event
        clicked inventory is player's current inventory

        set {_buy} to tag "zshopmaker.buyPrice" of clicked slot's nbt
        set {_sell} to tag "zshopmaker.sellPrice" of clicked slot's nbt
        if {_buy} is set:
            set {_index} to tag "zshopmaker.index" of clicked slot's nbt
            set {_shop} to tag "zshopmaker.shop" of clicked slot's nbt

            set {_item} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-type}
            set {_name} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-name}
            set {_lore::*} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-lore} split by "$||$"
            set {_nbt} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-nbt}
            set {_sell} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-sellPrice}
            set {_buy} to {zshopmaker.shop.items.%{_shop}%::%{_index}%-buyPrice}
            set {_chicken} to 1 of {_item}
            if size of {_lore::*} is greater than 1:
                set {_chicken} to {_chicken} with lore {_lore::*}
            else:
                if {_lore::1} is "":
                    set {_chicken} to {_chicken}
                else:
                    set {_chicken} to {_chicken} with lore {_lore::*}
            if {_name} is set:
                set {_chicken} to {_chicken} named {_name}

            if click type is left mouse button:
                if {_buy} is greater than 0:
                    zshopmaker_openBuyMenu(player, {_shop}, {_chicken}, {_buy})
                else:
                    send {@message [item-cant-be-bought]}
            
            if click type is right mouse button:
                if {_sell} is greater than 0:
                    zshopmaker_openSellMenu(player, {_shop}, {_chicken}, {_sell})
                else:
                    send {@message [item-cant-be-sold]}
            
    else if name of player's current inventory is {@buy menu name}:
        cancel event
        set {_back1} to tag "previousShop" of clicked slot's nbt
        if {_back1} is set:
            zshopmaker_openshop({_back1}, player)
        set {_amt} to tag "zshopmaker.amount" of clicked slot's nbt
        set {_price} to tag "zshopmaker.price" of clicked slot's nbt
        if {_amt} is set:
            set {_item} to slot 13 of clicked inventory
            if {@currency} is less than {_price}:
                send {@message [not-enough-money]}
                stop
            if player's inventory doesn't have enough space for {_amt} of {_item}:
                send {@message [not-enough-space]}
                stop
            subtract {_price} from {@currency}
            set {_message::*} to {@message [purchase]}
            replace all "{money}" in {_message::*} with zshopmaker_formatcommas("%{_price}%")
            replace all "{amt}" in {_message::*} with zshopmaker_formatcommas("%{_amt}%")
            replace all "{item}" in {_message::*} with "%{_item}'s type%"
            send {_message::*}
            add {_amt} of {_item} to player's inventory
    
    else if name of player's current inventory is {@sell menu name}:
        cancel event
        set {_back1} to tag "previousShop" of clicked slot's nbt
        if {_back1} is set:
            zshopmaker_openshop({_back1}, player)
            stop
        set {_back} to tag "previousShop" of slot 16 of clicked inventory's nbt
        set {_amt} to tag "zshopmaker.amount" of clicked slot's nbt
        set {_price} to tag "zshopmaker.price" of clicked slot's nbt
        if {_amt} is greater than 0:
            set {_item} to slot 13 of clicked inventory
            set {_amtHolding} to amount of {_item} in player's inventory
            if {_amt} is greater than {_amtHolding}:
                send {@message [not-enough-items]}
                stop
            remove {_amt} of {_item} from player's inventory
            add {_price} to {@currency}
            set {_message::*} to {@message [sold]}
            replace all "{money}" in {_message::*} with zshopmaker_formatcommas("%{_price}%")
            replace all "{amt}" in {_message::*} with zshopmaker_formatcommas("%{_amt}%")
            replace all "{item}" in {_message::*} with "%{_item}'s type%"
            zshopmaker_openSellMenu(player, {_back}, {_item}, {_price} / {_amt})
            send {_message::*}
    
    else if name of player's current inventory contains "&4&lREMOVE ITEM FROM SHOP &8(&6":
        cancel event
        clicked inventory is player's current inventory
        set {_index} to tag "zshopmaker.index" of clicked slot's nbt
        set {_shop} to tag "zshopmaker.shop" of clicked slot's nbt
        if {_index} is set:
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-type}
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-name}
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-lore}
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-nbt}
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-sellPrice}
            delete {zshopmaker.shop.items.%{_shop}%::%{_index}%-buyPrice}
            send "&aYou have successfully deleted index %{_index}% of %{_shop}%."
            send "&8 -> &7Slot Removed: &c%index of clicked slot%"
            zshopmaker_openRemoveItemGUI(player, {_shop})

function zshopmaker_openBuyMenu(p: player, previousShop: text, i: item, buy: number):
    set {_gui} to chest inventory with 3 rows named {@buy menu name}
    set {_gui} to zshopmaker_bordergui({_gui}, 3, {@buy menu outline item})

    set slot 13 of {_gui} to 1 of {_i}
    set slot 14, 15 and 16 of {_gui} to {@buy menu cancel transaction} with nbt "{previousShop:""%{_previousShop}%""}"

    set {_buy1} to {@buy menu purchase [1 item]}
    set {_buy16} to {@buy menu purchase [16 item]}
    set {_buy64} to {@buy menu purchase [64 item]}
    set {_buyfullinv} to {@buy menu purchase [full inv]}

    replace all "{buyPrice}" in {_buy1}'s lore with zshopmaker_formatcommas("%{_buy} * 1%")
    replace all "{buyPrice}" in {_buy16}'s lore with zshopmaker_formatcommas("%{_buy} * 16%")
    replace all "{buyPrice}" in {_buy64}'s lore with zshopmaker_formatcommas("%{_buy} * 64%")
    replace all "{buyPrice}" in {_buyfullinv}'s lore with zshopmaker_formatcommas("%{_buy} * 2304%")

    set slot 10 of {_gui} to {_buy1} with nbt "{zshopmaker.amount:1,zshopmaker.price:%{_buy} * 1%}"
    set slot 11 of {_gui} to {_buy16} with nbt "{zshopmaker.amount:16,zshopmaker.price:%{_buy} * 16%}"
    set slot 12 of {_gui} to {_buy64} with nbt "{zshopmaker.amount:64,zshopmaker.price:%{_buy} * 64%}"
    set slot 18 of {_gui} to {_buyfullinv} with nbt "{zshopmaker.amount:2304,zshopmaker.price:%{_buy} * 2304%}"

    open {_gui} to {_p}

function zshopmaker_openSellMenu(p: player, previousShop: text, i: item, sell: number):
    set {_gui} to chest inventory with 3 rows named {@sell menu name}
    set {_gui} to zshopmaker_bordergui({_gui}, 3, {@sell menu outline item})

    set slot 13 of {_gui} to 1 of {_i}
    set slot 14, 15 and 16 of {_gui} to {@sell menu cancel transaction} with nbt "{previousShop:""%{_previousShop}%""}"

    set {_sell1} to {@sell menu sell [1 item]}
    set {_sell16} to {@sell menu sell [16 item]}
    set {_sell64} to {@sell menu sell [64 item]}
    set {_sellfullinv} to {@sell menu sell [full inv]}
    set {_amt} to amount of {_i} in {_p}'s inventory

    replace all "{sellPrice}" in {_sell1}'s lore with zshopmaker_formatcommas("%{_sell} * 1%")
    replace all "{sellPrice}" in {_sell16}'s lore with zshopmaker_formatcommas("%{_sell} * 16%")
    replace all "{sellPrice}" in {_sell64}'s lore with zshopmaker_formatcommas("%{_sell} * 64%")
    replace all "{sellPrice}" in {_sellfullinv}'s lore with zshopmaker_formatcommas("%{_sell} * {_amt}%")
    replace all "{itemAmount}" in {_sellfullinv}'s name with zshopmaker_formatcommas("%{_amt}%")
    replace all "{itemAmount}" in {_sellfullinv}'s lore with zshopmaker_formatcommas("%{_amt}%")

    set slot 10 of {_gui} to {_sell1} with nbt "{zshopmaker.amount:1,zshopmaker.price:%{_sell} * 1%}"
    set slot 11 of {_gui} to {_sell16} with nbt "{zshopmaker.amount:16,zshopmaker.price:%{_sell} * 16%}"
    set slot 12 of {_gui} to {_sell64} with nbt "{zshopmaker.amount:64,zshopmaker.price:%{_sell} * 64%}"
    set slot 18 of {_gui} to {_sellfullinv} with nbt "{zshopmaker.amount:%{_amt}%,zshopmaker.price:%{_sell} * {_amt}%}"

    open {_gui} to {_p}

function zshopmaker_formatcommas(b: text) :: text:
    set {_numbers::*} to {_b} split at "."
    if {_numbers::2} is set:
        set {_decimal} to ".%{_numbers::2}%"
    else:
        set {_decimal} to ""
    set {_b} to {_numbers::1}
    set {_number::*} to {_b} split at ""
    loop size of {_number::*} times:
        add last element of {_number::*} to {_number2::*}
        remove last element of {_number::*} from {_number::*}
    set {_time} to 1
    set {_n} to -1
    set {_integer} to ""
    loop {_number2::*}:
        add 1 to {_n}
        set {_integer} to "%loop-value%%{_integer}%"
        if ({_n} / 3) = {_time}:
            add 1 to {_time}
            if {_n} + 1 isn't size of {_number2::*}:
                set {_integer} to ",%{_integer}%"
    return "%{_integer}%%{_decimal}%"

function zshopmaker_bordergui(gui: inventory, rows: number, borderItem: item) :: inventory:
    set slot (numbers from 0 to 8) of {_gui} to {_borderItem}
    loop ({_rows} - 2) times:
        set slot (((loop-value) * 9), and ((loop-value) * 9) + 8) of {_gui} to {_borderItem}
    set slot (numbers from ({_rows} - 1) * 9 to (({_rows} - 1) * 9) + 8) of {_gui} to {_borderItem}
    return {_gui}

function zshopmaker_openRemoveItemGUI(p: player, shop: text):
    set {_shop} to {_shop} in lowercase
    if {zshopmaker.shops::%{_shop}%} is not set:
        send "&cThe shop you're trying to open does not exist." to {_p}
        stop
    set {_name} to {@individual shop menu name}
    set {_gui} to chest inventory with {@individual shop menu size} rows named "&4&lREMOVE ITEM FROM SHOP &8(&6%{_shop}%&8)"
    set slot (all integers between 0 and 54) of {_gui} to {@individual shop menu fill item}

    set {_slot} to -1
    set {_loop::*} to all integers between 1 and {zshopmaker.shop.items.%{_shop}%::counting}
    loop {_loop::*}:
        if {zshopmaker.shop.items.%{_shop}%::%loop-value%-type} is set:
            add 1 to {_slot}
            set {_item} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-type}
            set {_name} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-name}
            set {_lore::*} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-lore} split by "$||$"
            set {_nbt} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-nbt}
            set {_sell} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-sellPrice}
            set {_buy} to {zshopmaker.shop.items.%{_shop}%::%loop-value%-buyPrice}

            set {_shopLore::*} to {@individual shop item lore [BuyAndSell]}
            replace all "{buyPrice}" in {_shopLore::*} with zshopmaker_formatcommas("%{_buy}%")
            replace all "{sellPrice}" in {_shopLore::*} with zshopmaker_formatcommas("%{_sell}%")

            set {_chicken} to 1 of {_item}
            if {_name} is set:
                set {_chicken} to {_chicken} named {_name}
            set {_chicken} to {_chicken} named {_name} with lore {_lore::*} and {_shopLore::*} and "" and "&cClick to remove this item from the shop." with nbt "{zshopmaker.index:%loop-value%,zshopmaker.shop:%{_shop}%}"

            set slot {_slot} of {_gui} to 1 of {_chicken}
    open {_gui} to {_p}

on tab complete of "/shopmaker" and "/shop" and "/zshop" and "/zshopmaker":
    set {_tab::*} to "open"
    if player has permission "zshopmaker.createshop" or "zshopmaker.deleteshop" or "zshopmaker.additem" or "zshopmaker.removeitem" or "zshopmaker.list":
        add "createshop", "deleteshop", "additem", "removeitem" and "list" to {_tab::*}
    set tab completions for position 1 to {_tab::*}
    if {zshopmaker.shops::*} is set:
        loop {zshopmaker.shops::*}:
            loop-index does not contain "-"
            player has permission "zshopmaker.open.%loop-index%"
            add loop-index to {_tabs::*}
            set tab completions for position 2 to {_tabs::*}