Skip to content

Commit 91279f4

Browse files
authored
fix: command lore throw error when lore is null (#30)
1 parent dc964fc commit 91279f4

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

zip-plugin/src/main/java/net/imprex/zip/command/LoreCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.imprex.zip.command;
22

3+
import java.util.ArrayList;
34
import java.util.Arrays;
45
import java.util.List;
56
import java.util.Locale;
@@ -60,6 +61,10 @@ public void onCommand(CommandSender sender, String[] args) {
6061
ItemMeta meta = item.getItemMeta();
6162
List<String> lore = meta.getLore();
6263

64+
if (lore == null) {
65+
lore = new ArrayList<String>();
66+
}
67+
6368
boolean apply = switch (args[0]) {
6469
case "add", "create" -> this.handleAdd(sender, Arrays.copyOfRange(args, 1, args.length), lore);
6570
case "edit", "change" -> this.handleChange(sender, Arrays.copyOfRange(args, 1, args.length), lore);

0 commit comments

Comments
 (0)