Advertisement
Guest User

Enchant GUI

a guest
Mar 18th, 2022
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.12 KB | None | 0 0
  1. options:
  2. p: &6&lENCHANTS&8 | &7
  3. perm: enchant.sk
  4. permmsg: &cHey! &7You can not not this command yet.
  5.  
  6. loadmsg: true #IF IT WILL SEND THE LOAD MESSAGE
  7.  
  8.  
  9. usecoins: false #IF "FALSE" WILL BE FREE
  10. money: {coins.%player's uuid%} #THE MONE YOUR FOR YOUR SERVER
  11. encantcost: 500 #SINGLE ENCHANT COST
  12. maxenchantcost: 2500 #MAX ENCHANT SOCY
  13.  
  14. closeinv: false #SAYS IF THE PLAYER'S INVENTORY WILL BE CLOSED ON AN UPGRADE
  15.  
  16. on load:
  17. set {All.item.enchants.list::*} to "Unbreaking", "Mending", "Curse of Binding", and "Curse of Vanishing"
  18. #FISHING ENCHANTS
  19. set {Fishing.item.1.enchants.list::*} to "Channeling", "Impaling", "Luck of the Sea", "Lure", and "Loyalty"
  20. set {Fishing.item.2.enchants.list::*} to "Riptide"
  21. #WEAPON ENCHANTS
  22. set {Weapons.item.1.enchants.list::*} to "Bane of Arthropods", "Fire Aspect", "Flame", "Infinity", and "Knockback"
  23. set {Weapons.item.2.enchants.list::*} to "Looting", "Multishot", "Power", "Punch", and "Piercing"
  24. set {Weapons.item.3.enchants.list::*} to "Quick Charge", "Sharpness", "Smite", and "Sweeping Edge"
  25. #TOOL ENCHANTS
  26. set {Tools.item.enchants.list::*} to "Efficiency", "Fortune", and "Silk Touch"
  27. #ARMOR ENCHANTS
  28. set {Armor.item.1.enchants.list::*} to "Aqua Affinity", "Blast Protection", "Depth Strider", "Feather Falling", and "Fire Protection"
  29. set {Armor.item.2.enchants.list::*} to "Frost Walker", "Projectile Protection", "Protection", "Respiration", and "Soul Speed"
  30. set {Armor.item.3.enchants.list::*} to "Thorns"
  31. #MESSAGE
  32. if {@loadmsg}:
  33. broadcast "{@p}All Enchants loaded!"
  34.  
  35.  
  36. command enchant [<text>]:
  37. #permission: {@perm} #Delete "#"at the start to use perms
  38. #permission message: {@permmsg} #Delete "#"at the start to use perm messgae
  39. trigger:
  40. if player is not holding air:
  41. if arg-1 is not set:
  42. send "{@p}Opening the enchant GUI"
  43. set metadata tag "ENCHANT" of player to chest inventory with 3 rows named "&6&lEnchant &7GUI"
  44. loop 28 times:
  45. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  46.  
  47. set slot 10 of metadata tag "ENCHANT" of player to player's tool
  48.  
  49. if {max.%player%} is set:
  50. set slot 11 of metadata tag "ENCHANT" of player to red stained glass pane named "&7E-MAX" with lore " " and " &8&l| &7&cClick to turn E-Max off"
  51. else:
  52. set slot 11 of metadata tag "ENCHANT" of player to Green stained glass pane named "&7E-MAX" with lore " " and " &8&l| &7&cClick to turn E-Max on"
  53.  
  54. set slot 12 of metadata tag "ENCHANT" of player to book named "&7BASIC" with lore " " and " &8&l| &7Click to open the &cBasic&7 Enchants!" and " "
  55. set slot 13 of metadata tag "ENCHANT" of player to book named "&7FISHING" with lore " " and " &8&l| &7Click to open the &cFishing&7 Enchants!" and " "
  56. set slot 14 of metadata tag "ENCHANT" of player to book named "&7WEAPON" with lore " " and " &8&l| &7Click to open the &cWeapon&7 Enchants!" and " "
  57. set slot 15 of metadata tag "ENCHANT" of player to book named "&7TOOLS" with lore " " and " &8&l| &7Click to open the &cTool&7 Enchants!" and " "
  58. set slot 16 of metadata tag "ENCHANT" of player to book named "&7ARMOR" with lore " " and " &8&l| &7Click to open the &cArmor&7 Enchants!" and " "
  59. if player is holding an fishing rod or trident:
  60. set slot 13 of metadata tag "ENCHANT" of player to glowing book named "&7FISHING" with lore " " and " &8&l| &7Click to open the &cFishing&7 Enchants!" and " "
  61. if player is holding a sword or bow or axe:
  62. set slot 14 of metadata tag "ENCHANT" of player to glowing book named "&7WEAPON" with lore " " and " &8&l| &7Click to open the &cWeapon&7 Enchants!" and " "
  63. if player is holding an pickaxe or axe or shovel or hoe:
  64. set slot 15 of metadata tag "ENCHANT" of player to glowing book named "&7TOOLS" with lore " " and " &8&l| &7Click to open the &cTool&7 Enchants!" and " "
  65. if player is holding armor:
  66. set slot 16 of metadata tag "ENCHANT" of player to glowing book named "&7ARMOR" with lore " " and " &8&l| &7Click to open the &cArmor&7 Enchants!" and " "
  67.  
  68. wait 1 ticks
  69. open (metadata tag "ENCHANT" of player) to player
  70. if arg-1 is "Basic":
  71. set metadata tag "ENCHANT" of player to chest inventory with 3 rows named "&6&lEnchant &7GUI"
  72. loop 28 times:
  73. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  74.  
  75. set slot 10 of metadata tag "ENCHANT" of player to player's tool with lore " " and " &8&l| &cClick to go back"
  76.  
  77. set {_n} to 12
  78. loop {All.item.enchants.list::*}:
  79. set slot {_n} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  80. add 1 to {_n}
  81.  
  82. wait 1 ticks
  83. open (metadata tag "ENCHANT" of player) to player
  84. if arg-1 is "Fishing":
  85. set metadata tag "ENCHANT" of player to chest inventory with 4 rows named "&6&lEnchant &7GUI"
  86. loop 37 times:
  87. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  88.  
  89. set slot 10 of metadata tag "ENCHANT" of player to player's tool with lore " " and " &8&l| &cClick to go back"
  90.  
  91. set {_n} to 12
  92. loop {Fishing.item.1.enchants.list::*}:
  93. set slot {_n} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  94. add 1 to {_n}
  95. set {_n} to 21
  96. loop {Fishing.item.2.enchants.list::*}:
  97. set slot {_n} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  98. add 1 to {_n}
  99.  
  100. wait 1 ticks
  101. open (metadata tag "ENCHANT" of player) to player
  102. if arg-1 is "Weapon":
  103. set metadata tag "ENCHANT" of player to chest inventory with 5 rows named "&6&lEnchant &7GUI"
  104. loop 46 times:
  105. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  106.  
  107. set slot 10 of metadata tag "ENCHANT" of player to player's tool with lore " " and " &8&l| &cClick to go back"
  108.  
  109. set {_n.1} to 12
  110. loop {Weapons.item.1.enchants.list::*}:
  111. set slot {_n.1} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  112. add 1 to {_n.1}
  113. set {_n.2} to 21
  114. loop {Weapons.item.2.enchants.list::*}:
  115. set slot {_n.2} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  116. add 1 to {_n.2}
  117. set {_n.2} to 30
  118. loop {Weapons.item.3.enchants.list::*}:
  119. set slot {_n.2} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  120. add 1 to {_n.2}
  121.  
  122. wait 1 ticks
  123. open (metadata tag "ENCHANT" of player) to player
  124. if arg-1 is "Tools":
  125. set metadata tag "ENCHANT" of player to chest inventory with 3 rows named "&6&lEnchant &7GUI"
  126. loop 28 times:
  127. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  128.  
  129. set slot 10 of metadata tag "ENCHANT" of player to player's tool with lore " " and " &8&l| &cClick to go back"
  130.  
  131. set {_n} to 12
  132. loop {Tools.item.enchants.list::*}:
  133. set slot {_n} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  134. add 1 to {_n}
  135.  
  136. wait 1 ticks
  137. open (metadata tag "ENCHANT" of player) to player
  138. if arg-1 is "Armor":
  139. set metadata tag "ENCHANT" of player to chest inventory with 5 rows named "&6&lEnchant &7GUI"
  140. loop 46 times:
  141. set slot (loop-value - 1) of metadata tag "ENCHANT" of player to gray stained glass pane named " "
  142.  
  143. set slot 10 of metadata tag "ENCHANT" of player to player's tool with lore " " and " &8&l| &cClick to go back"
  144.  
  145. set {_n.1} to 12
  146. loop {Armor.item.1.enchants.list::*}:
  147. set slot {_n.1} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  148. add 1 to {_n.1}
  149. set {_n.2} to 21
  150. loop {Armor.item.2.enchants.list::*}:
  151. set slot {_n.2} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  152. add 1 to {_n.2}
  153. set {_n.2} to 30
  154. loop {Armor.item.3.enchants.list::*}:
  155. set slot {_n.2} of metadata tag "ENCHANT" of player to enchanted book named "&b%loop-value%" with lore " " and " &8&l| &7Costs &c{@encantcost}&7 to apply!" and " "
  156. add 1 to {_n.2}
  157.  
  158. wait 1 ticks
  159. open (metadata tag "ENCHANT" of player) to player
  160. else:
  161. send "{@p}&cPlease hold an item! &8(Not air)"
  162.  
  163.  
  164. on inventory click:
  165. if event-inventory = (metadata tag "ENCHANT" of player):
  166. cancel event
  167. if index of event-slot is 10:
  168. make player say "/enchant"
  169. if index of event-slot is 11:
  170. if event-item is red stained glass pane or green stained glass pane:
  171. if {max.%player%} is set:
  172. delete {max.%player%}
  173. else:
  174. set {max.%player%} to true
  175. wait 1 tick
  176. make player say "/enchant"
  177. if event-item is a book:
  178. set {_page} to uncolored event-item's name
  179. make player say "/enchant %{_page}%"
  180. if event-item is a enchanted book:
  181. play sound "entity.experience_orb.pickup" with volume 0.5 to the player
  182. if {@closeinv}:
  183. close player's inventory
  184. if {@usecoins}:
  185. if {max.%player%} is set:
  186. set {_cost} to {@maxenchantcost}
  187. else:
  188. set {_cost} to {@encantcost}
  189.  
  190. if {@money} is less than {_cost}:
  191. send "{@p}&cYou need more money!"
  192. stop
  193. else:
  194. remove {_cost} from {@money}
  195. send action bar "{@p}&c-{_cost}" to player
  196. set {_enchanment} to uncolored event-item's name
  197. set {_ench::*} to enchantments of player's tool
  198. if {_ench::*} is not set:
  199. add(player, "%{_enchanment}%")
  200. stop
  201. if "%{_ench::*}%" contains "%{_enchanment}%":
  202. upgrade(player, "%{_enchanment}%")
  203. stop
  204. else:
  205. add(player, "%{_enchanment}%")
  206. stop
  207.  
  208. command add [<string>]:
  209. permission: {@perm}
  210. permission message: {@permmsg}
  211. trigger:
  212. if arg-1 is set:
  213. add(player, "%arg-1%")
  214.  
  215. command upgrade [<string>]:
  216. permission: {@perm}
  217. permission message: {@permmsg}
  218. trigger:
  219. if arg-1 is set:
  220. upgrade(player, "%arg-1%")
  221.  
  222.  
  223. function add(p: player, ench: string):
  224. if {max.%{_p}%} is set:
  225. enchant {_p}'s tool with ("%{_ench}% 5" parsed as an enchantment type)
  226. send "{@p}&c%{_ench}%&7 was maxed out" to {_p}
  227. else:
  228. send "{@p}Added &c%{_ench}%&7 to your item" to {_p}
  229. enchant {_p}'s tool with ("%{_ench}% 1" parsed as an enchantment type)
  230.  
  231.  
  232. function upgrade(p: player, ench: string):
  233. if "%enchantments of {_p}'s tool%" contains "%{_ench}%":
  234. set {_e.name} to {_ench}
  235. loop enchantments of {_p}'s tool:
  236. if "%loop-value%" contains "%{_ench}%":
  237. set {_lvl::*} to split "%loop-value%" by " "
  238. loop {_lvl::*}:
  239. if "%loop-value%" is "1":
  240. set {_n} to (loop-value parsed as an int)
  241. set {_e.lvl} to ({_n} + 1)
  242. if "%loop-value%" is "2":
  243. set {_n} to (loop-value parsed as an int)
  244. set {_e.lvl} to ({_n} + 1)
  245. if "%loop-value%" is "3":
  246. set {_n} to (loop-value parsed as an int)
  247. set {_e.lvl} to ({_n} + 1)
  248. if "%loop-value%" is "4":
  249. set {_n} to (loop-value parsed as an int)
  250. set {_e.lvl} to ({_n} + 1)
  251. if "%loop-value%" is "5":
  252. set {_e.lvl} to "%loop-value%"
  253. send "{@p}&c%{_e.name}%&c is at its max level (%{_e.lvl}%)!" to {_p}
  254. stop
  255. else:
  256. send "{@p}That enchant is not on this item!" to {_p}
  257. stop
  258. #send "%{_e.name}%" to {_p}
  259. #send "%{_e.lvl}%" to {_p}
  260. if {max.%{_p}%} is set:
  261. enchant {_p}'s tool with ("%{_e.name}% 5" parsed as an enchantment type)
  262. send "{@p}&c%{_e.name}%&7 was maxed out" to {_p}
  263. else:
  264. enchant {_p}'s tool with ("%{_e.name}% %{_e.lvl}%" parsed as an enchantment type)
  265. send "{@p}&c%{_e.name}%&8(+1)" to {_p}
  266.  
  267.  
  268.  
  269.  
  270.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement