SHARE
TWEET

Untitled

a guest Apr 20th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. options:
  2.     p: &a&lShop &7» # Prefix
  3.  
  4.     ShopTitle: &a&lShop # Shop gui title
  5.  
  6.     menu-category-name: &f» &a&l{category} &f« # Placeholders: {category} = category name
  7.     menu-category-lore: &eClick to open &f{category} &ecategory. # Placeholders: {category} = category name
  8.  
  9.     menu-item-lore: ||&7» &aPrice: &f{price}||&7» &aClick to buy # This is an extra lore to items in shop - Placeholders: {price} = category name, || = newline in lore
  10.  
  11.     menu-soon-item: barrier
  12.     menu-soon-name: &7» &cSoon &7«
  13.  
  14.     menu-back-item: arrow
  15.     menu-back-name: &7« &eBack
  16.  
  17.     # Close shop menu after a purchase?
  18.     close-after-buy: false
  19.  
  20.  
  21.  
  22. #
  23. #! CODE - DON'T EDIT UNLESS YOU KNOW WHAT YOU'RE DOING.
  24. #
  25.  
  26. on load:
  27.     if {Shop::shop-background::item} is not set:
  28.         set {Shop::shop-background::item} to gray stained glass pane
  29.     if {Shop::shop-size} is not set:
  30.         set {Shop::shop-size} to 5
  31.  
  32.  
  33. function shopBuy(p: player, slot: integer, cat: text = "false"):
  34.     set {_pU} to uuid of {_p}
  35.     if {_cat} is "false":
  36.         if {_p}'s balance >= {Shop::shop::%{_slot}%::price}:
  37.             remove {Shop::shop::%{_slot}%::price} from {_p}'s balance
  38.             if {Shop::shop::%{_slot}%::cmds::*} is set:
  39.                 loop {Shop::shop::%{_slot}%::cmds::*}:
  40.                     set {_cmd} to loop-value
  41.                     replace all "[p]" with "%{_p}%" in {_cmd}
  42.                     if first 3 characters of loop-value is "[c]":
  43.                         set {_cmd} to subtext of {_cmd} from character 4 to (length of {_cmd})
  44.                         execute console command "%{_cmd}%"
  45.                     else:
  46.                         execute {_p} command "%loop-value%"
  47.                 send "{@p} &aYou've bought &8(&a%name of slot {_slot} of {_p}'s current inventory%&8) &afor &f%{Shop::shop::%{_slot}%::price}% &ashop." to {_p}
  48.                 if {@close-after-buy} is true:
  49.                     close {_p}'s inventory
  50.                 stop
  51.             else:
  52.                 give {_p} (slot {_slot} of {_p}'s current inventory) lored ""
  53.                 send "{@p} &aYou've bought &8(&a%name of slot {_slot} of {_p}'s current inventory%&8) &afor &f%{Shop::shop::%{_slot}%::price}% &ashop." to {_p}
  54.                 #send "{@p} &cThis item has no commands to execute." to {_p}
  55.                 stop
  56.         else:
  57.             send "{@p} &cYou don't have enough money to buy that." to {_p}
  58.             stop
  59.     else:
  60.         if {_p}'s balance >= {Shop::shop::%{_cat}%::items::%{_slot}%::price}:
  61.             remove {Shop::shop::%{_cat}%::items::%{_slot}%::price} from {_p}'s balance
  62.             if {Shop::shop::%{_cat}%::items::%{_slot}%::cmds::*} is set:
  63.                 loop {Shop::shop::%{_cat}%::items::%{_slot}%::cmds::*}:
  64.                     set {_cmd} to loop-value
  65.                     replace all "[p]" with "%{_p}%" in {_cmd}
  66.                     if first 3 characters of loop-value is "[c]":
  67.                         set {_cmd} to subtext of {_cmd} from character 4 to (length of {_cmd})
  68.                         execute console command "%{_cmd}%"
  69.                     else:
  70.                         execute {_p} command "%loop-value%"
  71.                 send "{@p} &aYou've bought &8(&a%name of slot {_slot} of {_p}'s current inventory%&8) &afor &f%{Shop::shop::%{_cat}%::items::%{_slot}%::price}% &ashop." to {_p}
  72.                 if {@close-after-buy} is true:
  73.                     close {_p}'s inventory
  74.             else:
  75.                 give {_p} (slot {_slot} of {_p}'s current inventory) lored ""
  76.                 send "{@p} &aYou've bought &8(&a%name of slot {_slot} of {_p}'s current inventory%&8) &afor &f%{Shop::shop::%{_cat}%::items::%{_slot}%::price}% &ashop." to {_p}
  77.                 #send "{@p} &cThis item has no commands to execute." to {_p}
  78.                 stop
  79.         else:
  80.             send "{@p} &cYou don't have enough shop to buy that." to {_p}
  81.             stop
  82.  
  83. function shopOpen(p: player, cat: text):
  84.     set {_pU} to uuid of {_p}
  85.  
  86.     if {_cat} = "main":
  87.         open virtual chest with {Shop::shop-size} rows named "{@ShopTitle}" to {_p}
  88.         wait 3 ticks
  89.         loop {Shop::shop::*}:
  90.             set {_lv} to loop-value
  91.             if {Shop::shop::%{_lv}%::price} is set:
  92.                 if {Shop::shop::%{_lv}%::price} = 0:
  93.                     format gui slot {_lv} of {_p} with {Shop::shop::%{_lv}%::item} to run:
  94.                         {Shop::shop::%{_lv}%::cmds::*} is set
  95.                         loop {Shop::shop::%{_lv}%::cmds::*}:
  96.                             set {_cmd} to loop-value-2
  97.                             replace all "[p]" with "%{_p}%" in {_cmd}
  98.                             if first 3 characters of loop-value-2 is "[c]":
  99.                                 set {_cmd} to subtext of {_cmd} from character 4 to (length of {_cmd})
  100.                                 execute console command "%{_cmd}%"
  101.                             else:
  102.                                 execute {_p} command "%loop-value-2%"
  103.                 else:
  104.                     set {_lore} to "{@menu-item-lore}"
  105.                     replace all "{price}" with "%{Shop::shop::%{_lv}%::price}%" in {_lore}
  106.                     if lore of {Shop::shop::%{_lv}%::item} is not "":
  107.                         set {_lore} to "%lore of {Shop::shop::%{_lv}%::item}%%{_lore}%"
  108.                     format gui slot {_lv} of {_p} with {Shop::shop::%loop-value%::item} lored "%colored {_lore}%" to run:
  109.                         shopBuy({_p}, {_lv}, "false")
  110.  
  111.             else:
  112.                 set {_name} to "{@menu-category-name}"
  113.                 set {_lore} to "{@menu-category-lore}"
  114.                 replace all "{category}" with "%{_lv}%" in {_name}
  115.                 replace all "{category}" with "%{_lv}%" in {_lore}
  116.                 if lore of {Shop::shop::%{_lv}%::item} is set:
  117.                     format gui slot {Shop::shop::%{_lv}%::slot} of {_p} with {Shop::shop::%{_lv}%::item} named "%{_name}%" lored "%colored lore of {Shop::shop::%{_lv}%::item}%||%{_lore}%" to run:
  118.                         shopOpen({_p}, {_lv})
  119.                 else:
  120.                     format gui slot {Shop::shop::%{_lv}%::slot} of {_p} with {Shop::shop::%{_lv}%::item} named "%{_name}%" lored "%{_lore}%" to run:
  121.                         shopOpen({_p}, {_lv})
  122.  
  123.         loop 54 times:
  124.             if slot loop-number - 1 of {_p}'s current inventory is air:
  125.                 format gui slot (loop-number - 1) of {_p} with {Shop::shop-background::item} named ""
  126.     else:
  127.         if "%{Shop::shop::%{_cat}%::items::*}%" is not "<none>":
  128.             set {_name} to "{@menu-category-name}"
  129.             replace all "{category}" with "%{_cat}%" in {_name}
  130.             if {Shop::shop::%{_cat}%::size} is set:
  131.                 set {_size} to {Shop::shop::%{_cat}%::size}
  132.             else:
  133.                 set {_size} to 6
  134.             open virtual chest with {_size} rows named "%{_name}%" to {_p}
  135.             wait a tick
  136.             loop {Shop::shop::%{_cat}%::items::*}:
  137.                 set {_lv} to loop-value
  138.                 if {Shop::shop::%{_cat}%::items::%{_lv}%::price} = 0:
  139.                     format gui slot {_lv} of {_p} with {Shop::shop::%{_cat}%::items::%{_lv}%::item} to run:
  140.                         {Shop::shop::%{_lv}%::cmds::*} is set
  141.                         loop {Shop::shop::%{_lv}%::cmds::*}:
  142.                             set {_cmd} to loop-value-2
  143.                             replace all "[p]" with "%{_p}%" in {_cmd}
  144.                             if first 3 characters of loop-value-2 is "[c]":
  145.                                 set {_cmd} to subtext of {_cmd} from character 4 to (length of {_cmd})
  146.                                 execute console command "%{_cmd}%"
  147.                             else:
  148.                                 execute {_p} command "%loop-value-2%"
  149.                 else:
  150.                     set {_lore} to "{@menu-item-lore}"
  151.                     replace all "{price}" with "%{Shop::shop::%{_cat}%::items::%{_lv}%::price}%" in {_lore}
  152.                     if lore of {Shop::shop::%{_cat}%::items::%{_lv}%::item} is set:
  153.                         set {_lore} to "%lore of {Shop::shop::%{_cat}%::items::%{_lv}%::item}%%{_lore}%"
  154.                     format gui slot {_lv} of {_p} with {Shop::shop::%{_cat}%::items::%{_lv}%::item} lored "%colored {_lore}%" to run:
  155.                         shopBuy({_p}, {_lv}, {_cat})
  156.  
  157.             loop 54 times:
  158.                 if slot loop-number - 1 of {_p}'s current inventory is air:
  159.                     format gui slot (loop-number - 1) of {_p} with {Shop::shop-background::item} named ""
  160.                 if slot loop-number of {_p}'s current inventory is not set:
  161.                     format gui slot (loop-number - 1) of {_p} with {@menu-back-item} named "{@menu-back-name}" to run:
  162.                         shopOpen({_p}, "main")
  163.         else:
  164.             send "{@p} &cThis category has no items." to {_p}
  165.  
  166.  
  167. command /shop [<text=open>] [<text>] [<text>] [<text>]:
  168.     trigger:
  169.         if arg-1 is "help" or "h":
  170.             send ""
  171.             send "              &a&lShop &7- &a&lHelp"
  172.             send ""
  173.             send " &a/shop help &7&oShows this message."
  174.             send " &a/shop open(o) &7&oOpen shop shop."
  175.             send " &a/shop balance(bal) &7&oShows balance of you/others."
  176.             if sender has permission "shop.help":
  177.                 send " &e/shop addcategory(ac) <id(name)> <slot> <size 1-6> &7&oAdd a category to shop shop."
  178.                 send " &e/shop removecategory(rc) <id(name)> <slot> &7&oRemove a category from shop shop."
  179.                 send " &e/shop additem(ai) <category/main> <slot> <cost(number)> &7&oAdd an item to shop shop."
  180.                 send " &e/shop copyitem(ci) <category/main> <from slot> <to slot> &7&oCopy a slot to another in a category."
  181.                 send " &e/shop removeitem(ri) <category/main> <slot> <cost(number)> &7&oRemove an item from shop shop."
  182.                 send " &e/shop addcmd(acmd) <category/main> <slot> <command without /> &7&oAdd a command to a slot in shop shop."
  183.                 send " &e/shop removecmd(rcmd) <category/main> <slot> <command without /> &7&oAdd a command to a slot in shop shop. (You can use &c* &7&oto remove all commands)"
  184.                 send " &e/shop setprice <category/main> <slot> <cost(number)> &7&oSet the price of a slot."
  185.                 send " &e/shop setitem <category/main> <slot> &7&oSet the item of a slot."
  186.                 send " &e/shop cmds <category/main> <slot> &7&oShows commands of slot in shop shop (you can also remove them with 1 click here)"
  187.                 send " &e/shop give <player> <number> &7&oAdd a number of shop to a player."
  188.                 send " &e/shop take <player> <number> &7&oRemove a number of shop from a player."
  189.                 send " &e/shop set <player> <number> &7&oSet a player's shop to a number of shop."
  190.                 send " &e/shop size <category/main> <integer 1-6> &7&oSet shop shop menu size."
  191.                 send " &e/shop background(bg) &7&oSet shop shop background items to your held item."
  192.                 send ""
  193.                 json("%player%", "&f» &c&lNOTES &f«||ttp:&f&l##1 &aThe main shop shop menu is called &f'main'%nl%     &aand you can't add a category with that name%nl%&f&l##2 &aYou can add a decoration &aitem(s) such as 'Soon' to any category%nl%     &aby setting the price to 0 when adding the item%nl%     &athis will make the item not clickable.")
  194.             send ""
  195.             stop
  196.         if arg-1 is "open" or "o":
  197.             #if sender doesn't have permission "shop.shop":
  198.                 #send "{@p} &cYou don't have enough permissions to do that."
  199.                 #stop
  200.             if {Shop::shop::*} is set:
  201.                 if {Shop::shop::*} is "":
  202.                     send "{@p} &cCurrently there are no items in shop."
  203.                     stop
  204.                 send "{@p} &aOpenning shop.."
  205.                 close player's inventory
  206.                 wait 2 ticks
  207.                 shopOpen(player, "main")
  208.                 stop
  209.             else:
  210.                 send "{@p} &cCurrently there are no items in shop."
  211.                 stop
  212.         if arg-1 is "addcategory" or "ac":
  213.             if sender doesn't have permission "shop.addcategory":
  214.                 send "{@p} &cYou don't have enough permissions to do that."
  215.                 stop
  216.             if arg-2 is not set:
  217.                 send "{@p} &7Usage: &c/shop addcategory &f<name> &c<slot(integer)> <size 1-6>"
  218.                 stop
  219.             if arg-3 parsed as integer is not set:
  220.                 send "{@p} &7Usage: &c/shop addcategory <name> &f<slot(integer)> &c<size 1-6>"
  221.                 stop
  222.             if arg-4 parsed as integer is not set:
  223.                 send "{@p} &7Usage: &c/shop addcategory <name> <slot(integer)> &f<size 1-6>"
  224.                 stop
  225.             if player's tool is air:
  226.                 send "{@p} &cYou must hold an item to do that."
  227.                 stop
  228.             #if name of player's tool is not set:
  229.                 #send "{@p} &cYour item must have a name to do that."
  230.                 #stop
  231.             if arg-2 is "main":
  232.                 send "{@p} &cThis is the main category and you can't use it."
  233.                 stop
  234.             loop {Shop::shop::*}:
  235.                 if loop-value = arg-2:
  236.                     set {_exists} to true
  237.                     send "{@p} &cCategory &f%arg-2% &calready exists."
  238.                     stop
  239.             add arg-2 to {Shop::shop::*}
  240.             set {Shop::shop::%arg-2%::item} to player's tool
  241.             set {Shop::shop::%arg-2%::slot} to arg-3 parsed as integer
  242.             set {Shop::shop::%arg-2%::size} to arg-4 parsed as integer
  243.             send "{@p} &aAdded &f%arg-2% &acategory to Shop."
  244.             stop
  245.         if arg-1 is "removecategory" or "rc":
  246.             if sender doesn't have permission "shop.removecategory":
  247.                 send "{@p} &cYou don't have enough permissions to do that."
  248.                 stop
  249.             if arg-2 is not set:
  250.                 send "{@p} &7Usage: &c/shop removecategory &f<name>"
  251.                 stop
  252.             if arg-2 is "main":
  253.                 send "{@p} &cThis is the main category and you can't remove it."
  254.                 stop
  255.             loop {Shop::shop::*}:
  256.                 if loop-value = arg-2:
  257.                     set {_exists} to true
  258.             if {_exists} is not set:
  259.                 send "{@p} &f%arg-2% &ccategory doesn't exist."
  260.                 stop
  261.             delete {Shop::shop::%arg-2%::item}
  262.             delete {Shop::shop::%arg-2%::slot}
  263.             loop {Shop::shop::%arg-2%::items::*}:
  264.                 remove loop-value from {Shop::shop::%arg-2%::items::*}
  265.             delete {Shop::shop::%arg-2%::items::*}
  266.             remove arg-2 from {Shop::shop::*}
  267.             send "{@p} &aRemoved &f%arg-2% &acategory from Shop."
  268.             stop
  269.         if arg-1 is "additem" or "ai":
  270.             if sender doesn't have permission "shop.additem":
  271.                 send "{@p} &cYou don't have enough permissions to do that."
  272.                 stop
  273.             if arg-2 is not set:
  274.                 send "{@p} &7Usage: &c/shop additem &f<category> &c<slot(integer)> <cost(number)>"
  275.                 stop
  276.             if arg-3 parsed as integer is not set:
  277.                 send "{@p} &7Usage: &c/shop additem <category> &f<slot(integer)> &c<cost(number)>"
  278.                 stop
  279.             if arg-4 parsed as number is not set:
  280.                 send "{@p} &7Usage: &c/shop additem <category> <slot(integer)> &f<cost(number)>"
  281.                 stop
  282.             if player's tool is air:
  283.                 send "{@p} &cYou must hold an item to do that."
  284.                 stop
  285.             if name of player's tool is not set:
  286.                 send "{@p} &cYour item must have a name to do that."
  287.                 stop
  288.  
  289.             if arg-2 is not "main":
  290.                 loop {Shop::shop::*}:
  291.                     if loop-value = arg-2:
  292.                         set {_exists} to true
  293.                 if {_exists} is not set:
  294.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  295.                     stop
  296.                 set {_id} to arg-3 parsed as integer
  297.                 loop {Shop::shop::%arg-2%::items::*}:
  298.                     if loop-value = {_id}:
  299.                         set {_exists1} to true
  300.                         send "{@p} &cSlot &f%arg-3% &calready exists."
  301.                         stop
  302.             else:
  303.                 set {_id} to arg-3 parsed as integer
  304.                 loop {Shop::shop::*}:
  305.                     if loop-value = {_id}:
  306.                         set {_exists} to true
  307.                         send "{@p} &cSlot &f%arg-3% &calready exists."
  308.                         stop
  309.             if arg-2 is "main":
  310.                 set {_id} to arg-3 parsed as integer
  311.                 add {_id} to {Shop::shop::*}
  312.                 set {Shop::shop::%{_id}%::item} to player's tool
  313.                 set {Shop::shop::%{_id}%::price} to arg-4 parsed as number
  314.                 send "{@p} &aSlot &f%arg-3% &ahas been set to your item with cost &f%arg-4% &ashop in category &f%arg-2%&a."
  315.                 stop
  316.             else:
  317.                 set {_id} to arg-3 parsed as integer
  318.                 add {_id} to {Shop::shop::%arg-2%::items::*}
  319.                 set {Shop::shop::%arg-2%::items::%{_id}%::item} to player's tool
  320.                 set {Shop::shop::%arg-2%::items::%{_id}%::price} to arg-4 parsed as number
  321.                 send "{@p} &aSlot &f%arg-3% &ahas been set to your item with cost &f%arg-4% &ashop in category &f%arg-2%&a."
  322.                 stop
  323.  
  324.         if arg-1 is "copyitem" or "ci":
  325.             if sender doesn't have permission "shop.copyitem":
  326.                 send "{@p} &cYou don't have enough permissions to do that."
  327.                 stop
  328.             if arg-2 is not set:
  329.                 send "{@p} &7Usage: &c/shop copyitem &f<category> &c<from slot> <to slot>"
  330.                 stop
  331.             if arg-3 parsed as integer is not set:
  332.                 send "{@p} &7Usage: &c/shop copyitem <category> &f<from slot> &c<to slot>"
  333.                 stop
  334.             if arg-4 parsed as integer is not set:
  335.                 send "{@p} &7Usage: &c/shop copyitem <category> <from slot> &f<to slot>"
  336.                 stop
  337.             if arg-2 is not "main":
  338.                 loop {Shop::shop::*}:
  339.                     if loop-value = arg-2:
  340.                         set {_catExists} to true
  341.                 if {_catExists} is not set:
  342.                     send "{@p} &f%arg-2% &ccategorty doesn't exist."
  343.                     stop
  344.                 loop {Shop::shop::%arg-2%::items::*}:
  345.                     if loop-value = arg-3 parsed as integer:
  346.                         set {_oldExists} to true
  347.                     if loop-value = arg-4 parsed as integer:
  348.                         set {_newExists} to true
  349.                 if {_oldExists} is not set:
  350.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  351.                     stop
  352.                 if {_newExists} is true:
  353.                     send "{@p} &cSlot &f%arg-4% &calready exists."
  354.                     stop
  355.             else:
  356.                 loop {Shop::shop::*}:
  357.                     if loop-value = arg-3 parsed as integer:
  358.                         set {_oldExists} to true
  359.                     if loop-value = arg-4 parsed as integer:
  360.                         set {_newExists} to true
  361.                 if {_oldExists} is not set:
  362.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  363.                     stop
  364.                 if {_newExists} is true:
  365.                     send "{@p} &cSlot &f%arg-4% &calready exists."
  366.                     stop
  367.             if arg-2 is "main":
  368.                 set {_oldID} to arg-3 parsed as integer
  369.                 set {_newID} to arg-4 parsed as integer
  370.                 add {_newID} to {Shop::shop::*}
  371.                 set {Shop::shop::%{_newID}%::item} to {Shop::shop::%{_oldID}%::item}
  372.                 set {Shop::shop::%{_newID}%::price} to {Shop::shop::%{_oldID}%::price}
  373.                 set {Shop::shop::%{_newID}%::cmds::*} to {Shop::shop::%{_oldID}%::cmds::*}
  374.                 send "{@p} &aSlot &f%arg-3% &ahas been copied to slot &f%arg-4% &ain &f%arg-2% &acategory."
  375.                 stop
  376.             else:
  377.                 set {_oldID} to arg-3 parsed as integer
  378.                 set {_newID} to arg-4 parsed as integer
  379.                 add {_newID} to {Shop::shop::%arg-2%::items::*}
  380.                 set {Shop::shop::%arg-2%::items::%{_newID}%::item} to {Shop::shop::%arg-2%::items::%{_oldID}%::item}
  381.                 set {Shop::shop::%arg-2%::items::%{_newID}%::price} to {Shop::shop::%arg-2%::items::%{_oldID}%::price}
  382.                 set {Shop::shop::%arg-2%::items::%{_newID}%::cmds::*} to {Shop::shop::%arg-2%::items::%{_oldID}%::cmds::*}
  383.                 send "{@p} &aSlot &f%arg-3% &ahas been copied to slot &f%arg-4% &ain &f%arg-2% &acategory."
  384.                 stop
  385.         if arg-1 is "removeitem" or "ri":
  386.             if sender doesn't have permission "shop.removeitem":
  387.                 send "{@p} &cYou don't have enough permissions to do that."
  388.                 stop
  389.             if arg-2 is not set:
  390.                 send "{@p} &7Usage: &c/shop removeitem &f<category> &c<slot(integer)>"
  391.                 stop
  392.             if arg-3 parsed as integer is not set:
  393.                 send "{@p} &7Usage: &c/shop removeitem <category> &f<slot(integer)>"
  394.                 stop
  395.             set {_id} to arg-3 parsed as integer
  396.             if arg-2 is not "main":
  397.                 loop {Shop::shop::*}:
  398.                     if loop-value = arg-2:
  399.                         set {_exists} to true
  400.                 if {_exists} is not set:
  401.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  402.                     stop
  403.                 loop {Shop::shop::%arg-2%::items::*}:
  404.                     if loop-value = {_id}:
  405.                         set {_exists1} to true
  406.                 if {_exists1} is not set:
  407.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  408.                     stop
  409.             else:
  410.                 loop {Shop::shop::*}:
  411.                     if loop-value = {_id}:
  412.                         set {_exists} to true
  413.                 if {_exists} is not set:
  414.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  415.                     stop
  416.             if arg-2 is "main":
  417.                 delete {Shop::shop::%{_id}%::item}
  418.                 delete {Shop::shop::%{_id}%::price}
  419.                 remove {_id} from {Shop::shop::*}
  420.                 send "{@p} &aSlot &f%arg-3% &ahas been removed from &f%arg-2% &acategory."
  421.                 stop
  422.             else:
  423.                 delete {Shop::shop::%arg-2%::items::%{_id}%::item}
  424.                 delete {Shop::shop::%arg-2%::items::%{_id}%::price}
  425.                 remove {_id} from {Shop::shop::%arg-2%::items::*}
  426.                 send "{@p} &aSlot &f%arg-3% &ahas been removed from &f%arg-2% &acategory."
  427.                 stop
  428.         if arg-1 is "list" or "l":
  429.             if sender doesn't have permission "shop.list":
  430.                 send "{@p} &cYou don't have enough permissions to do that."
  431.                 stop
  432.             if arg-2 is not set:
  433.                 send "{@p} &7Usage: &c/shop list &f<category/main>"
  434.                 stop
  435.             if arg-2 is not "main":
  436.                 loop {Shop::shop::*}:
  437.                     if loop-value = arg-2:
  438.                         set {_exists} to true
  439.                 if {_exists} is not set:
  440.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  441.                     stop
  442.  
  443.                 send "&7» &aShowing items list of category &f%arg-2%&a."
  444.                 send ""
  445.  
  446.                 loop {Shop::shop::%arg-2%::items::*}:
  447.                     if {Shop::shop::%arg-2%::items::%loop-value%::cmds::*} is set:
  448.                         set {_cmds} to "%{Shop::shop::%arg-2%::items::%loop-value%::cmds::*}%"
  449.                         replace all ", " with "%nl%  &7- &a" in {_cmds}
  450.                         replace all " and " with "%nl%  &7- &a" in {_cmds}
  451.                         set {_cmds} to "%nl%&7Commands:%nl%  &7- &a%{_cmds}%"
  452.                     else:
  453.                         set {_cmds} to ""
  454.                     json("%player%", " &7- &a%loop-value%||ttp:&7Item: %{Shop::shop::%arg-2%::items::%loop-value%::item}% &7(&a%colored name of {Shop::shop::%arg-2%::items::%loop-value%::item}%&7)%nl%&7Price: %{Shop::shop::%arg-2%::items::%loop-value%::price}%%{_cmds}%")
  455.                     delete {_cmds}
  456.                 send ""
  457.                 stop
  458.  
  459.             send "&7» &aShowing items list of category &f%arg-2%&a."
  460.             send ""
  461.             loop {Shop::shop::*}:
  462.                 if {Shop::shop::%loop-value%::price} is not set:
  463.                     set {_info} to "%nl%&7Slot: &a%{Shop::shop::%loop-value%::slot}%"
  464.                 else:
  465.                     set {_info} to "%nl%&7Price: &a%{Shop::shop::%loop-value%::price}%"
  466.                 json("%player%", " &7- &a%loop-value%||ttp:&7Item: %{Shop::shop::%loop-value%::item}%%{_info}%")
  467.             send ""
  468.             stop
  469.         if arg-1 is "addcmd" or "acmd":
  470.             if sender doesn't have permission "shop.addcmd":
  471.                 send "{@p} &cYou don't have enough permissions to do that."
  472.                 stop
  473.             if arg-2 is not set:
  474.                 send "{@p} &7Usage: &c/shop addcmd &f<category> &c<slot> <cmd without />"
  475.                 stop
  476.             if arg-3 parsed as integer is not set:
  477.                 send "{@p} &7Usage: &c/shop addcmd <category> &f<slot> &c<cmd without />"
  478.                 stop
  479.             if arg-4 is not set:
  480.                 send "{@p} &7Usage: &c/shop addcmd <category> <slot> &f<cmd without />"
  481.                 stop
  482.             set {_id} to arg-3 parsed as integer
  483.             if first 4 characters of arg-3 contains "/":
  484.                 send "{@p} &cDon't include &c'/' &cin the beginning of the command."
  485.                 stop
  486.             set {_id} to arg-3 parsed as integer
  487.             if arg-2 is not "main":
  488.                 loop {Shop::shop::*}:
  489.                     if loop-value = arg-2:
  490.                         set {_catExists} to true
  491.                 if {_catExists} is not set:
  492.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  493.                     stop
  494.                 loop {Shop::shop::%arg-2%::items::*}:
  495.                     if loop-value = {_id}:
  496.                         set {_slotExists} to true
  497.                 if {_slotExists} is not set:
  498.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  499.                     stop
  500.                 add arg-4 to {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}
  501.             else:
  502.                 loop {Shop::shop::*}:
  503.                     if loop-value = {_id}:
  504.                         set {_exists} to true
  505.                 if {_exists} is not set:
  506.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  507.                     stop
  508.                 add arg-4 to {Shop::shop::%{_id}%::cmds::*}
  509.             send "{@p} &aAdded &f/%arg-4% &ato commands of slot &f%arg-3% &ain &f%arg-2% &acategory."
  510.             stop
  511.         if arg-1 is "removecmd" or "rcmd":
  512.             if sender doesn't have permission "shop.removecmd":
  513.                 send "{@p} &cYou don't have enough permissions to do that."
  514.                 stop
  515.             if arg-2 is not set:
  516.                 send "{@p} &7Usage: &c/shop removecmd &f<category> &c<slot> <cmd without /> &7&oYou can use &c* &7&oin command field to remove all commands."
  517.                 stop
  518.             if arg-3 parsed as integer is not set:
  519.                 send "{@p} &7Usage: &c/shop removecmd <category> &f<slot> &c<cmd without /> &7&oYou can use &c* &7&oin command field to remove all commands."
  520.                 stop
  521.             if arg-4 is not set:
  522.                 send "{@p} &7Usage: &c/shop removecmd <category> <slot> &f<cmd without /> &7&oYou can use &c* &7&oin command field to remove all commands."
  523.                 stop
  524.             set {_id} to arg-3 parsed as integer
  525.             if first 4 characters of arg-3 contains "/":
  526.                 send "{@p} &cDon't include &c'/' &cin the beginning of the command."
  527.                 stop
  528.             set {_id} to arg-3 parsed as integer
  529.             if arg-2 is not "main":
  530.                 loop {Shop::shop::*}:
  531.                     if loop-value = arg-2:
  532.                         set {_catExists} to true
  533.                 if {_catExists} is not set:
  534.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  535.                     stop
  536.                 loop {Shop::shop::%arg-2%::items::*}:
  537.                     if loop-value = {_id}:
  538.                         set {_slotExists} to true
  539.                 if {_slotExists} is not set:
  540.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  541.                     stop
  542.             else:
  543.                 loop {Shop::shop::*}:
  544.                     if loop-value = {_id}:
  545.                         set {_exists} to true
  546.                 if {_exists} is not set:
  547.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  548.                     stop
  549.             if arg-4 != "*":
  550.                 if arg-2 is not "main":
  551.                     if {Shop::shop::%arg-2%::items::%{_id}%::cmds::*} is not set:
  552.                         send "{@p} &cSlot &f%arg-3% &chas no command."
  553.                         stop
  554.                     loop {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}:
  555.                         if loop-value = arg-4:
  556.                             set {_cmdExists} to true
  557.                     if {_cmdExists} is not set:
  558.                         send "{@p} &cCommand doesn't exist."
  559.                         stop
  560.                     remove arg-4 from {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}
  561.                     send "{@p} &aRemoved &f/%arg-4% &afrom commands of slot &f%arg-3% &ain &f%arg-2% &acategory."
  562.                     stop
  563.                 else:
  564.                     if {Shop::shop::%{_id}%::cmds::*} is not set:
  565.                         send "{@p} &cSlot &f%arg-3% &chas no command."
  566.                         stop
  567.                     loop {Shop::shop::%{_id}%::cmds::*}:
  568.                         if loop-value = arg-4:
  569.                             set {_cmdExists} to true
  570.                     if {_cmdExists} is not set:
  571.                         send "{@p} &cCommand doesn't exist."
  572.                         stop
  573.                     remove arg-4 from {Shop::shop::%{_id}%::cmds::*}
  574.                     send "{@p} &aRemoved &f/%arg-4% &afrom commands of slot &f%arg-3% &ain &f%arg-2% &acategory."
  575.                     stop
  576.             else:
  577.                 if arg-2 is not "main":
  578.                     if {Shop::shop::%arg-2%::items::%{_id}%::cmds::*} is not set:
  579.                         send "{@p} &cSlot &f%arg-3% &chas no command."
  580.                         stop
  581.                     loop {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}:
  582.                         remove loop-value from {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}
  583.                     send "{@p} &aRemoved all commands of slot &f%arg-3% &ain &f%arg-2% &acategory."
  584.                     stop
  585.                 else:
  586.                     if {Shop::shop::%{_id}%::cmds::*} is not set:
  587.                         send "{@p} &cSlot &f%arg-3% &chas no command."
  588.                         stop
  589.                     loop {Shop::shop::%{_id}%::cmds::*}:
  590.                         remove loop-value from {Shop::shop::%{_id}%::cmds::*}
  591.                     send "{@p} &aRemoved all commands of slot &f%arg-3% &ain &f%arg-2% &acategory."
  592.                     stop
  593.         if arg-1 is "cmds":
  594.             if sender doesn't have permission "shop.cmds":
  595.                 send "{@p} &cYou don't have enough permissions to do that."
  596.                 stop
  597.             if arg-2 is not set:
  598.                 send "{@p} &7Usage: &c/shop cmds &f<category> &c<slot>"
  599.                 stop
  600.             if arg-3 parsed as integer is not set:
  601.                 send "{@p} &7Usage: &c/shop cmds <category> &f<slot>"
  602.                 stop
  603.             set {_id} to arg-3 parsed as integer
  604.             if arg-2 is "main":
  605.                 loop {Shop::shop::*}:
  606.                     if loop-value = {_id}:
  607.                         set {_exists} to true
  608.                 if {_exists} is not set:
  609.                     send "{@p} &cSlot &f%arg-2% &cdoesn't exist."
  610.                     stop
  611.                 if {Shop::shop::%{_id}%::cmds::*} is not set:
  612.                     send "{@p} &cSlot &f%arg-3% &chas no command."
  613.                     stop
  614.                 send ""
  615.                 send "{@p} &aCommands of slot &f&l%arg-3% &ain category &f%arg-2%&a:"
  616.                 send ""
  617.                 loop {Shop::shop::%{_id}%::cmds::*}:
  618.                     json("%player%", " &7» &a/%loop-value% &7&o(Hover)||ttp:&c&nClick here to remove this command.||sgt:/shop removecmd %arg-2% %arg-3% %loop-value%")
  619.                 send ""
  620.                 stop
  621.             else:
  622.                 loop {Shop::shop::*}:
  623.                     if loop-value = arg-2:
  624.                         set {_catExists} to true
  625.                 if {_catExists} is not set:
  626.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  627.                     stop
  628.                 set {_id} to arg-3 parsed as integer
  629.                 loop {Shop::shop::%arg-2%::items::*}:
  630.                     if loop-value = {_id}:
  631.                         set {_slotExists} to true
  632.                 if {_slotExists} is not set:
  633.                     send "{@p} &cSlot &f%arg-3% &cdoesn't exist."
  634.                     stop
  635.                 if {Shop::shop::%arg-2%::items::%{_id}%::cmds::*} is not set:
  636.                     send "{@p} &cSlot &f%arg-3% &chas no command."
  637.                     stop
  638.                 send ""
  639.                 send "{@p} &aCommands of slot &f&l%arg-3% &ain category &f%arg-2%&a:"
  640.                 send ""
  641.                 loop {Shop::shop::%arg-2%::items::%{_id}%::cmds::*}:
  642.                     json("%player%", " &7» &a/%loop-value% &7&o(Hover)||ttp:&c&nClick here to remove this command.||sgt:/shop removecmd %arg-2% %arg-3% %loop-value%")
  643.                 send ""
  644.                 stop
  645.         if arg-1 is "give":
  646.             if sender doesn't have permission "shop.give":
  647.                 send "{@p} &cYou don't have enough permissions to do that."
  648.                 stop
  649.             if arg-2 parsed as offlineplayer is not set:
  650.                 send "{@p} &cMissing player name."
  651.                 stop
  652.             if arg-3 parsed as number is not set:
  653.                 send "{@p} &cMissing shop amount &7&o(number)&c."
  654.                 stop
  655.             set {_p} to arg-2 parsed as offlineplayer
  656.             set {_pU} to uuid of {_p}
  657.             add (arg-3 parsed as number) to player's balance
  658.             send "{@p} &aAdded &f%arg-3% &ato &f%arg-2%&a's shop crystals. New balance: &f%player's balance%"
  659.             stop
  660.         if arg-1 is "take":
  661.             if sender doesn't have permission "shop.take":
  662.                 send "{@p} &cYou don't have enough permissions to do that."
  663.                 stop
  664.             if arg-2 parsed as offlineplayer is not set:
  665.                 send "{@p} &cMissing player name."
  666.                 stop
  667.             if arg-3 parsed as number is not set:
  668.                 send "{@p} &cMissing shop amount &7&o(number)&c."
  669.                 stop
  670.             set {_p} to arg-2 parsed as offlineplayer
  671.             set {_pU} to uuid of {_p}
  672.             remove (arg-3 parsed as number) from player's balance
  673.             send "{@p} &aRemoved &f%arg-3% &afrom &f%arg-2%&a's shop crystals. New balance: &f%player's balance%"
  674.             stop
  675.         if arg-1 is "set":
  676.             if sender doesn't have permission "shop.set":
  677.                 send "{@p} &cYou don't have enough permissions to do that."
  678.                 stop
  679.             if arg-2 parsed as offlineplayer is not set:
  680.                 send "{@p} &cMissing player name."
  681.                 stop
  682.             if arg-3 parsed as number is not set:
  683.                 send "{@p} &cMissing shop amount &7&o(number)&c."
  684.                 stop
  685.             set {_p} to arg-2 parsed as offlineplayer
  686.             set {_pU} to uuid of {_p}
  687.             set player's balance to arg-3 parsed as number
  688.             send "{@p} &f%arg-2%&a's shop crystals has been set to &f%arg-3%&a."
  689.             stop
  690.         if arg-1 is "balance" or "bal":
  691.             if sender doesn't have permission "shop.balance":
  692.                 send "{@p} &cYou don't have enough permissions to do that."
  693.                 stop
  694.             if arg-2 is not set:
  695.                 send "{@p} &aBalance: &f%{PvPLevels::playerdata::%uuid of player%::crystals}%"
  696.                 stop
  697.             else if arg-2 parsed as offlineplayer is set:
  698.                 send "{@p} &f%arg-2%&a's balance: &f%{PvPLevels::playerdata::%uuid of player%::crystals}%"
  699.                 stop
  700.         if arg-1 is "size":
  701.             if sender doesn't have permission "shop.size":
  702.                 send "{@p} &cYou don't have enough permissions to do that."
  703.                 stop
  704.             if arg-2 is not set:
  705.                 send "{@p} &7Usage: &c/shop size &f<category/main> &c<integer 1-6>"
  706.                 stop
  707.             if arg-3 parsed as integer is not set:
  708.                 send "{@p} &7Usage: &c/shop size <category/main> &f<integer 1-6>"
  709.                 stop
  710.             if arg-2 is "main":
  711.                 set {Shop::shop-size} to arg-3 parsed as integer
  712.             else:
  713.                 loop {Shop::shop::*}:
  714.                     if loop-value = arg-2:
  715.                         set {_catExists} to true
  716.                 if {_catExists} is not set:
  717.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  718.                     stop
  719.                 set {Shop::shop::%arg-2%::size} to arg-3 parsed as integer
  720.             send "{@p} &aShop size of category &f%arg-2% &ahas been set to &f%arg-3%&a."
  721.             stop
  722.         if arg-1 is "background" or "bg":
  723.             if sender doesn't have permission "shop.background":
  724.                 send "{@p} &cYou don't have enough permissions to do that."
  725.                 stop
  726.             if player's tool is air:
  727.                 send "{@p} &cYou must hold an item to do that."
  728.                 stop
  729.             set {Shop::shop-background::item} to player's tool
  730.             send "{@p} &aShop background items has been set to your tool."
  731.             stop
  732.  
  733.         if arg-1 is "setprice" or "sp":
  734.             if sender doesn't have permission "shop.setprice":
  735.                 send "{@p} &cYou don't have enough permissions to do that."
  736.                 stop
  737.             if arg-2 is not set:
  738.                 send "{@p} &7Usage: &c/shop setprice &f<category> &c<slot(integer)> <cost(number)>"
  739.                 stop
  740.             if arg-3 parsed as integer is not set:
  741.                 send "{@p} &7Usage: &c/shop setprice <category> &f<slot(integer)> &c<cost(number)>"
  742.                 stop
  743.             if arg-4 parsed as number is not set:
  744.                 send "{@p} &7Usage: &c/shop setprice <category> <slot(integer)> &f<cost(number)>"
  745.                 stop
  746.             if arg-2 is not "main":
  747.                 loop {Shop::shop::*}:
  748.                     if loop-value = arg-2:
  749.                         set {_exists} to true
  750.                 if {_exists} is not set:
  751.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  752.                     stop
  753.                 set {_id} to arg-3 parsed as integer
  754.                 loop {Shop::shop::%arg-2%::items::*}:
  755.                     if loop-value = {_id}:
  756.                         set {_exists1} to true
  757.                 if {_exists1} is not set:
  758.                     send "{@p} &cSlot &f%arg-3% &calready exists."
  759.                     stop
  760.             else:
  761.                 set {_id} to arg-3 parsed as integer
  762.                 loop {Shop::shop::*}:
  763.                     if loop-value = {_id}:
  764.                         set {_exists} to true
  765.                 if {_exists} is not set:
  766.                     send "{@p} &cSlot &f%arg-3% &calready exists."
  767.                     stop
  768.             if arg-2 is "main":
  769.                 set {_id} to arg-3 parsed as integer
  770.                 set {Shop::shop::%{_id}%::price} to arg-4 parsed as number
  771.                 send "{@p} &aSlot &f%arg-3% &aprice has been set to &f%arg-4% &ashop."
  772.                 stop
  773.             else:
  774.                 set {_id} to arg-3 parsed as integer
  775.                 set {Shop::shop::%arg-2%::items::%{_id}%::price} to arg-4 parsed as number
  776.                 send "{@p} &aSlot &f%arg-3% &7(in category &f%arg-2%&7) &aprice has been set to &f%arg-4% &ashop."
  777.                 stop
  778.  
  779.  
  780.         if arg-1 is "setitem" or "si":
  781.             if sender doesn't have permission "shop.setitem":
  782.                 send "{@p} &cYou don't have enough permissions to do that."
  783.                 stop
  784.             if arg-2 is not set:
  785.                 send "{@p} &7Usage: &c/shop setitem &f<category> &c<slot(integer)>"
  786.                 stop
  787.             if arg-3 parsed as integer is not set:
  788.                 send "{@p} &7Usage: &c/shop setitem <category> &f<slot(integer)>"
  789.                 stop
  790.             if player's tool is air:
  791.                 send "{@p} &cYou must hold an item to do that."
  792.                 stop
  793.             if name of player's tool is not set:
  794.                 send "{@p} &cYour item must have a name to do that."
  795.                 stop
  796.             if arg-2 is not "main":
  797.                 loop {Shop::shop::*}:
  798.                     if loop-value = arg-2:
  799.                         set {_exists} to true
  800.                 if {_exists} is not set:
  801.                     send "{@p} &cCategory &f%arg-2% &cdoesn't exist."
  802.                     stop
  803.                 set {_id} to arg-3 parsed as integer
  804.                 loop {Shop::shop::%arg-2%::items::*}:
  805.                     if loop-value = {_id}:
  806.                         set {_exists1} to true
  807.                 if {_exists1} is not set:
  808.                     send "{@p} &cSlot &f%arg-3% &calready exists."
  809.                     stop
  810.             else:
  811.                 set {_id} to arg-3 parsed as integer
  812.                 loop {Shop::shop::*}:
  813.                     if loop-value = {_id}:
  814.                         set {_exists} to true
  815.                 if {_exists} is not set:
  816.                     send "{@p} &cSlot &f%arg-3% &calready exists."
  817.                     stop
  818.             if arg-2 is "main":
  819.                 set {_id} to arg-3 parsed as integer
  820.                 set {Shop::shop::%{_id}%::item} to player's tool
  821.                 send "{@p} &aSlot &f%arg-3% &aitem has been set to your held item."
  822.                 stop
  823.             else:
  824.                 set {_id} to arg-3 parsed as integer
  825.                 set {Shop::shop::%arg-2%::items::%{_id}%::item} to player's tool
  826.                 send "{@p} &aSlot &f%arg-3% &7(in category &f%arg-2%&7) &aitem has been set to your held item."
  827.                 stop
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top