Fix McMMOPlayerBrewEvent NPE in AlchemyBrewTask#finish

This commit is contained in:
Dieu 2024-09-13 13:43:31 +02:00
parent b87efb3f76
commit c525ac8a8f

View File

@ -152,11 +152,13 @@ public class AlchemyBrewTask extends CancellableRunnable {
private void finish() {
final McMMOPlayerBrewEvent event = new McMMOPlayerBrewEvent(mmoPlayer, brewingStand);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if(mmoPlayer != null) {
final McMMOPlayerBrewEvent event = new McMMOPlayerBrewEvent(mmoPlayer, brewingStand);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, false);
if (!event.isCancelled()) {
AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, false);
}
}
Alchemy.brewingStandMap.remove(brewingStand.getLocation());