From 6fd13944097d0eeeb67e62cc9b5f1f553f4454de Mon Sep 17 00:00:00 2001 From: Rosenthalk0 Date: Wed, 3 May 2023 10:57:49 -0500 Subject: [PATCH] Fix Null-Check on Particle Causing 1291 --- .../gui/edition/ParticlesEdition.java | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/ParticlesEdition.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/ParticlesEdition.java index ea38ca50..c98571e1 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/ParticlesEdition.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/edition/ParticlesEdition.java @@ -101,42 +101,42 @@ public class ParticlesEdition extends EditionInventory { inv.setItem(slots[n++], modifierItem); } - - - if (ParticleData.isColorable(particle)) { - int red = getEditedSection().getInt("item-particles.color.red"); - int green = getEditedSection().getInt("item-particles.color.green"); - int blue = getEditedSection().getInt("item-particles.color.blue"); - - ItemStack colorItem = VersionMaterial.RED_DYE.toItem(); - ItemMeta colorItemMeta = colorItem.getItemMeta(); - colorItemMeta.setDisplayName(ChatColor.GREEN + "Particle Color"); - List colorItemLore = new ArrayList<>(); - colorItemLore.add(ChatColor.GRAY + "The RGB color of your particle."); - colorItemLore.add(""); - colorItemLore.add(ChatColor.GRAY + "Current Value (R-G-B):"); - colorItemLore.add("" + ChatColor.RED + ChatColor.BOLD + red + ChatColor.GRAY + " - " + ChatColor.GREEN + ChatColor.BOLD + green - + ChatColor.GRAY + " - " + ChatColor.BLUE + ChatColor.BOLD + blue); - colorItemLore.add(""); - colorItemLore.add(ChatColor.YELLOW + AltChar.listDash + " Click to change this value."); - colorItemLore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to change this value."); - colorItemMeta.setLore(colorItemLore); - colorItem.setItemMeta(colorItemMeta); - - inv.setItem(25, colorItem); } + if (particle != null ) { + if (ParticleData.isColorable(particle)) { + int red = getEditedSection().getInt("item-particles.color.red"); + int green = getEditedSection().getInt("item-particles.color.green"); + int blue = getEditedSection().getInt("item-particles.color.blue"); - ItemStack glass = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem(); - ItemMeta glassMeta = glass.getItemMeta(); - glassMeta.setDisplayName(ChatColor.RED + "- No Modifier -"); - glass.setItemMeta(glassMeta); + ItemStack colorItem = VersionMaterial.RED_DYE.toItem(); + ItemMeta colorItemMeta = colorItem.getItemMeta(); + colorItemMeta.setDisplayName(ChatColor.GREEN + "Particle Color"); + List colorItemLore = new ArrayList<>(); + colorItemLore.add(ChatColor.GRAY + "The RGB color of your particle."); + colorItemLore.add(""); + colorItemLore.add(ChatColor.GRAY + "Current Value (R-G-B):"); + colorItemLore.add("" + ChatColor.RED + ChatColor.BOLD + red + ChatColor.GRAY + " - " + ChatColor.GREEN + ChatColor.BOLD + green + + ChatColor.GRAY + " - " + ChatColor.BLUE + ChatColor.BOLD + blue); + colorItemLore.add(""); + colorItemLore.add(ChatColor.YELLOW + AltChar.listDash + " Click to change this value."); + colorItemLore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to change this value."); + colorItemMeta.setLore(colorItemLore); + colorItem.setItemMeta(colorItemMeta); - while (n < slots.length) - inv.setItem(slots[n++], glass); + inv.setItem(25, colorItem); + } - addEditionInventoryItems(inv, true); - inv.setItem(21, particleTypeItem); - inv.setItem(23, particleItem); + ItemStack glass = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem(); + ItemMeta glassMeta = glass.getItemMeta(); + glassMeta.setDisplayName(ChatColor.RED + "- No Modifier -"); + glass.setItemMeta(glassMeta); + + while (n < slots.length) + inv.setItem(slots[n++], glass); + + addEditionInventoryItems(inv, true); + inv.setItem(21, particleTypeItem); + inv.setItem(23, particleItem); } return inv; }