From 8a54cce2a5baafff0fe021507afe894ada86b084 Mon Sep 17 00:00:00 2001 From: Nils Gereke Date: Thu, 27 Jun 2024 07:53:05 +0200 Subject: [PATCH] fix: command lore throw error when lore is null --- .../src/main/java/net/imprex/zip/command/LoreCommand.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zip-plugin/src/main/java/net/imprex/zip/command/LoreCommand.java b/zip-plugin/src/main/java/net/imprex/zip/command/LoreCommand.java index d83ad60..65a869c 100644 --- a/zip-plugin/src/main/java/net/imprex/zip/command/LoreCommand.java +++ b/zip-plugin/src/main/java/net/imprex/zip/command/LoreCommand.java @@ -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; @@ -60,6 +61,10 @@ public void onCommand(CommandSender sender, String[] args) { ItemMeta meta = item.getItemMeta(); List lore = meta.getLore(); + if (lore == null) { + lore = new ArrayList(); + } + 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);