Respect plugin setting of useNewPathfinder better

This commit is contained in:
fullwall 2013-07-07 13:39:32 +08:00
parent 3c08d3c5b6
commit af40da3c0e
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class CitizensNavigator implements Navigator, Runnable {
private final NavigatorParameters defaultParams = new NavigatorParameters().baseSpeed(UNINITIALISED_SPEED)
.range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat())
.stationaryTicks(Setting.DEFAULT_STATIONARY_TICKS.asInt()).stuckAction(TeleportStuckAction.INSTANCE)
.examiner(new MinecraftBlockExaminer());
.examiner(new MinecraftBlockExaminer()).useNewPathfinder(Setting.USE_NEW_PATHFINDER.asBoolean());
private PathStrategy executing;
private int lastX, lastY, lastZ;
private NavigatorParameters localParams = defaultParams;
@ -161,7 +161,7 @@ public class CitizensNavigator implements Navigator, Runnable {
}
localParams = defaultParams.clone();
PathStrategy newStrategy;
if (Setting.USE_NEW_PATHFINDER.asBoolean() || localParams.useNewPathfinder()) {
if (localParams.useNewPathfinder()) {
newStrategy = new AStarNavigationStrategy(npc, target, localParams);
} else {
newStrategy = new MCNavigationStrategy(npc, target, localParams);

View File

@ -40,8 +40,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
this.handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
this.target = ((CraftEntity) target).getHandle();
Navigation nav = NMS.getNavigation(this.handle);
this.targetNavigator = nav != null && !Setting.USE_NEW_PATHFINDER.asBoolean() && !params.useNewPathfinder() ? new NavigationFieldWrapper(
nav) : new AStarTargeter();
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(nav)
: new AStarTargeter();
this.aggro = aggro;
}