diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java index 34c192852..9592e7894 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java @@ -156,7 +156,7 @@ public class AlchemyBrewTask extends CancellableRunnable { mcMMO.p.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer.getPlayer(), false); + AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, false); } Alchemy.brewingStandMap.remove(brewingStand.getLocation()); @@ -165,7 +165,7 @@ public class AlchemyBrewTask extends CancellableRunnable { public void finishImmediately() { this.cancel(); - AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer.getPlayer(), true); + AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, true); Alchemy.brewingStandMap.remove(brewingStand.getLocation()); } diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java index 573dbd4c6..34ae36b22 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java @@ -144,7 +144,7 @@ public final class AlchemyPotionBrewer { ? 1 : mmoPlayer.getAlchemyManager().getTier()); } - public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) { + public static void finishBrewing(BlockState brewingStand, @Nullable McMMOPlayer mmoPlayer, boolean forced) { // Check if the brewing stand block state is an actual brewing stand if (!(brewingStand instanceof BrewingStand)) { return; @@ -153,9 +153,15 @@ public final class AlchemyPotionBrewer { // Retrieve the inventory of the brewing stand and clone the current ingredient for safe manipulation final BrewerInventory inventory = ((BrewingStand) brewingStand).getInventory(); final ItemStack ingredient = inventory.getIngredient() == null ? null : inventory.getIngredient().clone(); + Player player = mmoPlayer != null ? mmoPlayer.getPlayer() : null; + + if (ingredient == null) { + return; + } // Check if the brewing stand has a valid ingredient; if not, exit the method - if (!hasIngredient(inventory, player)) { + if (player == null + || !hasIngredient(inventory, player)) { // debug return; }