player shop.sk

Created by Unknown

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.

aliases:
  lime stained glass = 95:5
  yellow stained glass = 95:4
  red wool = 35:14
  lime wool = 35:5
  barrier = 166:0

function nf(i: number) :: text:
  if {_i} is less than 1000:
    return "%floor({_i} * 1000) / 1000%"
  else:
    if {_i} is less than 1000000:
      return "%floor({_i}) / 1000%K"
    else:
      if {_i} is less than 1000000000:
        return "%floor({_i} / 1000) / 1000%M"
      else:
        if {_i} is less than 1000000000000:
          return "%floor({_i} / 1000000) / 1000%B"
        else:
          if {_i} is less than 1000000000000000:
            return "%floor({_i} / 1000000000) / 1000%T"
          else:
            if {_i} is less than 1000000000000000000:
              return "%floor({_i} / 1000000000000) / 1000%Q"
            else:
              return "%floor({_i} / 1000000000000000) / 1000%Qu"

function incprice(l: location, t: text, a: number, p: player) :: text:
  if {_t} is "buy":
    add {_a} to {zmcsignshop.%{_l}%.buyprice}
    if {zmcsignshop.%{_l}%.buyprice} is less than 0:
      set {zmcsignshop.%{_l}%.buyprice} to 0
    make gui slot 3 of {_p} with paper named "&aBuy price: $%nf({zmcsignshop.%{_l}%.buyprice})%"
  else:
    add {_a} to {zmcsignshop.%{_l}%.sellprice}
    if {zmcsignshop.%{_l}%.sellprice} is less than 0:
      set {zmcsignshop.%{_l}%.sellprice} to 0
    make gui slot 3 of {_p} with paper named "&eSell price: $%nf({zmcsignshop.%{_l}%.sellprice})%"

function buypricegui(p: player, l: location) :: text:
  open virtual chest inventory with size 6 named "&aEdit Buy Price" to {_p}
  create a gui slot 3 of {_p} with paper named "&aBuy price: $%nf({zmcsignshop.%{_l}%.buyprice})%" to do nothing
  if {zmcsignshop.%{_l}%.item} is air:
    create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  else:
    create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  
  make gui slot 18 of {_p} with lime stained glass named "&a+$0.01" to run function incprice({_l}, "buy", 0.01, {_p})
  make gui slot 27 of {_p} with lime stained glass named "&a-$0.01" to run function incprice({_l}, "buy", -0.01, {_p})
  
  make gui slot 19 of {_p} with lime stained glass named "&a+$0.1" to run function incprice({_l}, "buy", 0.1, {_p})
  make gui slot 28 of {_p} with lime stained glass named "&a-$0.1" to run function incprice({_l}, "buy", -0.1, {_p})
  
  make gui slot 20 of {_p} with lime stained glass named "&a+$1" to run function incprice({_l}, "buy", 1, {_p})
  make gui slot 29 of {_p} with lime stained glass named "&a-$1" to run function incprice({_l}, "buy", -1, {_p})
  
  make gui slot 21 of {_p} with lime stained glass named "&a+$10" to run function incprice({_l}, "buy", 10, {_p})
  make gui slot 30 of {_p} with lime stained glass named "&a-$10" to run function incprice({_l}, "buy", -10, {_p})
  
  make gui slot 22 of {_p} with lime stained glass named "&a+$100" to run function incprice({_l}, "buy", 100, {_p})
  make gui slot 31 of {_p} with lime stained glass named "&a-$100" to run function incprice({_l}, "buy", -100, {_p})
  
  make gui slot 23 of {_p} with lime stained glass named "&a+$1K" to run function incprice({_l}, "buy", 1000, {_p})
  make gui slot 32 of {_p} with lime stained glass named "&a-$1K" to run function incprice({_l}, "buy", -1000, {_p})
  
  make gui slot 24 of {_p} with lime stained glass named "&a+$10K" to run function incprice({_l}, "buy", 10000, {_p})
  make gui slot 33 of {_p} with lime stained glass named "&a-$10K" to run function incprice({_l}, "buy", -10000, {_p})
  
  make gui slot 25 of {_p} with lime stained glass named "&a+$100K" to run function incprice({_l}, "buy", 100000, {_p})
  make gui slot 34 of {_p} with lime stained glass named "&a-$100K" to run function incprice({_l}, "buy", -100000, {_p})
  
  make gui slot 26 of {_p} with lime stained glass named "&a+$1M" to run function incprice({_l}, "buy", 1000000, {_p})
  make gui slot 35 of {_p} with lime stained glass named "&a-$1M" to run function incprice({_l}, "buy", -1000000, {_p})
  
  make gui slot 36 of {_p} with lime stained glass named "&a+$10M" to run function incprice({_l}, "buy", 10000000, {_p})
  make gui slot 45 of {_p} with lime stained glass named "&a-$10M" to run function incprice({_l}, "buy", -10000000, {_p})
  
  make gui slot 37 of {_p} with lime stained glass named "&a+$100M" to run function incprice({_l}, "buy", 100000000, {_p})
  make gui slot 46 of {_p} with lime stained glass named "&a-$100M" to run function incprice({_l}, "buy", -100000000, {_p})
  
  make gui slot 38 of {_p} with lime stained glass named "&a+$1B" to run function incprice({_l}, "buy", 1000000000, {_p})
  make gui slot 47 of {_p} with lime stained glass named "&a-$1B" to run function incprice({_l}, "buy", -1000000000, {_p})
  
  make gui slot 39 of {_p} with lime stained glass named "&a+$10B" to run function incprice({_l}, "buy", 10000000000, {_p})
  make gui slot 48 of {_p} with lime stained glass named "&a-$10B" to run function incprice({_l}, "buy", -10000000000, {_p})
  
  make gui slot 40 of {_p} with lime stained glass named "&a+$100B" to run function incprice({_l}, "buy", 100000000000, {_p})
  make gui slot 49 of {_p} with lime stained glass named "&a-$100B" to run function incprice({_l}, "buy", -100000000000, {_p})
  
  make gui slot 41 of {_p} with lime stained glass named "&a+$1T" to run function incprice({_l}, "buy", 1000000000000, {_p})
  make gui slot 50 of {_p} with lime stained glass named "&a-$1T" to run function incprice({_l}, "buy", -1000000000000, {_p})
  
  make gui slot 42 of {_p} with lime stained glass named "&a+$10T" to run function incprice({_l}, "buy", 10000000000000, {_p})
  make gui slot 51 of {_p} with lime stained glass named "&a-$10T" to run function incprice({_l}, "buy", -10000000000000, {_p})
  
  make gui slot 43 of {_p} with lime stained glass named "&a+$100T" to run function incprice({_l}, "buy", 100000000000000, {_p})
  make gui slot 52 of {_p} with lime stained glass named "&a-$100T" to run function incprice({_l}, "buy", -100000000000000, {_p})
  
  make gui slot 44 of {_p} with lime stained glass named "&a+$1Q" to run function incprice({_l}, "buy", 1000000000000000, {_p})
  make gui slot 53 of {_p} with lime stained glass named "&a-$1Q" to run function incprice({_l}, "buy", -1000000000000000, {_p})

function sellpricegui(p: player, l: location) :: text:
  open virtual chest inventory with size 6 named "&eEdit Sell Price" to {_p}
  create a gui slot 3 of {_p} with paper named "&eSell price: $%nf({zmcsignshop.%{_l}%.sellprice})%" to do nothing
  if {zmcsignshop.%{_l}%.item} is air:
    create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  else:
    create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  
  make gui slot 18 of {_p} with yellow stained glass named "&e+$0.01" to run function incprice({_l}, "sell", 0.01, {_p})
  make gui slot 27 of {_p} with yellow stained glass named "&e-$0.01" to run function incprice({_l}, "sell", -0.01, {_p})
  
  make gui slot 19 of {_p} with yellow stained glass named "&e+$0.1" to run function incprice({_l}, "sell", 0.1, {_p})
  make gui slot 28 of {_p} with yellow stained glass named "&e-$0.1" to run function incprice({_l}, "sell", -0.1, {_p})
  
  make gui slot 20 of {_p} with yellow stained glass named "&e+$1" to run function incprice({_l}, "sell", 1, {_p})
  make gui slot 29 of {_p} with yellow stained glass named "&e-$1" to run function incprice({_l}, "sell", -1, {_p})
  
  make gui slot 21 of {_p} with yellow stained glass named "&e+$10" to run function incprice({_l}, "sell", 10, {_p})
  make gui slot 30 of {_p} with yellow stained glass named "&e-$10" to run function incprice({_l}, "sell", -10, {_p})
  
  make gui slot 22 of {_p} with yellow stained glass named "&e+$100" to run function incprice({_l}, "sell", 100, {_p})
  make gui slot 31 of {_p} with yellow stained glass named "&e-$100" to run function incprice({_l}, "sell", -100, {_p})
  
  make gui slot 23 of {_p} with yellow stained glass named "&e+$1K" to run function incprice({_l}, "sell", 1000, {_p})
  make gui slot 32 of {_p} with yellow stained glass named "&e-$1K" to run function incprice({_l}, "sell", -1000, {_p})
  
  make gui slot 24 of {_p} with yellow stained glass named "&e+$10K" to run function incprice({_l}, "sell", 10000, {_p})
  make gui slot 33 of {_p} with yellow stained glass named "&e-$10K" to run function incprice({_l}, "sell", -10000, {_p})
  
  make gui slot 25 of {_p} with yellow stained glass named "&e+$100K" to run function incprice({_l}, "sell", 100000, {_p})
  make gui slot 34 of {_p} with yellow stained glass named "&e-$100K" to run function incprice({_l}, "sell", -100000, {_p})
  
  make gui slot 26 of {_p} with yellow stained glass named "&e+$1M" to run function incprice({_l}, "sell", 1000000, {_p})
  make gui slot 35 of {_p} with yellow stained glass named "&e-$1M" to run function incprice({_l}, "sell", -1000000, {_p})
  
  make gui slot 36 of {_p} with yellow stained glass named "&e+$10M" to run function incprice({_l}, "sell", 10000000, {_p})
  make gui slot 45 of {_p} with yellow stained glass named "&e-$10M" to run function incprice({_l}, "sell", -10000000, {_p})
  
  make gui slot 37 of {_p} with yellow stained glass named "&e+$100M" to run function incprice({_l}, "sell", 100000000, {_p})
  make gui slot 46 of {_p} with yellow stained glass named "&e-$100M" to run function incprice({_l}, "sell", -100000000, {_p})
  
  make gui slot 38 of {_p} with yellow stained glass named "&e+$1B" to run function incprice({_l}, "sell", 1000000000, {_p})
  make gui slot 47 of {_p} with yellow stained glass named "&e-$1B" to run function incprice({_l}, "sell", -1000000000, {_p})
  
  make gui slot 39 of {_p} with yellow stained glass named "&e+$10B" to run function incprice({_l}, "sell", 10000000000, {_p})
  make gui slot 48 of {_p} with yellow stained glass named "&e-$10B" to run function incprice({_l}, "sell", -10000000000, {_p})
  
  make gui slot 40 of {_p} with yellow stained glass named "&e+$100B" to run function incprice({_l}, "sell", 100000000000, {_p})
  make gui slot 49 of {_p} with yellow stained glass named "&e-$100B" to run function incprice({_l}, "sell", -100000000000, {_p})
  
  make gui slot 41 of {_p} with yellow stained glass named "&e+$1T" to run function incprice({_l}, "sell", 1000000000000, {_p})
  make gui slot 50 of {_p} with yellow stained glass named "&e-$1T" to run function incprice({_l}, "sell", -1000000000000, {_p})
  
  make gui slot 42 of {_p} with yellow stained glass named "&e+$10T" to run function incprice({_l}, "sell", 10000000000000, {_p})
  make gui slot 51 of {_p} with yellow stained glass named "&e-$10T" to run function incprice({_l}, "sell", -10000000000000, {_p})
  
  make gui slot 43 of {_p} with yellow stained glass named "&e+$100T" to run function incprice({_l}, "sell", 100000000000000, {_p})
  make gui slot 52 of {_p} with yellow stained glass named "&e-$100T" to run function incprice({_l}, "sell", -100000000000000, {_p})
  
  make gui slot 44 of {_p} with yellow stained glass named "&e+$1Q" to run function incprice({_l}, "sell", 1000000000000000, {_p})
  make gui slot 53 of {_p} with yellow stained glass named "&e-$1Q" to run function incprice({_l}, "sell", -1000000000000000, {_p})

function itemCount(p: player, i: item type) :: number:
  set {_c} to 0
  loop all items in {_p}'s inventory:
    if loop-item is {_i}:
      add amount of item loop-item to {_c}
  return {_c}

function removeItem(p: player, i: item type, a: number) :: text:
  set {_c} to {_a}
  loop all items in {_p}'s inventory:
    if {_c} > 0:
      if loop-item is {_i}:
        set {_r} to amount of item loop-item
        if {_r} is greater than {_c}:
          set {_r} to {_c}
        subtract {_r} from {_c}
        set {_r} to amount of item loop-item - {_r}
        set {_j} to 1 of loop-item
        set loop-item to {_r} of {_j}

function stockslots(p: player, l: location) :: text:
  set {_s} to 3
  set {_i} to paper named "&9Stock: %{zmcsignshop.%{_l}%.instock}%"
  set line 1 of {_i}'s lore to "&9Click on the glass to change stock!"
  loop 6 times:
    create a gui slot {_s} of {_p} with {_i} to do nothing
    create a gui slot {_s} + 2 of {_p} with {_i} to do nothing
    add 9 to {_s}

function canhold(p: player, i: item type) :: number:
  set {_c} to 0
  while {_p} has space for {_c} of {_i}:
    add 100 to {_c}
  subtract 100 from {_c}
  while {_p} has space for {_c} of {_i}:
    add 10 to {_c}
  subtract 10 from {_c}
  while {_p} has space for {_c} of {_i}:
    add 1 to {_c}
  subtract 1 from {_c}
  return {_c}

function dorestock(p: player, l: location, a: integer, t: text) :: text:
  if {zmcsignshop.%{_l}%.item} is not air:
    if {_t} is "give":
      set {_b} to {_a}
      if itemCount({_p}, {zmcsignshop.%{_l}%.item}) < {_b}:
        set {_b} to itemCount({_p}, {zmcsignshop.%{_l}%.item})
      if 2000 - {zmcsignshop.%{_l}%.instock} < {_b}:
        set {_b} to (2000 - {zmcsignshop.%{_l}%.instock})
      if {_b} > 0:
        if itemCount({_p}, {zmcsignshop.%{_l}%.item}) >= {_b}:
          removeItem({_p}, {zmcsignshop.%{_l}%.item}, {_b})
          add {_b} to {zmcsignshop.%{_l}%.instock}
        else:
          send "&cNot enough items!" to {_p}
      else:
        send "&cShop is full of items!" to {_p}
    else:
      set {_b} to {_a}
      if {_b} > {zmcsignshop.%{_l}%.instock}:
        set {_b} to {zmcsignshop.%{_l}%.instock}
      if {_b} > canhold({_p}, {zmcsignshop.%{_l}%.item}):
        set {_b} to canhold({_p}, {zmcsignshop.%{_l}%.item})
      if {_b} > 0:
        if {_p} has space for {_b} of {zmcsignshop.%{_l}%.item}:
          give {_p} {_b} of {zmcsignshop.%{_l}%.item}
          subtract {_b} from {zmcsignshop.%{_l}%.instock}
        else:
          send "&cNot enough inventory space!" to {_p}
      else:
        send "&cShop doesn't have enough itens!" to {_p}
  stockslots({_p}, {_l})

function restockslots(p: player, l: location, a: integer, i: integer, t: text) :: text:
  set {_j} to cobblestone
  if {_t} is "give":
    set {_j} to yellow stained glass named "&ePut in &l%{_a}%&e item(s)"
  else:
    set {_j} to lime stained glass named "&aTake out &l%{_a}%&a item(s)"
  create a gui slot {_i} of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})
  create a gui slot {_i} + 1 of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})
  create a gui slot {_i} + 2 of {_p} with {_j} to run function dorestock({_p}, {_l}, {_a}, {_t})

function restock(p: player, l: location) :: text:
  open virtual chest inventory with size 6 named "&9Restock Shop" to {_p}
  if {zmcsignshop.%{_l}%.item} is air:
    create a gui slot 4 of {_p} with barrier named "&4No shop item set!" to do nothing
  else:
    create a gui slot 4 of {_p} with {zmcsignshop.%{_l}%.item} to do nothing
  stockslots({_p}, {_l})
  restockslots({_p}, {_l}, 1, 0, "take")
  restockslots({_p}, {_l}, 1, 6, "give")
  restockslots({_p}, {_l}, 2, 9, "take")
  restockslots({_p}, {_l}, 2, 15, "give")
  restockslots({_p}, {_l}, 5, 18, "take")
  restockslots({_p}, {_l}, 5, 24, "give")
  restockslots({_p}, {_l}, 16, 27, "take")
  restockslots({_p}, {_l}, 16, 33, "give")
  restockslots({_p}, {_l}, 64, 36, "take")
  restockslots({_p}, {_l}, 64, 42, "give")
  restockslots({_p}, {_l}, 256, 45, "take")
  restockslots({_p}, {_l}, 256, 51, "give")

on sign change:
  if line 1 is "[Shop]":
    set line 1 to "&a[Shop]"
    set {zmcsignshop.%position of block%.set} to 1
    set {zmcsignshop.%position of block%.owner} to player
    set {zmcsignshop.%position of block%.buyprice} to 0
    set {zmcsignshop.%position of block%.sellprice} to 0
    set {zmcsignshop.%position of block%.item} to air
    set {zmcsignshop.%position of block%.instock} to 0
    set {zmcsignshop.%position of block%.enabled} to 0
    set {zmcsignshop.%position of block%.messages} to 1
    message "&eShop created!" to player

function togenabled(p: player, l: location) :: text:
  if {zmcsignshop.%{_l}%.enabled} is 1:
    set {zmcsignshop.%{_l}%.enabled} to 0
    make gui slot 14 of {_p} with red wool named "&4Shop disabled! (Click to toggle)" to run function togenabled({_p}, {_l})
  else:
    set {zmcsignshop.%{_l}%.enabled} to 1
    make gui slot 14 of {_p} with lime wool named "&aShop enabled! (Click to toggle)" to run function togenabled({_p}, {_l})

function togmsg(p: player, l: location) :: text:
  if {zmcsignshop.%{_l}%.messages} is 1:
    set {zmcsignshop.%{_l}%.messages} to 0
    make gui slot 15 of {_p} with red wool named "&4Messages disabled! (Click to toggle)" to run function togmsg({_p}, {_l})
  else:
    set {zmcsignshop.%{_l}%.messages} to 1
    make gui slot 15 of {_p} with lime wool named "&aMessages enabled! (Click to toggle)" to run function togmsg({_p}, {_l})

function shopslots(p: player, l: location) :: text:
  set {_s} to 3
  set {_i} to paper named "&9This shop's stock: %{zmcsignshop.%{_l}%.instock}% item(s)"
  set line 1 of {_i}'s lore to "&9You can only buy from"
  set line 2 of {_i}'s lore to "&9here while it has stock!"
  loop 6 times:
    create a gui slot {_s} of {_p} with {_i} to do nothing
    create a gui slot {_s} + 2 of {_p} with {_i} to do nothing
    add 9 to {_s}

function dobuy(p: player, l: location, a: integer, t: text) :: text:
  if {zmcsignshop.%{_l}%.item} is not air:
    if {_t} is "sell":
      set {_b} to {_a}
      if itemCount({_p}, {zmcsignshop.%{_l}%.item}) < {_b}:
        set {_b} to itemCount({_p}, {zmcsignshop.%{_l}%.item})
        if {_b} <= 0:
          send "&cYou don't have any items!" to {_p}
      if 2000 - {zmcsignshop.%{_l}%.instock} < {_b}:
        set {_b} to 2000 - {zmcsignshop.%{_l}%.instock}
        if {_b} <= 0:
          send "&cThis shop is full!" to {_p}
      if {_b} > 0:
        if itemCount({_p}, {zmcsignshop.%{_l}%.item}) >= {_b}:
          if {zmcsignshop.%{_l}%.owner}'s balance >= {zmcss-pd.%{_p}%.sellprice}:
            removeItem({_p}, {zmcsignshop.%{_l}%.item}, {_b})
            add {_b} to {zmcsignshop.%{_l}%.instock}
            execute console command "/eco give %{_p}% %{zmcss-pd.%{_p}%.sellprice} * {_b}%"
            execute console command "/eco take %{zmcsignshop.%{_l}%.owner}% %{zmcss-pd.%{_p}%.sellprice} * {_b}%"
            if {zmcsignshop.%{_l}%.messages} = 1:
              send "&e%{_p}% has sold %{_b}% of %{zmcsignshop.%{_l}%.item}'s display name%&e to your shop!" to {zmcsignshop.%{_l}%.owner}
          else:
            send "&cThe owner doesn't have enough money!" to {_p}
        else:
          send "&cThis shop is empty!" to {_p}
    else:
      set {_b} to {_a}
      if {_b} > {zmcsignshop.%{_l}%.instock}:
        set {_b} to {zmcsignshop.%{_l}%.instock}
        if {_b} <= 0:
          send "&cThis shop is empty!" to {_p}
      if {_b} > canhold({_p}, {zmcsignshop.%{_l}%.item}):
        set {_b} to canhold({_p}, {zmcsignshop.%{_l}%.item})
        if {_b} <= 0:
          send "&cYou don't have enough space for anything!" to {_p}
      if {_b} > 0:
        if {_p} has space for {_b} of {zmcsignshop.%{_l}%.item}:
          if {_p}'s balance >= {zmcss-pd.%{_p}%.buyprice}:
            give {_p} {_b} of {zmcsignshop.%{_l}%.item}
            subtract {_b} from {zmcsignshop.%{_l}%.instock}
            execute console command "/eco take %{_p}% %{zmcss-pd.%{_p}%.buyprice} * {_b}%"
            execute console command "/eco give %{zmcsignshop.%{_l}%.owner}% %{zmcss-pd.%{_p}%.buyprice} * {_b}%"
            if {zmcsignshop.%{_l}%.messages} = 1:
              send "&e%{_p}% has bought %{_b}% of %{zmcsignshop.%{_l}%.item}'s display name%&e from your shop!" to {zmcsignshop.%{_l}%.owner}
          else:
            send "&cYou don't have enough money to  buy that!" to {_p}
        else:
          send "&cYou don't have enough inventory space!" to {_p}
  shopslots({_p}, {_l})

function addbuyitems(p: player, l: location, a: integer, i: integer, t: text) :: text:
  set {_j} to cobblestone
  set {_e} to 0
  if {_t} is "buy":
    if {zmcsignshop.%{_l}%.buyprice} > 0:
      set {_j} to yellow stained glass named "&eBuy %{_a}% item(s)"
      set line 1 of {_j}'s lore to "&ePrice: $%nf({zmcsignshop.%{_l}%.buyprice} * {_a})%"
      set {_e} to 1
    else:
      set {_j} to red wool named "&4Buying is disabled at this shop!"
  else:
    if {zmcsignshop.%{_l}%.sellprice} > 0:
      set {_j} to lime stained glass named "&aSell %{_a}% item(s)"
      set line 1 of {_j}'s lore to "&aPrice: $%nf({zmcsignshop.%{_l}%.sellprice} * {_a})%"
      set {_e} to 1
    else:
      set {_j} to red wool named "&4Selling is disabled at this shop!"
  if {_e} is 1:
    create a gui slot {_i} of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
    create a gui slot {_i} + 1 of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
    create a gui slot {_i} + 2 of {_p} with {_j} to run function dobuy({_p}, {_l}, {_a}, {_t})
  else:
    create a gui slot {_i} of {_p} with {_j} to do nothing
    create a gui slot {_i} + 1 of {_p} with {_j} to do nothing
    create a gui slot {_i} + 2 of {_p} with {_j} to do nothing

on rightclick on sign:
  set {_ci} to stick named "&eShop Copy Wand"
  set line 1 of {_ci}'s lore to "&eShift + right click: Copy shop data"
  set line 2 of {_ci}'s lore to "&eShift + left click: Paste shop data"
  set {_copy} to 0
  if player is sneaking:
    if player's tool is {_ci}:
      set {_copy} to 1
  if line 1 of block is "&a[Shop]":
    if {zmcsignshop.%position of block%.set} is set:
      if {zmcsignshop.%position of block%.owner} is player:
        if {_copy} is 0:
          open virtual chest inventory with size 3 named "&1Shop Settings" to player
          if {zmcsignshop.%position of block%.item} is air:
            create a gui slot 10 of player with barrier named "&4No shop item set!" to do nothing
          else:
            create a gui slot 10 of player with {zmcsignshop.%position of block%.item} to do nothing
          set {_i} to lime stained glass named "&aSet player buy price"
          set line 1 of {_i}'s lore to "&aCurrent: $%nf({zmcsignshop.%position of block%.buyprice})%"
          set line 2 of {_i}'s lore to "&aSet this value to"
          set line 3 of {_i}'s lore to "&a$0 to disable buying"
          set line 4 of {_i}'s lore to "&afrom this shop."
          create a gui slot 12 of player with {_i} to run function buypricegui(player, location of block)
          set {_i} to yellow stained glass named "&eSet player sell price"
          set line 1 of {_i}'s lore to "&eCurrent: $%nf({zmcsignshop.%position of block%.sellprice})%"
          set line 2 of {_i}'s lore to "&eSet this value to"
          set line 3 of {_i}'s lore to "&e$0 to disable selling"
          set line 4 of {_i}'s lore to "&eto this shop."
          create a gui slot 13 of player with {_i} to run function sellpricegui(player, location of block)
          if {zmcsignshop.%position of block%.enabled} is 0:
            make gui slot 14 of player with red wool named "&4Shop disabled! (Click to toggle)" to run function togenabled(player, position of block)
          else:
            make gui slot 14 of player with lime wool named "&aShop enabled! (Click to toggle)" to run function togenabled(player, position of block)
          if {zmcsignshop.%position of block%.messages} is 0:
            make gui slot 15 of player with red wool named "&4Messages disabled! (Click to toggle)" to run function togmsg(player, position of block)
          else:
            make gui slot 15 of player with lime wool named "&aMessages enabled! (Click to toggle)" to run function togmsg(player, position of block)
          make gui slot 16 of player with paper named "&9Shop stock (Click to add/remove items)" to run function restock(player, position of block)
        else:
          set {zmcss-pd.%player%.clp.buyprice} to {zmcsignshop.%position of block%.buyprice}
          set {zmcss-pd.%player%.clp.sellprice} to {zmcsignshop.%position of block%.sellprice}
          set {zmcss-pd.%player%.clp.item} to {zmcsignshop.%position of block%.item}
          set {zmcss-pd.%player%.clp.messages} to {zmcsignshop.%position of block%.messages}
          send "&eShop data copied to clipboard!"
      else:
        if {zmcsignshop.%position of block%.enabled} is 1:
          if {zmcsignshop.%position of block%.item} is not air:
            open virtual chest inventory with size 6 named "&1Shop" to player
            create a gui slot 4 of player with {zmcsignshop.%position of block%.item} to do nothing
            shopslots(player, position of block)
            addbuyitems(player, position of block, 1, 0, "buy")
            addbuyitems(player, position of block, 1, 6, "sell")
            addbuyitems(player, position of block, 2, 9, "buy")
            addbuyitems(player, position of block, 2, 15, "sell")
            addbuyitems(player, position of block, 5, 18, "buy")
            addbuyitems(player, position of block, 5, 24, "sell")
            addbuyitems(player, position of block, 16, 27, "buy")
            addbuyitems(player, position of block, 16, 33, "sell")
            addbuyitems(player, position of block, 64, 36, "buy")
            addbuyitems(player, position of block, 64, 42, "sell")
            addbuyitems(player, position of block, 256, 45, "buy")
            addbuyitems(player, position of block, 256, 51, "sell")
            set {zmcss-pd.%player%.buyprice} to {zmcsignshop.%position of block%.buyprice}
            set {zmcss-pd.%player%.sellprice} to {zmcsignshop.%position of block%.sellprice}
          else:
            send "&cThis shop doesn't have an item set!"
        else:
          send "&cThis shop isn't enabled!"

on player join:
  delete {zmcss-pd.%player%.clp.buyprice}
  delete {zmcss-pd.%player%.clp.sellprice}
  delete {zmcss-pd.%player%.clp.item}
  delete {zmcss-pd.%player%.clp.messages}

on leftclick on sign:
  set {_ci} to stick named "&eShop Copy Wand"
  set line 1 of {_ci}'s lore to "&eShift + right click: Copy shop data"
  set line 2 of {_ci}'s lore to "&eShift + left click: Paste shop data"
  set {_copy} to 0
  if player is sneaking:
    if player's tool is {_ci}:
      set {_copy} to 1
  if line 1 of block is "&a[Shop]":
    if {zmcsignshop.%position of block%.set} is set:
      if {zmcsignshop.%position of block%.owner} is player:
        if {_copy} is 1:
          if {zmcsignshop.%position of block%.instock} is 0:
            set {zmcsignshop.%position of block%.buyprice} to {zmcss-pd.%player%.clp.buyprice}
            set {zmcsignshop.%position of block%.sellprice} to {zmcss-pd.%player%.clp.sellprice}
            set {zmcsignshop.%position of block%.item} to {zmcss-pd.%player%.clp.item}
            set {zmcsignshop.%position of block%.messages} to {zmcss-pd.%player%.clp.messages}
            message "&eShop data was pasted." to player
          else:
            message "&cRemove all of the items from the shop stock to paste shop data." to player
        else:
          if player's tool is not air:
            if {zmcsignshop.%position of block%.instock} is 0:
              set {zmcsignshop.%position of block%.item} to 1 of player's tool
              message "&eShop item changed to the item in your hand." to player
            else:
              message "&cRemove all of the items from the shop stock to change the shop item." to player

on break of sign:
  if {zmcsignshop.%position of block%.set} is set:
    if {zmcsignshop.%position of block%.owner} is player:
      if {zmcsignshop.%position of block%.instock} = 0:
        delete {zmcsignshop.%position of block%.set}
        delete {zmcsignshop.%position of block%.owner}
        delete {zmcsignshop.%position of block%.buyprice}
        delete {zmcsignshop.%position of block%.sellprice}
        delete {zmcsignshop.%position of block%.item}
        delete {zmcsignshop.%position of block%.instock}
        delete {zmcsignshop.%position of block%.enabled}
        delete {zmcsignshop.%position of block%.messages}
        send "&eShop destroyed!" to player
      else:
        cancel event
        message "&cRemove all the items from this shop to destroy it." to player
    else:
      cancel event
      message "&cThis is not your shop! You cannot destroy it!" to player

command /playershop [<text>] [<text>] [<text>]:
  description: &eUsed for editing the Player Shop skript, and more!
  trigger:
    set {_pl} to "%sender%" parsed as player
    if arg 1 is not set:
      set {_p} to 0
      send "&eSubcommands of /playershop" to sender
      send "&7-----" to sender
      if {_pl} has permission "playershop.item":
        send "&6&l/playershop item&e: Gives you an item that is related to the shop system." to sender
        set {_p} to 1
      if {_p} is 0:
        send "&cYou don't have permission for any of the subcommands of /playershop. Let a staff member know if you think that this is a mistake." to sender
    else:
      if arg 1 is "item":
        if {_pl} has permission "playershop.item":
          if arg 2 is not set:
            set {_p} to 0
            send "&eSubcommands of /playershop item" to sender
            send "&7-----" to sender
            if {_pl} has permission "playershop.item.copywand":
              send "&6&l/playershop item copywand&e: Gives you a shop copy wand. This allows you to copy shop data from one shop to another." to sender
              set {_p} to 1
            if {_p} is 0:
              send "&cYou don't have permission for any of the subcommands of /playershop item. Let a staff member know if you think that this is a mistake." to sender
          if arg 2 is "copywand":
            set {_i} to stick named "&eShop Copy Wand"
            set line 1 of {_i}'s lore to "&eShift + right click: Copy shop data"
            set line 2 of {_i}'s lore to "&eShift + left click: Paste shop data"
            give {_i} to {_pl}
        else:
          send "&cYou don't have permission for this command!" to sender