Skip to content

Commit

Permalink
fix: command lore throw error when lore is null
Browse files Browse the repository at this point in the history
  • Loading branch information
NgLoader committed Jun 27, 2024
1 parent dc964fc commit 8a54cce
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.imprex.zip.command;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -60,6 +61,10 @@ public void onCommand(CommandSender sender, String[] args) {
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.getLore();

if (lore == null) {
lore = new ArrayList<String>();
}

boolean apply = switch (args[0]) {
case "add", "create" -> this.handleAdd(sender, Arrays.copyOfRange(args, 1, args.length), lore);
case "edit", "change" -> this.handleChange(sender, Arrays.copyOfRange(args, 1, args.length), lore);
Expand Down

0 comments on commit 8a54cce

Please sign in to comment.