· 5 years ago · May 21, 2020, 12:34 PM
1options:
2 zs: 6 and 7, 8, 15, 16, 17, 26, 27, 28, 35, 36, 37, 46, 47, 48, 55, 56, 57
3 bars: 7 and 16, 17, 25, 34, 43, 41, 32, 14, 5
4 bl: 0 and 1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44
5 s: sharpness and fire aspect, knockback, smite, looting
6 a: protection and fire protection, blast protection, projectile protection, thorns, feather falling
7 t: efficiency and fortune, silk touch
8 b: flame and infinity, punch, power
9
10function qeReload(t: text):
11 set {qeopt::po} to single value "particles" get of "plugins/QEnchant/config.yml"
12 set {qeopt::pt} to single value "particle" get of "plugins/QEnchant/config.yml"
13 set {qelore::*} to value list "lore" get of "plugins/QEnchant/gui.yml"
14 set {qeitem} to single value "item" get of "plugins/QEnchant/gui.yml" parsed as itemtype
15 set {qename} to single value "name" get of "plugins/QEnchant/gui.yml"
16 set {qegn} to single value "gname" get of "plugins/QEnchant/gui.yml"
17 set {qegui::item::random} to single value "items.random" get of "plugins/QEnchant/gui.yml" parsed as itemtype
18 set {qegui::item::repair} to single value "items.repair" get of "plugins/QEnchant/gui.yml" parsed as itemtype
19 set {qegui::item::name} to single value "items.name" get of "plugins/QEnchant/gui.yml" parsed as itemtype
20 set {qegui::item::book} to single value "items.books" get of "plugins/QEnchant/gui.yml" parsed as itemtype
21 set {qegui::name::repair} to single value "names.repair" get of "plugins/QEnchant/gui.yml"
22 set {qegui::name::random} to single value "names.random" get of "plugins/QEnchant/gui.yml"
23 set {qegui::name::name} to single value "names.name" get of "plugins/QEnchant/gui.yml"
24 set {qegui::name::book} to single value "names.books" get of "plugins/QEnchant/gui.yml"
25
26function qeUnbr(g: player):
27 loop integers between 1 to 3:
28 set {_nu::%loop-number%} to colored {qename}
29 set {_lvlu::%loop-number%} to single value "prices.unbreaking.%loop-number%.LvL" get of "plugins/QEnchant/config.yml" parsed as integer
30 set {_cnu::%loop-number%} to single value "custom.unbreaking" get of "plugins/QEnchant/gui.yml"
31 set {_bibu::%loop-number%} to single value "prices.unbreaking.%loop-number%.Bookshelfs" get of "plugins/QEnchant/config.yml" parsed as integer
32 if {_cnu::%loop-number%} is set:
33 replace all "_ENCHANTMENT_" in {_nu::%loop-number%} with "%{_cnu::%loop-number%}%"
34 else:
35 replace all "_ENCHANTMENT_" in {_nu::%loop-number%} with "Unbreaking"
36 replace all "_ELVL_" in {_nu::%loop-number%} with "%loop-number%"
37 set {_lu::%loop-number%} to "%colored {qelore::*}%"
38 replace all " and " with "||" in {_lu::%loop-number%}
39 replace all " , " with "||" in {_lu::%loop-number%}
40 replace all "_LVL_" with "%{_lvlu::%loop-number%}%" in {_lu::%loop-number%}
41 replace all "_BOOK_" with "%{_bibu::%loop-number%}%" in {_lu::%loop-number%}
42 if loop-number is 1:
43 set slot 26 of {_g}'s current inventory to {qeitem} named "%{_nu::%loop-number%}%" with lore "%{_lu::%loop-number%}%"
44 else if loop-number is 2:
45 set slot 35 of {_g}'s current inventory to {qeitem} named "%{_nu::%loop-number%}%" with lore "%{_lu::%loop-number%}%"
46 else:
47 set slot 44 of {_g}'s current inventory to {qeitem} named "%{_nu::%loop-number%}%" with lore "%{_lu::%loop-number%}%"
48 loop 3 times:
49 set {_lvlu::%loop-number%} to single value "prices.unbreaking.%loop-number%.LvL" get of "plugins/QEnchant/config.yml" parsed as integer
50 set {_cnu::%loop-number%} to single value "custom.unbreaking" get of "plugins/QEnchant/gui.yml"
51 set {_bibu::%loop-number%} to single value "prices.unbreaking.%loop-number%.Bookshelfs" get of "plugins/QEnchant/config.yml" parsed as integer
52 set {p::%{_g}%::26} to "Unbreaking 1" parsed as enchantment type
53 set {pl::%{_g}%::26} to {_lvlu::1}
54 set {pb::%{_g}%::26} to {_bibu::1}
55 set {p::%{_g}%::35} to "Unbreaking 2" parsed as enchantment type
56 set {pl::%{_g}%::35} to {_lvlu::2}
57 set {pb::%{_g}%::35} to {_bibu::2}
58 set {p::%{_g}%::44} to "Unbreaking 3" parsed as enchantment type
59 set {pl::%{_g}%::44} to {_lvlu::3}
60 set {pb::%{_g}%::44} to {_bibu::3}
61
62function qeRepair(g: player):
63 set {_item} to slot 8 of {_g}'s current inventory
64 set {_dmg} to damage of {_item}
65 if {_dmg} is bigger or equal to 1:
66 set {_g}'s level to {_g}'s level -5
67 set damage of {_item} to 0
68 set slot 8 of {_g}'s current inventory to {_item}
69
70
71function qeFull(g: player, t2: text):
72 set {_t} to {_t2} parsed as itemtype
73 set {_slot1} to -1
74 set {_slot2} to 0
75 if {_t} is any helmet or any chestplate or any leggings or any boots:
76 set {_o::*} to {@a}
77 if {_t} is any pickaxe or any shovel or any axe:
78 set {_o::*} to {@t}
79 if {_t} is bow:
80 set {_o::*} to {@b}
81 if {_t} is any sword:
82 set {_o::*} to {@s}
83 loop {_o::*}:
84 loop 5 times:
85 set {_lvl::%loop-value-1%} to single value "prices.other.%loop-value-1%.%loop-number%.LvL" get of "plugins/QEnchant/config.yml" parsed as integer
86 set {_cn::%loop-value-1%} to single value "custom.%loop-value-1%" get of "plugins/QEnchant/gui.yml"
87 set {_bib} to single value "prices.other.%loop-value-1%.%loop-number%.Bookshelfs" get of "plugins/QEnchant/config.yml" parsed as integer
88 if {_lvl::%loop-value-1%} is set:
89 add 1 to {_slot1}
90 if {_slot1} is bigger than 4:
91 set {_slot1} to 0
92 add 1 to {_slot2}
93 set {_calc} to {_slot1}+({_slot2}*9)
94 set {p::%{_g}%::%{_calc}%} to "%loop-value-1% %loop-number%" parsed as enchantment type
95 set {pl::%{_g}%::%{_calc}%} to {_lvl::%loop-value-1%}
96 set {pb::%{_g}%::%{_calc}%} to {_bib}
97 set {_n} to {qename}
98 if {_cn::%loop-value-1%} is set:
99 replace all "_ENCHANTMENT_" in {_n} with "%{_cn::%loop-value-1%}%"
100 else:
101 replace all "_ENCHANTMENT_" in {_n} with "%loop-value-1%"
102 replace all "_ELVL_" in {_n} with "%loop-number%"
103 set {_l} to "%colored {qelore::*}%"
104 replace all " and " with "||" in {_l}
105 replace all " , " with "||" in {_l}
106 replace all "_LVL_" with "%{_lvl::%loop-value-1%}%" in {_l}
107 replace all "_BOOK_" with "%{_bib}%" in {_l}
108 if {qenchant::opt::dynamic} is "true":
109 if {qenchant::%{_g}%::bib} is bigger or equal to {_bib}:
110 set slot {_calc} of {_g}'s current inventory to 1 of {qeitem} named "%colored {_n}%" with lore "%{_l}%"
111 else:
112 remove 1 from {_slot1}
113 else:
114 set slot {_calc} of {_g}'s current inventory to 1 of {qeitem} named "%colored {_n}%" with lore "%{_l}%"
115 delete {_lvl::%loop-value-1%}
116
117function qeRandom(g: player, t: itemtype):
118 if {_g}'s level is bigger or equal to 20:
119 set {_g}'s level to {_g}'s level - 20
120 if {_t} is any helmet or any chestplate or any leggings or any boots:
121 set {_o::*} to {@a}
122 if {_t} is any pickaxe or any shovel or any axe:
123 set {_o::*} to {@t}
124 if {_t} is bow:
125 set {_o::*} to {@b}
126 if {_t} is any sword:
127 set {_o::*} to {@s}
128 set {_r2} to random element out of {_o::*}
129 set {_moc} to random integer between 1 to 5
130 set {_lvl} to single value "prices.other.%{_r2}%.%{_moc}%.LvL" get of "plugins/QEnchant/config.yml" parsed as integer
131 loop 5 times:
132 if {_lvl} is not set:
133 remove 1 from {_moc}
134 set {_lvl} to single value "prices.other.%{_r2}%.%{_moc}%.LvL" get of "plugins/QEnchant/config.yml" parsed as integer
135 else:
136 exit loop
137 set {_full} to "%{_r2}% %{_moc}%" parsed as enchantment type
138 enchant {_t} with {_full}
139 send "%{qenchant::wiad::prefix}% &aYou won &e%{_full}%%{qenchant::wiad::suffix}%" to {_g}
140 set slot 8 of {_g}'s current inventory to {_t}
141 play raw sound "random.anvil_use" at {_g} with pitch 1 volume 10
142 create hologram "&aEnchanted!;" at block above {qeee::%{_g}%} for 2 seconds
143
144function qeReload(e: text):
145 set {qenchant::wiad::locale} to single value "locale" get of "plugins/QEnchant/config.yml"
146 set {qenchant::opt::dynamic} to colored single value "dynamic" get of "plugins/QEnchant/config.yml"
147 set {qenchant::opt::random} to colored single value "random" get of "plugins/QEnchant/config.yml"
148 set {qenchant::opt::repair} to colored single value "repair" get of "plugins/QEnchant/config.yml"
149 set {qenchant::opt::rename} to colored single value "rename" get of "plugins/QEnchant/config.yml"
150 set {qenchant::wiad::nl} to colored single value "NoLVL" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
151 set {qenchant::wiad::nb} to colored single value "NoBOOK" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
152 set {qenchant::wiad::ns} to colored single value "NoSPACE" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
153 set {qenchant::wiad::su} to colored single value "Success" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
154 set {qenchant::wiad::ra} to colored single value "Random" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
155 set {qenchant::wiad::re} to colored single value "Repair" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
156 set {qenchant::wiad::tn} to colored single value "TypeName" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
157 set {qenchant::wiad::na} to colored single value "Name" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
158 set {qenchant::wiad::pe} to colored single value "Set" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
159 set {qenchant::wiad::ot} to colored single value "Give" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
160 set {qenchant::wiad::rel} to colored single value "Reload" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
161 set {qenchant::wiad::reling} to colored single value "Reloading" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
162 set {qenchant::wiad::title} to colored single value "Title" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
163 set {qenchant::wiad::stitle} to colored single value "SubTitle" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
164 set {qenchant::wiad::tab} to colored single value "Table" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
165 set {qenchant::wiad::nu} to colored single value "NewUpd" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
166 set {qenchant::wiad::an} to colored single value "RunningNewest" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
167 set {qenchant::wiad::ae} to colored single value "AlredyEnchanted" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
168 set {qenchant::wiad::prefix} to colored single value "Prefix" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
169 set {qenchant::wiad::suffix} to colored single value "Suffix" get of "plugins/QEnchant/messages/messages_%{qenchant::wiad::locale}%.yml"
170 send "%{qenchant::wiad::prefix}% &aPrzeladowano skrypt%{qenchant::wiad::suffix}%" to console
171 set {qelr} to now
172
173function qeName(g: player, t: itemtype):
174 close {_g}'s inventory
175 wait 2 ticks
176 open anvil to the {_g}
177 wait a tick
178 set slot 1 of {_g}'s current inventory to {_g}'s tool
179
180on inventory close:
181 if {neo::%player%} is true:
182 if player can hold slot 8 of player's current inventory:
183 give slot 8 of player's current inventory to player
184 else:
185 drop slot 8 of player's current inventory at player
186 delete {neo::%player%}
187 delete {eqgui1::%player%}
188
189on inventory click:
190 if {neo::%player%} is true:
191 cancel event
192 if slot clicked slot of player's current inventory is {qeitem}:
193 set {_are} to {qenchant::wiad::ae}
194 replace all "_ENCHANT_" in {_are} with "%{p::%player%::%clicked slot%}%"
195 set {_item} to slot 8 of player's current inventory
196 if {_item} is not enchanted with {p::%player%::%clicked slot%}:
197 if player's level is bigger or equal to {pl::%player%::%clicked slot%}:
198 if {qenchant::%player%::bib} is bigger or equal to {pb::%player%::%clicked slot%}:
199 set player's level to player's level - {pl::%player%::%clicked slot%}
200 enchant {_item} with {p::%player%::%clicked slot%}
201 set slot 8 of player's current inventory to {_item}
202 play raw sound "random.anvil_use" at player with pitch 1 volume 10
203 create hologram "%{qenchant::wiad::tab}%;" at block above {qeee::%player%} for 2 seconds
204 set {_ti} to {qenchant::wiad::title}
205 set {_st} to {qenchant::wiad::stitle}
206 replace all "_ENCHANT_" in {_ti} with "%{p::%player%::%clicked slot%}%"
207 replace all "_ENCHANT_" in {_st} with "%{p::%player%::%clicked slot%}%"
208 execute console command "title %player% times 20 40 20"
209 execute console command "/title %player% title {text:""%{_ti}%"",color:""green""}"
210 execute console command "/title %player% subtitle {text:""%{_st}%"",color:""dark_green""}"
211 else:
212 send "%{qenchant::wiad::prefix}% %{qenchant::wiad::nb}%%{qenchant::wiad::suffix}%"
213 else:
214 send "%{qenchant::wiad::prefix}% %{qenchant::wiad::nl}%%{qenchant::wiad::suffix}%"
215 else:
216 send "%{qenchant::wiad::prefix}% %{_are}%%{qenchant::wiad::suffix}%"
217 else:
218 if clicked slot is 24:
219 set {_item} to slot 8 of player's current inventory
220 qeRandom(player, {_item})
221 if clicked slot is 15:
222 qeRepair(player)
223 if clicked slot is 33:
224 set {_item} to slot 8 of player's current inventory
225 qeName(player, {_item})
226 if {eqgui1::%player%} is true:
227 cancel event
228 if clicked slot is 8:
229 if slot 8 of player's current inventory is not ender pearl:
230 set slot 8 of player's current inventory to ender pearl
231 wait a tick
232 qeReload("reload")
233 set {_status} to 0
234 loop 100 times:
235 add 1 to {_status}
236 set slot 8 of player's current inventory to ender pearl named "&aReloading &8[&2%{_status}%%%&8]"
237 wait 1.4 ticks
238 set slot 8 of player's current inventory to 1 of eye of ender named "&aReload" with lore "&aLast reload: &e%{qelr}%"
239 if clicked slot is 0:
240 execute player command "qeupd"
241
242
243on right click on enchantment table:
244 cancel event
245 close player's inventory
246 if {neo::%player%} is not set:
247 set {qenchant::%player%::bib} to 0
248 loop all blocks in radius 3 of event-block:
249 if loop-block is bookshelf:
250 if distance between loop-block and event-block is bigger or equal to 2:
251 if y-coordinate of event-block is less or equal to y-coordinate of loop-block:
252 add 1 to {qenchant::%player%::bib}
253 set {qeee::%player%} to location of clicked block
254 wait 3 ticks
255 execute console command "eee %player%"
256
257on load:
258 if file "plugins/QEnchant/config.yml" doesn't exists:
259 create file "plugins/QEnchant/config.yml"
260 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/config.yml" to "plugins/QEnchant/config.yml"
261 if file "plugins/QEnchant/gui.yml" doesn't exists:
262 create file "plugins/QEnchant/gui.yml"
263 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/gui.yml" to "plugins/QEnchant/gui.yml"
264 if file "plugins/QEnchant/messages/messages_pl.yml" doesn't exists:
265 create file "plugins/QEnchant/messages/messages_pl.yml"
266 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/messages/messages_pl.yml" to "plugins/QEnchant/messages/messages_pl.yml"
267 if file "plugins/QEnchant/messages/messages_en.yml" doesn't exists:
268 create file "plugins/QEnchant/messages/messages_en.yml"
269 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/messages/messages_en.yml" to "plugins/QEnchant/messages/messages_en.yml"
270 execute console command "gamerule sendCommandFeedback false"
271
272
273command /qenchant [<text>]:
274 trigger:
275 if arg-1 is not set:
276 set {eqgui1::%player%} to true
277 set {_ver} to single value "version" get of "plugins/QEnchant/config.yml"
278 set {_av} to "&8Connectiong to the server..."
279 open chest with 1 row named "&8* &e&lQ&6&lEnchant&8 *" to player
280 set slot 8 of player's current inventory to 1 of eye of ender named "&aReload" with lore "&aLast reload: &e%{qelr}%"
281 set slot 0 of player's current inventory to 1 of paper named "&aUpdate" with lore "&aCurrent version: &e%{_ver}%||&aNewest version: &eLoading...||%colored {_av}%"
282 loop 500 times:
283 wait 3 ticks
284 if {_nver} is not set:
285 set {_nver} to result of connect to "https://raw.githubusercontent.com/Quaczi/QEnchant/master/version.yml"
286 else:
287 if {_nver} is not {_ver}:
288 set {_av} to "&2There is new update anvabile&8."
289 else:
290 set {_av} to "&cYou are running the newest version&8."
291 set slot 0 of player's current inventory to 1 of paper named "&aUpdate" with lore "&aCurrent version: &e%{_ver}%||&aNewest version: &e%{_nver}%||%colored {_av}%"
292 stop
293 if {_nver} is not set:
294 set slot 0 of player's current inventory to 1 of paper named "&aUpdate" with lore "&aCurrent version: &e%{_ver}%||&aNewest version: &4Error||&cCannot connect to the server&8."
295
296command /qeupd:
297 trigger:
298 set {_ver} to single value "version" get of "plugins/QEnchant/config.yml"
299 set {_nver::*} to result of connect to "https://raw.githubusercontent.com/Quaczi/QEnchant/master/version.yml"
300 loop 5 times:
301 if {_nver::*} is not set:
302 wait 5 ticks
303 set {_nver::*} to result of connect to "https://raw.githubusercontent.com/Quaczi/QEnchant/master/version.yml"
304 if {_ver} is not {_nver::*}:
305 send "&aNew version of &eQ&6Enchant &awas found&8."
306 send "&aDownloading..."
307 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/config.yml" to "plugins/QEnchant/config.yml"
308 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/gui.yml" to "plugins/QEnchant/gui.yml"
309 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/messages/messages_pl.yml" to "plugins/QEnchant/messages/messages_pl.yml"
310 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/messages/messages_en.yml" to "plugins/QEnchant/messages/messages_en.yml"
311 download from "https://raw.githubusercontent.com/Quaczi/QEnchant/master/Code.sk" to "plugins/Skript/scripts/%script%.sk"
312 send "&aNew version has been installed"
313 delete file "plugins/QEnchant/version.yml"
314 else:
315 send "&cYou are usign the newest version of &eQ&6Enchant&8."
316
317on break of enchantment table:
318 delete {tien::%event-block%}
319 remove location of event-block from {spo::*}
320 delete {pa::%location of event-block%}
321
322on place of enchantment table:
323 if {qeopt::po} is "true":
324 set {tien::%event-block%} to true
325 while {tien::%event-block%} is true:
326 wait 0.6 second
327 spawn 15 of particle spell:0 offset by 0, 1, 0 at event-block
328
329command /eee [<player>]:
330 permission: op
331 trigger:
332 qeReload("reload")
333 set {neo::%player-arg%} to true
334 open chest with 5 rows named "%colored {qegn}%" to player-arg
335 wait 2 ticks
336 qeFull(player-arg, "%player-arg's tool%")
337 set slot 8 of player-arg's current inventory to player-arg's tool
338 set player-arg's tool to air
339 set {_bn} to {qegui::name::book}
340 replace all "_BOOKS_" in {_bn} with "%{qenchant::%player-arg%::bib}%"
341 set slot 23 of player-arg's current inventory to 1 of {qegui::item::book} named "%colored {_bn}%" with lore "&0_"
342 if {qenchant::opt::random} is "true":
343 set slot 24 of player-arg's current inventory to 1 of {qegui::item::random} named "%colored {qegui::name::random}%" with lore "&0_"
344 if {qenchant::opt::repair} is "true":
345 set slot 15 of player-arg's current inventory to 1 of {qegui::item::repair} named "%colored {qegui::name::repair}%" with lore "&0_"
346 if {qenchant::opt::rename} is "true":
347 set slot 33 of player-arg's current inventory to 1 of {qegui::item::name} named "%colored {qegui::name::name}%" with lore "&0_"
348 qeUnbr(player-arg)
349 loop {@bars}:
350 set slot loop-number of player-arg's current inventory to 1 of bars named "&0" with lore "&0"