1
- package com .eternalcode .core .feature .essentials . item . itemedit ;
1
+ package com .eternalcode .core .feature .itemedit ;
2
2
3
3
import com .eternalcode .annotations .scan .command .DescriptionDocs ;
4
4
import com .eternalcode .commons .adventure .AdventureUtil ;
5
5
import com .eternalcode .core .injector .annotations .Inject ;
6
6
import com .eternalcode .core .notice .NoticeService ;
7
7
import dev .rollczi .litecommands .annotations .argument .Arg ;
8
+ import dev .rollczi .litecommands .annotations .command .Command ;
8
9
import dev .rollczi .litecommands .annotations .context .Context ;
9
- import dev .rollczi .litecommands .annotations .join .Join ;
10
10
import dev .rollczi .litecommands .annotations .execute .Execute ;
11
+ import dev .rollczi .litecommands .annotations .join .Join ;
11
12
import dev .rollczi .litecommands .annotations .permission .Permission ;
12
- import dev .rollczi .litecommands .annotations .command .Command ;
13
+ import java .util .ArrayList ;
14
+ import java .util .List ;
13
15
import net .kyori .adventure .text .minimessage .MiniMessage ;
14
- import net .kyori .adventure .text .serializer .gson .GsonComponentSerializer ;
15
16
import org .bukkit .Material ;
16
17
import org .bukkit .entity .Player ;
17
18
import org .bukkit .inventory .ItemStack ;
18
19
import org .bukkit .inventory .meta .ItemMeta ;
19
20
20
- import java .util .ArrayList ;
21
- import java .util .List ;
22
-
23
21
@ Command (name = "itemlore" )
24
22
@ Permission ("eternalcore.itemlore" )
25
23
class ItemLoreCommand {
@@ -44,19 +42,14 @@ void execute(@Context Player player, @Arg(ItemLoreArgument.KEY) int line, @Join
44
42
}
45
43
46
44
ItemMeta itemMeta = itemStack .getItemMeta ();
47
-
48
45
List <String > lore = itemMeta .getLore ();
49
46
lore = lore == null ? new ArrayList <>() : new ArrayList <>(lore );
50
47
51
48
while (lore .size () <= line ) {
52
49
lore .add ("" );
53
50
}
54
51
55
- // Serialize using GsonComponentSerializer for modern Minecraft versions
56
- String json = GsonComponentSerializer .gson ().serialize (
57
- AdventureUtil .resetItalic (this .miniMessage .deserialize (text ))
58
- );
59
- lore .set (line , json );
52
+ lore .set (line , AdventureUtil .SECTION_SERIALIZER .serialize (AdventureUtil .resetItalic (this .miniMessage .deserialize (text ))));
60
53
61
54
itemMeta .setLore (lore );
62
55
itemStack .setItemMeta (itemMeta );
@@ -95,7 +88,11 @@ void remove(@Context Player player, @Arg(ItemLoreArgument.KEY) int line) {
95
88
itemMeta .setLore (lore );
96
89
itemStack .setItemMeta (itemMeta );
97
90
98
- this .noticeService .player (player .getUniqueId (), translation -> translation .itemEdit ().itemLoreLineRemoved ());
91
+ this .noticeService .create ()
92
+ .player (player .getUniqueId ())
93
+ .notice (translation -> translation .itemEdit ().itemLoreLineRemoved ())
94
+ .placeholder ("{LINE}" , String .valueOf (line + 1 ))
95
+ .send ();
99
96
}
100
97
101
98
@ Execute (name = "clear" )
0 commit comments