From 1ba07b87cfeeb96936285566034c952a5c80bb40 Mon Sep 17 00:00:00 2001 From: HeroBrineGoat <76707404+MasterOfTheFish@users.noreply.github.com> Date: Tue, 1 Feb 2022 23:44:59 -0500 Subject: [PATCH] Fixed NPE when not specifying dye --- .../fisher2911/hmccosmetics/command/CosmeticsCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java index 5f7bfc88..2a1bbd91 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java @@ -84,7 +84,9 @@ public class CosmeticsCommand extends CommandBase { final ArmorItem armorItem = user.getPlayerArmor().getItem(type); - this.setDyeColor(dyeColor, armorItem, player); + if (dyeColor != null) { + this.setDyeColor(dyeColor, armorItem, player); + } this.userManager.setItem(user, armorItem); @@ -138,7 +140,9 @@ public class CosmeticsCommand extends CommandBase { return; } - this.setDyeColor(dyeColor, armorItem, player); + if (dyeColor != null) { + this.setDyeColor(dyeColor, armorItem, player); + } final Message setMessage = Messages.getSetMessage(armorItem.getType()); final Message setOtherMessage = Messages.getSetOtherMessage(armorItem.getType());