Skip to content

Commit 8e57513

Browse files
Update itemedit.sk
1 parent db6ed95 commit 8e57513

1 file changed

Lines changed: 42 additions & 27 deletions

File tree

itemedit.sk

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,15 @@
33
# MADE BY: hrmfullAdvocado
44
# DEPENDENCIES: Skript, SkBee and SkCrew
55
# =====================================
6-
function removeUnderscores(t: text) :: text:
7-
set {_modified} to {_t}
8-
replace all "_" in {_modified} with " "
9-
return {_modified}
106

117
on load:
128
delete {itemedit::*}
13-
delete {_enchant}
14-
delete {_nbt}
15-
delete {_item}
16-
delete {_raw::*}
179
delete {pe::*}
18-
delete {_attr}
19-
delete {_amount}
20-
delete {_target}
2110

2211

2312
# ---------- ITEMEDIT COMMAND ----------
24-
command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
25-
aliases: /itemedit
13+
command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>] [<text>] [<text>]:
14+
aliases: itemedit
2615
permission: skript.itemedit
2716
trigger:
2817
set {_item} to player's tool
@@ -35,8 +24,21 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
3524
if arg-2 is "-clear":
3625
set name of player's tool to ""
3726
stop
38-
set name of player's tool to colored arg-2
39-
27+
if arg-3 isn't set:
28+
set name of player's tool to colored "&f%arg-2%"
29+
else if arg-4 isn't set:
30+
set name of player's tool to colored "&f%arg-2% %arg-3%"
31+
else if arg-5 isn't set:
32+
set name of player's tool to colored "&f%arg-2% %arg-3% %arg-4%"
33+
else if arg-6 isn't set:
34+
set name of player's tool to colored "&f%arg-2% %arg-3% %arg-4% %arg-5%"
35+
else if arg-7 isn't set:
36+
set name of player's tool to colored "&f%arg-2% %arg-3% %arg-4% %arg-5% %arg-6%"
37+
else if arg-8 isn't set:
38+
set name of player's tool to colored "&f%arg-2% %arg-3% %arg-4% %arg-5% %arg-6% %arg-7%"
39+
else:
40+
set name of player's tool to colored "&f%arg-2% %arg-3% %arg-4% %arg-5% %arg-6% %arg-7% %arg-8%"
41+
send "&aItem name set to &f%name of player's tool%&a." to player
4042
# ---------- LORE ----------
4143

4244
if arg-1 is "lore":
@@ -46,8 +48,16 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
4648
stop
4749
if arg-4 isn't set:
4850
add colored "&f%arg-3%" to lore of player's tool
49-
else:
51+
else if arg-5 isn't set:
52+
add colored "&f%arg-3% %arg-4%" to lore of player's tool
53+
else if arg-6 isn't set:
54+
add colored "&f%arg-3% %arg-4% %arg-5%" to lore of player's tool
55+
else if arg-7 isn't set:
5056
add colored "&f%arg-3% %arg-4% %arg-5% %arg-6%" to lore of player's tool
57+
else if arg-8 isn't set:
58+
add colored "&f%arg-3% %arg-4% %arg-5% %arg-6% %arg-7%" to lore of player's tool
59+
else:
60+
add colored "&f%arg-3% %arg-4% %arg-5% %arg-6% %arg-7% %arg-8%" to lore of player's tool
5161
send "&aLore line added to item." to player
5262

5363
if arg-2 is "remove":
@@ -122,7 +132,8 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
122132
disenchant player's tool
123133
send "&aAll enchantments have been removed from your item." to player
124134
stop
125-
set {_enchant} to removeUnderscores(arg-2)
135+
set {_enchant} to arg-2
136+
replace all "_" in {_enchant} with " "
126137
if {_enchant} isn't set:
127138
send "&c%arg-2% is not a valid enchantment." to player
128139
stop
@@ -267,8 +278,8 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
267278
stop
268279
else:
269280
set {pe::%uuid of player%::duration} to 30 seconds
281+
set {peobj::%uuid of player%} to potion effect of {pe::%uuid of player%} of tier {pe::%uuid of player%::level} for {pe::%uuid of player%::duration}
270282

271-
set {peobj::%uuid of player%} to new potion effect of {pe::%uuid of player%} potion of tier {pe::%uuid of player%::level} for {pe::%uuid of player%::duration}
272283

273284
loop potion effects of player's tool:
274285
if type of loop-value is {pe::%uuid of player%}:
@@ -393,7 +404,9 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
393404
if arg-1 is "attribute":
394405
if arg-2 is "add":
395406
if arg-3 contains "_":
396-
set {_attr} to removeUnderscores(arg-3) parsed as an attribute type
407+
set {_temp} to arg-3
408+
replace all "_" in {_temp} with " "
409+
set {_attr} to {_temp} parsed as an attribute type
397410
else:
398411
set {_attr} to arg-3 parsed as an attribute type
399412

@@ -428,7 +441,9 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
428441

429442
if arg-2 is "remove":
430443
if arg-3 contains "_":
431-
set {_attr} to removeUnderscores(arg-3) parsed as an attribute type
444+
set {_temp} to arg-3
445+
replace all "_" in {_temp} with " "
446+
set {_attr} to {_temp} parsed as an attribute type
432447
else:
433448
set {_attr} to arg-3 parsed as an attribute type
434449
delete {_attr} attribute modifier of player's tool
@@ -461,6 +476,7 @@ command /ie <text> [<text>] [<text>] [<text>] [<text>] [<text>]:
461476
# =====================================
462477

463478
command /serveritem <text> [<text>] [<text>] [<text>]:
479+
aliases: si
464480
permission: skript.serveritem
465481
trigger:
466482

@@ -581,7 +597,7 @@ command /serveritem <text> [<text>] [<text>] [<text>]:
581597
# ==============================
582598
if arg-1 is "sell":
583599
if arg-4 is set:
584-
set {_p} to arg-4 parsed as a player
600+
set {_p} to arg-4 parsed as player
585601
else:
586602
set {_p} to player
587603
if arg-2 is not set:
@@ -590,13 +606,12 @@ command /serveritem <text> [<text>] [<text>] [<text>]:
590606
if {serveritems::%arg-2%} is not set:
591607
send "&cThat server item does not exist." to {_p}
592608
stop
593-
set {_price} to arg-3 parsed as a number
594-
if {_p} does not have {serveritems::%arg-2%}:
609+
if {_p} does not have 1 of {serveritems::%arg-2%}:
595610
send "&cYou don't have that item to sell." to {_p}
596611
stop
612+
set {_price} to arg-3 parsed as number
597613
remove 1 of {serveritems::%arg-2%} from {_p}
598-
add {_price} to balance of {_p}
599-
614+
set balance of {_p} to (balance of {_p}) + {_price}
600615
# ==============================
601616
# BUY
602617
# ==============================
@@ -801,7 +816,7 @@ on tab complete of "/ie" and "/itemedit":
801816
# ---------- ENCHANT TAB COMPLETION ----------
802817

803818
if tab arg-1 is "enchant":
804-
set {_enchants::*} to "-clear", "Fireprotection", "Sharpness", "Flame", "aqua_affinity", "Punch", "Loyalty", "Depth_strider", "Vanishing_curse", "Unbreaking", "Knockback", "Luck_of_thesea", "Binding_curse", "Fortune", "Protection", "Efficiency", "Mending", "Frost_walker", "Lure", "Looting", "Blast_protection", "Smite", "Fire_aspect", "Channeling", "Thorns", "Bane_of_arthropods", "Respiration", "Riptide", "Silk_touch", "Projectile_protection", "Impaling", "Feather_falling", "Power", "Infinity", "Glowing", "Piercing", "Multishot", "Quick_charge", "Soul_speed", "Swift_sneak", "Sweeping_edge", "Density", "Breach" and "Wind_burst"
819+
set {_enchants::*} to "-clear", "Fireprotection", "Sharpness", "Flame", "aqua_affinity", "Punch", "Loyalty", "Depth_strider", "Vanishing_curse", "Unbreaking", "Knockback", "Luck_of_the_sea", "Binding_curse", "Fortune", "Protection", "Efficiency", "Mending", "Frost_walker", "Lure", "Looting", "Blast_protection", "Smite", "Fire_aspect", "Channeling", "Thorns", "Bane_of_arthropods", "Respiration", "Riptide", "Silk_touch", "Projectile_protection", "Impaling", "Feather_falling", "Power", "Infinity", "Glowing", "Piercing", "Multishot", "Quick_charge", "Soul_speed", "Swift_sneak", "Sweeping_edge", "Density", "Breach" and "Wind_burst"
805820
set tab completions for position 2 to {_enchants::*}
806821
set tab completions for position 3 to "1", "2", "3", "4" and "5"
807822

@@ -811,7 +826,7 @@ on tab complete of "/ie" and "/itemedit":
811826
# SERVERITEM TAB COMPLETION
812827
# =====================================
813828

814-
on tab complete of "/serveritem":
829+
on tab complete of "/serveritem" and "si":
815830
set tab completions for position 1 to "save", "give", "del", "buy", "take", "sell", "setnick" and "list"
816831

817832
if tab arg-1 is "give", "buy", "setnick", "sell", "take" or "del":

0 commit comments

Comments
 (0)