From b5580ec70c24e384604dc4bbf16e36a1a69a088b Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sat, 4 Oct 2014 14:06:15 -0700 Subject: [PATCH] Fix NavigationStuckEvent set-null If you set the action in a NavigationStuckEvent, it throws an NPE rather than simply doing nothing. This patches that. It also throws the event even when the default stuck action is null. --- src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java index ed023047d..dd9e37542 100644 --- a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -225,12 +225,12 @@ public class CitizensNavigator implements Navigator, Runnable { stopNavigating(); return; } - if (reason == CancelReason.STUCK && localParams.stuckAction() != null) { + if (reason == CancelReason.STUCK) { StuckAction action = localParams.stuckAction(); NavigationStuckEvent event = new NavigationStuckEvent(this, action); Bukkit.getPluginManager().callEvent(event); action = event.getAction(); - boolean shouldContinue = action.run(npc, this); + boolean shouldContinue = action != null ? action.run(npc, this): false; if (shouldContinue) { stationaryTicks = 0; executing.clearCancelReason();