Files
gens-mining.sk
wallshop.sk
Code
2 446
wallshop.sk
# Wall Poster Shop System
# Place in plugins/Skript/scripts/
# Reload with: /sk reload wallshop
# Initialize player gems on first join
on player join:
if {gems::%player's uuid%} is not set:
set {gems::%player's uuid%} to 0
# /gems [player] - Check gem balance
command /gems [<offline player>]:
permission: gems.check
permission message: &cYou don't have permission to check gems!
trigger:
if arg-1 is set:
set {_target} to arg-1
if {gems::%{_target}'s uuid%} is not set:
set {gems::%{_target}'s uuid%} to 0
send "&e[WallShop] &a%{_target}%&a has &e%{gems::%{_target}'s uuid%}%&a gems."
stop
if {gems::%player's uuid%} is not set:
set {gems::%player's uuid%} to 0
send "&e[WallShop] &aYou have &e%{gems::%player's uuid%}%&a gems."
# /givegems <player> <amount> - Give gems to a player
command /givegems <offline player> <integer>:
permission: gems.admin
permission message: &cYou don't have permission to give gems!
trigger:
set {_target} to arg-1
set {_amount} to arg-2
if {_amount} is less than 1:
send "&e[WallShop] &cAmount must be at least 1!"
stop
if {gems::%{_target}'s uuid%} is not set:
set {gems::%{_target}'s uuid%} to 0
add {_amount} to {gems::%{_target}'s uuid%}
send "&e[WallShop] &aGave &e%{_amount}%&a gems to &f%{_target}%&a."
if {_target} is online:
send "&e[WallShop] &aYou received &e%{_amount}%&a gems!" to {_target}
# /takegems <player> <amount> - Remove gems from a player
command /takegems <offline player> <integer>:
permission: gems.admin
permission message: &cYou don't have permission to take gems!
trigger:
set {_target} to arg-1
set {_amount} to arg-2
if {_amount} is less than 1:
send "&e[WallShop] &cAmount must be at least 1!"
stop
if {gems::%{_target}'s uuid%} is not set:
set {gems::%{_target}'s uuid%} to 0
if {gems::%{_target}'s uuid%} is less than {_amount}:
send "&e[WallShop] &c%{_target}% only has &e%{gems::%{_target}'s uuid%}%&c gems!"
stop
subtract {_amount} from {gems::%{_target}'s uuid%}
send "&e[WallShop] &aRemoved &e%{_amount}%&a gems from &f%{_target}%&a."
if {_target} is online:
send "&e[WallShop] &cYou lost &e%{_amount}%&c gems." to {_target}
# /setshopslot <1-9> - Set a shop slot to the block you are looking at
command /setshopslot <integer>:
permission: wallshop.admin
permission message: &cYou don't have permission to set shop slots!
trigger:
set {_slot} to arg-1
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
set {_block} to player's targeted block
if {_block} is not set:
send "&e[WallShop] &cYou must be looking at a block!"
stop
set {wallshop::slot::%{_slot}%::world} to "%world of {_block}%"
set {wallshop::slot::%{_slot}%::x} to x-coordinate of {_block}
set {wallshop::slot::%{_slot}%::y} to y-coordinate of {_block}
set {wallshop::slot::%{_slot}%::z} to z-coordinate of {_block}
send "&e[WallShop] &aSlot &e%{_slot}%&a location set to &f(%{wallshop::slot::%{_slot}%::x}%, %{wallshop::slot::%{_slot}%::y}%, %{wallshop::slot::%{_slot}%::z}%)&a in &f%{wallshop::slot::%{_slot}%::world}%&a."
# /setshopitem <1-9> <item> - Set the item given for a slot
command /setshopitem <integer> <item type>:
permission: wallshop.admin
permission message: &cYou don't have permission to configure shop slots!
trigger:
set {_slot} to arg-1
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
set {wallshop::slot::%{_slot}%::item} to arg-2
send "&e[WallShop] &aSlot &e%{_slot}%&a item set to &f%arg-2%&a."
# /setshopprice <1-9> <price> - Set the gem cost for a slot
command /setshopprice <integer> <integer>:
permission: wallshop.admin
permission message: &cYou don't have permission to configure shop slots!
trigger:
set {_slot} to arg-1
set {_price} to arg-2
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_price} is less than 1:
send "&e[WallShop] &cPrice must be at least 1!"
stop
set {wallshop::slot::%{_slot}%::price} to {_price}
send "&e[WallShop] &aSlot &e%{_slot}%&a price set to &e%{_price}%&a gems."
# /setshopname <1-9> <name> - Set the display name for a slot
command /setshopname <integer> <text>:
permission: wallshop.admin
permission message: &cYou don't have permission to configure shop slots!
trigger:
set {_slot} to arg-1
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
set {wallshop::slot::%{_slot}%::name} to arg-2
send "&e[WallShop] &aSlot &e%{_slot}%&a name set to &f%arg-2%&a."
# /shopinfo [1-9] - View configuration of all slots or a specific slot
command /shopinfo [<integer>]:
permission: wallshop.admin
permission message: &cYou don't have permission to view shop info!
trigger:
if arg-1 is set:
set {_slot} to arg-1
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
send "&e--- Slot %{_slot}% Info ---"
send "&7Name: &f%{wallshop::slot::%{_slot}%::name}%"
send "&7Item: &f%{wallshop::slot::%{_slot}%::item}%"
send "&7Price: &e%{wallshop::slot::%{_slot}%::price}% &7gems"
send "&7Location: &f(%{wallshop::slot::%{_slot}%::x}%, %{wallshop::slot::%{_slot}%::y}%, %{wallshop::slot::%{_slot}%::z}%) &7in &f%{wallshop::slot::%{_slot}%::world}%"
stop
send "&e--- Wall Shop Slots ---"
loop 9 times:
set {_i} to loop-number
if {wallshop::slot::%{_i}%::x} is set:
send "&a[%{_i}%] &f%{wallshop::slot::%{_i}%::name}% &7- &e%{wallshop::slot::%{_i}%::price}% gems &7@ (%{wallshop::slot::%{_i}%::x}%, %{wallshop::slot::%{_i}%::y}%, %{wallshop::slot::%{_i}%::z}%)"
else:
send "&c[%{_i}%] &7Not configured"
# /clearshopslot <1-9> - Remove a slot configuration
command /clearshopslot <integer>:
permission: wallshop.admin
permission message: &cYou don't have permission to clear shop slots!
trigger:
set {_slot} to arg-1
if {_slot} is less than 1:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
if {_slot} is greater than 9:
send "&e[WallShop] &cSlot must be between 1 and 9!"
stop
delete {wallshop::slot::%{_slot}%::world}
delete {wallshop::slot::%{_slot}%::x}
delete {wallshop::slot::%{_slot}%::y}
delete {wallshop::slot::%{_slot}%::z}
delete {wallshop::slot::%{_slot}%::item}
delete {wallshop::slot::%{_slot}%::price}
delete {wallshop::slot::%{_slot}%::name}
send "&e[WallShop] &aSlot &e%{_slot}%&a has been cleared."
# Handle right-clicking on shop blocks
on right click:
clicked block is set
set {_bx} to x-coordinate of clicked block
set {_by} to y-coordinate of clicked block
set {_bz} to z-coordinate of clicked block
set {_bw} to "%world of clicked block%"
loop 9 times:
set {_i} to loop-number
if {wallshop::slot::%{_i}%::x} is set:
if {wallshop::slot::%{_i}%::x} is {_bx}:
if {wallshop::slot::%{_i}%::y} is {_by}:
if {wallshop::slot::%{_i}%::z} is {_bz}:
if {wallshop::slot::%{_i}%::world} is {_bw}:
cancel event
if {wallshop::slot::%{_i}%::item} is not set:
send "&e[WallShop] &cThis slot has no item configured!" to player
stop
if {wallshop::slot::%{_i}%::price} is not set:
send "&e[WallShop] &cThis slot has no price configured!" to player