Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.90 KB | None | 0 0
  1. options:
  2. #Title that is displayed in chat and guis
  3. loottitle: &eLootchest &8|
  4.  
  5. #Main color:
  6. lootc1: &e
  7.  
  8. #Chest refill timer
  9. chestref: 3 seconds
  10.  
  11. on break:
  12. if {lootchests::%event-location%} is set:
  13. player has permission "lootchest.break":
  14. delete {lootchests::%event-location%::*}
  15. delete {lootchests::%event-location%}
  16. send "{@loottitle} &7Lootchest destroyed!"
  17. else:
  18. cancel event
  19.  
  20. command /lootchest [<text>] [<text>] [<text>]:
  21. aliases: lc
  22. trigger:
  23. player has permission "lootchest.use":
  24. if arg 1 is "set":
  25. target block is chest or trapped chest:
  26. set {lootchests::%location of target block%} to location of target block
  27. send "{@loottitle} &7Your target chest is now a lootchest!"
  28. else if arg 1 is "delete":
  29. if arg 2 is set:
  30. delete {lootchests::%arg 2%::*}
  31. delete {lootchests::%arg 2%}
  32. send "{@loottitle} &7Lootchest deleted!"
  33. else:
  34. target block is chest or trapped chest:
  35. if {lootchests::%location of target block%} is set:
  36. delete {lootchests::%location of target block%::*}
  37. delete {lootchests::%location of target block%}
  38. send "{@loottitle} &7Lootchest deleted!"
  39. else:
  40. send "{@loottitle} &7Seems like your target chest is not a lootchest!"
  41. else if arg 1 is "add":
  42. target block is chest or trapped chest:
  43. if {lootchests::%location of target block%} is set:
  44. player's tool is not air:
  45. if arg 2 is set:
  46. if arg 2 contains "-":
  47. set {_x::*} to arg 2 split at "-"
  48. if {_x::1} matches "\d+":
  49. if {_x::2} matches "\d+":
  50. set {_z} to size of {lootchests::%location of target block%::items::*}
  51. set {lootchests::%location of target block%::items::%{_z}%} to player's tool
  52. set {lootchests::%location of target block%::items::%{_z}%::amount} to arg 2
  53. send "{@loottitle} &7You added {@lootc1}%player's tool% &7with a varying amount of {@lootc1}%{_x::1}% &7to {@lootc1}%{_x::2}% &7items to the lootbox!"
  54. else:
  55. send "{@loottitle} &7Seems like there's an error with the upper end of your amount! Example: {@lootc1}/lc add 10-15 &8| <ttp:&7This makes the item amount vary between 10 and 15>&7[i]<reset>"
  56. else:
  57. send "{@loottitle} &7Seems like there's an error with the lower end of your amount! Example: {@lootc1}/lc add 10-15 &8| <ttp:&7This makes the item amount vary between 10 and 15>&7[i]<reset>"
  58. else:
  59. send "{@loottitle} &7Seems like there's an error with your amount! Example: {@lootc1}/lc add 10-15 &8| <ttp:&7This makes the item amount vary between 10 and 15>&7[i]<reset>"
  60. else:
  61. send "{@loottitle} &7Please write the amount for {@lootc1}%player's tool%&7! Example: {@lootc1}/lc add 10-15 &8| <ttp:&7This makes the item amount vary between 10 and 15>&7[i]<reset>"
  62. else:
  63. send "{@loottitle} &7Please hold an item you want to add to the lootchest!"
  64. else:
  65. send "{@loottitle} &7Seems like your target chest is not a lootchest!"
  66. else if arg 1 is "remove":
  67. if arg 2 is set:
  68. if {lootchests::%arg 2%} is set:
  69. if arg 3 is set:
  70. loop {lootchests::%arg 2%::items::*}:
  71. set {_item} to uncolored "%loop-value%"
  72. if {_item} = arg 3:
  73. delete {lootchests::%arg 2%::items::%loop-index%}
  74. delete {lootchests::%arg 2%::items::%loop-index%::amount}
  75. exit loop
  76. send "{@loottitle} {@lootc1}%arg 3% &7has been removed from {@lootc1}%arg 2%&7!"
  77. else:
  78. send "{@loottitle} &7Please write the item you want to remove from {@lootc1}%arg 2%&7!"
  79. else:
  80. send "{@loottitle} &7Seems like {@lootc1}%arg 2% &7is not a lootchest!"
  81. else:
  82. send "{@loottitle} &7Please write the lootchest you want to remove an item from!"
  83. else if arg 1 is "info":
  84. if arg 2 is set:
  85. if {lootchests::%arg 2%} is set:
  86. set {_lootchest} to arg 2
  87. else:
  88. send "{@loottitle} &7Seems like {@lootc1}%arg 2% is not a lootchest!"
  89. else:
  90. target block is chest or trapped chest:
  91. set {_lootchest} to "%{lootchests::%location of target block%}%"
  92. replace "x: ", "y: ", "z: " and " " in {_lootchest} with ""
  93. set {_lootchest} to "%world of target block%:%{_lootchest}%"
  94. if {lootchests::%{_lootchest}%} is set:
  95. if size of {lootchests::%{_lootchest}%::items::*} > 0:
  96. send "{@loottitle} &7List of items in the target lootchest:"
  97. send " "
  98. loop {lootchests::%{_lootchest}%::items::*}:
  99. set {_amount} to {lootchests::%{_lootchest}%::items::%loop-index%::amount}
  100. replace "-" in {_amount} with " &7to {@lootc1}"
  101. set {_item} to uncolored "%{lootchests::%{_lootchest}%::items::%loop-index%}%"
  102. send formatted "&7○ {@lootc1}%{lootchests::%{_lootchest}%::items::%loop-index%}% &8| &7Amount: {@lootc1}%{_amount}% &8| <ttp:&7Click to remove.><cmd:/lootchest remove %{_lootchest}% %{_item}%>&c[X]<reset>"
  103. else:
  104. send "{@loottitle} &7Seems like this lootchest doesn't contain any items yet!"
  105. else:
  106. send "{@loottitle} &7Seems like your target chest is not a lootchest!"
  107. else if arg 1 is "list":
  108. if size of {lootchests::*} > 0:
  109. send "{@loottitle} &7List of all current lootchests:"
  110. send " "
  111. loop {lootchests::*}:
  112. set {_x::*} to loop-index split at ":"
  113. set {_world} to {_x::1}
  114. set {_x::*} to {_x::2} split at ","
  115. send formatted "&7○ {@lootc1}Lootchest <ttp:{@lootc1}X: &7%{_x::1}% {@lootc1}Y: &7%{_x::2}% {@lootc1}Z: &7%{_x::3}% &7in world {@lootc1}%{_world}%>&7[Loc]<reset> &8| <ttp:&7Click to teleport><cmd:/lootchest tp %loop-index%>&5[TP]<reset> &8| <ttp:&7Click to receive info><cmd:/lootchest info %loop-index%><##4dffa6>[Info]<reset> &8| <ttp:&7Click to delete><cmd:/lootchest delete %loop-index%>&c[Del]<reset>"
  116. else:
  117. send "{@loottitle} &7Seems like no lootchests are set up yet!"
  118. else if arg 1 is "tp":
  119. if arg 2 is set:
  120. teleport player to {lootchests::%arg 2%}
  121. else:
  122. send "{@loottitle} &7Please decide to which lootchest you want to get teleported to!"
  123. else if arg 1 is "preset":
  124. if {lootchests::%location of target block%} is set:
  125. set {_x} to "%{lootchests::%location of target block%}%"
  126. replace "x: ", "y: ", "z: " and " " in {_x} with ""
  127. set {_x} to "%world of target block%:%{_x}%"
  128. give chest named "{@lootc1}Lootchest &7Preset" with lore "" and "&7Preset of: {@lootc1}%{_x}%" to player
  129. send "{@loottitle} &7You received a preset of the lootchest {@lootc1}%{_x}%&7!"
  130. else:
  131. send "{@loottitle} &7Seems like your target chest is not a lootchest!"
  132. else:
  133. send "{@loottitle} &7Please write what you want to do:"
  134. send " "
  135. send formatted "&7○ {@lootc1}/lootchest set &8| <ttp:&7Converts the target chest to a lootchest>&7[i]<reset>"
  136. send formatted "&7○ {@lootc1}/lootchest delete &8| <ttp:&7Converts the target chest back to a normal chest>&7[i]<reset>"
  137. send formatted "&7○ {@lootc1}/lootchest add <min-max>&8| <ttp:&7Adds your tool to the target lootchest>&7[i]<reset> &8| &7Example: /lootchest add 7-18"
  138. send formatted "&7○ {@lootc1}/lootchest remove &8| <ttp:&7Removes items from the target lootchest>&7[i]<reset>"
  139. send formatted "&7○ {@lootc1}/lootchest info &8| <ttp:&7Gives you info about your target lootchest>&7[i]<reset>"
  140. send formatted "&7○ {@lootc1}/lootchest list &8| <ttp:&7Gives you a list of all lootchests>&7[i]<reset>"
  141. send formatted "&7○ {@lootc1}/lootchest preset &8| <ttp:&7Gives you a preset of your target lootchest>&7[i]<reset>"
  142. else:
  143. send "{@loottitle} &cYou don't have the required permission to use this command!"
  144.  
  145. on place:
  146. if name of player's tool contains "{@lootc1}Lootchest &7Preset":
  147. set {_x::*} to uncolored line 2 of lore of player's tool split at "of: "
  148. add "{CustomName:""text""}" to nbt of block at event-location
  149. if {lootchests::%{_x::2}%} is set:
  150. set {lootchests::%event-location%} to event-location
  151. set {lootchests::%event-location%::items::*} to {lootchests::%{_x::2}%::items::*}
  152. send "{@loottitle} &7Placed lootchest with the following preset:"
  153. send "{@loottitle} {@lootc1}%{_x::2}%"
  154. else:
  155. send "{@loottitle} &7Seems like that preset doesn't exist anymore!"
  156.  
  157. every {@chestref}:
  158. if size of {lootchests::*} > 0:
  159. loop {lootchests::*}:
  160. if size of {lootchests::%loop-index%::items::*} > 0:
  161. clear inventory of block at {lootchests::%loop-index%}
  162. loop {lootchests::%loop-index%::items::*}:
  163. set {_item} to {lootchests::%loop-index-1%::items::%loop-index-2%}
  164. set {_amount::*} to {lootchests::%loop-index-1%::items::%loop-index-2%::amount} split at "-"
  165. set {_amount} to a random integer between {_amount::1} parsed as integer and {_amount::2} parsed as integer
  166. set {_z} to a random integer between 0 and 26
  167. set {_inv} to inventory of block at {lootchests::%loop-index-1%}
  168. set slot {_z} of {_inv} to {_amount} of {_item}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement