Fix Null-Check on Particle Causing 1291

This commit is contained in:
Rosenthalk0 2023-05-03 10:57:49 -05:00
parent 9cb65da309
commit 6fd1394409

View File

@ -101,42 +101,42 @@ public class ParticlesEdition extends EditionInventory {
inv.setItem(slots[n++], modifierItem); 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<String> 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(); ItemStack colorItem = VersionMaterial.RED_DYE.toItem();
ItemMeta glassMeta = glass.getItemMeta(); ItemMeta colorItemMeta = colorItem.getItemMeta();
glassMeta.setDisplayName(ChatColor.RED + "- No Modifier -"); colorItemMeta.setDisplayName(ChatColor.GREEN + "Particle Color");
glass.setItemMeta(glassMeta); List<String> 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(25, colorItem);
inv.setItem(slots[n++], glass); }
addEditionInventoryItems(inv, true); ItemStack glass = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem();
inv.setItem(21, particleTypeItem); ItemMeta glassMeta = glass.getItemMeta();
inv.setItem(23, particleItem); 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; return inv;
} }