options:
shop-title: "Shard Store"
max-rows: 6 # Max number of rows in the shop GUI
on join:
if {shards::%player's uuid%} is not set:
set {shards::%player's uuid%} to 0
on death of player:
if attacker is a player:
set {_uuid} to uuid of attacker
add 10 to {shards::%{_uuid}%}
send action bar "&7You gained &a10 &5shards!" to attacker
command /storeadmin add <number> <number>:
permission: store.admin
trigger:
if held item is air:
send "&cYou must hold an item to add it to the store!" to player
stop
set {store::%arg-1%::item} to held item
set {store::%arg-1%::row} to arg-1
set {store::%arg-1%:rice} to arg-2
set {store::%arg-1%::name} to name of held item # Save the item name
send "&aAdded &7%held item%&a to the store for &e%arg-2%&7 shards at row &e%arg-1%" to player
command /store:
trigger:
set {_gui} to a new chest inventory with 6 rows named "Shard Store"
set {_slots::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
loop {_slots::*}:
set {_slotData} to {store::%loop-value%}
if {_slotData} is set:
set {_item} to {_slotData::item}
set {_name} to {_slotData::name}
set {_price} to {_slotData:rice}
set slot {_loop-value} of {_gui} to {_item} with lore "Price: %{_price}% shards"
set slot {_loop-value} of {_gui} to {_item} named "&e%{_name}%"
else:
set slot {_loop-value} of {_gui} to air
open {_gui} to player
on inventory click:
if name of event-inventory is {@shop-title}:
cancel event
set {_clickedItem} to event-item
set {_clickedItemSlot} to index of event-slot
set {_itemname} to {store::%{_clickedItemSlot}%::name}
set {_price} to {store::%{_clickedItemSlot}%:rice}
set {_clickedItem} to {store::%{_clickedItemSlot}%::item}
set {_itemtype} to {store::%{_clickedItemSlot}%::type}
send "&aYou are buying: %{_itemname}% (ID: %{_itemtype}%) for %{_price}% shards!" to player
send "&aYou have &7%{shards::%player's uuid%}%&a shards!" to player # Show current shards
if {shards::%player's uuid%} >= {_price}:
remove {_price} from {shards::%player's uuid%}
give {_clickedItem} to player
send "&aYou bought &7%{_itemname}% (ID: %{_itemtype}%)&a for &e%{_price}%&7 shards!" to player
else:
send "&cYou don't have enough shards to buy this item!" to player
command /resetstore:
permission: store.admin
trigger:
delete {store::*}
send "&aAll store items have been reset!" to player
shop-title: "Shard Store"
max-rows: 6 # Max number of rows in the shop GUI
on join:
if {shards::%player's uuid%} is not set:
set {shards::%player's uuid%} to 0
on death of player:
if attacker is a player:
set {_uuid} to uuid of attacker
add 10 to {shards::%{_uuid}%}
send action bar "&7You gained &a10 &5shards!" to attacker
command /storeadmin add <number> <number>:
permission: store.admin
trigger:
if held item is air:
send "&cYou must hold an item to add it to the store!" to player
stop
set {store::%arg-1%::item} to held item
set {store::%arg-1%::row} to arg-1
set {store::%arg-1%:rice} to arg-2
set {store::%arg-1%::name} to name of held item # Save the item name
send "&aAdded &7%held item%&a to the store for &e%arg-2%&7 shards at row &e%arg-1%" to player
command /store:
trigger:
set {_gui} to a new chest inventory with 6 rows named "Shard Store"
set {_slots::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
loop {_slots::*}:
set {_slotData} to {store::%loop-value%}
if {_slotData} is set:
set {_item} to {_slotData::item}
set {_name} to {_slotData::name}
set {_price} to {_slotData:rice}
set slot {_loop-value} of {_gui} to {_item} with lore "Price: %{_price}% shards"
set slot {_loop-value} of {_gui} to {_item} named "&e%{_name}%"
else:
set slot {_loop-value} of {_gui} to air
open {_gui} to player
on inventory click:
if name of event-inventory is {@shop-title}:
cancel event
set {_clickedItem} to event-item
set {_clickedItemSlot} to index of event-slot
set {_itemname} to {store::%{_clickedItemSlot}%::name}
set {_price} to {store::%{_clickedItemSlot}%:rice}
set {_clickedItem} to {store::%{_clickedItemSlot}%::item}
set {_itemtype} to {store::%{_clickedItemSlot}%::type}
send "&aYou are buying: %{_itemname}% (ID: %{_itemtype}%) for %{_price}% shards!" to player
send "&aYou have &7%{shards::%player's uuid%}%&a shards!" to player # Show current shards
if {shards::%player's uuid%} >= {_price}:
remove {_price} from {shards::%player's uuid%}
give {_clickedItem} to player
send "&aYou bought &7%{_itemname}% (ID: %{_itemtype}%)&a for &e%{_price}%&7 shards!" to player
else:
send "&cYou don't have enough shards to buy this item!" to player
command /resetstore:
permission: store.admin
trigger:
delete {store::*}
send "&aAll store items have been reset!" to player