Program: 10528
Project: 10528
Buggy source:
private void look(LivingEntity theEntity,DenizenNPC theDenizen,Direction lookDir,Integer duration,Location lookLoc){
  Location restoreLocation=theDenizen.getEntity().getLocation();
  DenizenNPC restoreDenizen=theDenizen;
  Boolean restoreLookClose=theDenizen.isLookingClose();
  String lookWhere="String_Node_Str";
  if (lookDir != null)   lookWhere=lookDir.name();
  if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(true);
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() - (float)80;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() + (float)80;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=theDenizen.getHandle().pitch - (float)60;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=theDenizen.getHandle().pitch + (float)40;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() - 180;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=0;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=90;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=180;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=270;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    faceEntity(theDenizen.getEntity(),theEntity);
  }
 else   if (lookLoc != null) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=lookLoc.getPitch();
    theDenizen.getHandle().yaw=lookLoc.getYaw();
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
  if (duration != null) {
    plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new LookCommandRunnable<DenizenNPC,Location,Boolean,Float>(restoreDenizen,restoreLocation,restoreLookClose,theDenizen.getLocation().getYaw()){
      @Override public void run(      DenizenNPC denizen,      Location location,      Boolean lookClose,      Float checkYaw){
        if (denizen.getLocation().getYaw() == checkYaw) {
          denizen.getHandle().yaw=location.getYaw();
          denizen.getHandle().pitch=location.getPitch();
          denizen.getHandle().as=denizen.getHandle().yaw;
          denizen.lookClose(lookClose);
        }
      }
    }
,duration * 20);
  }
}

Fixed version (ground truth):
private void look(LivingEntity theEntity,DenizenNPC theDenizen,Direction lookDir,Integer duration,Location lookLoc){
  Location restoreLocation=theDenizen.getEntity().getLocation();
  DenizenNPC restoreDenizen=theDenizen;
  Boolean restoreLookClose=theDenizen.isLookingClose();
  String lookWhere="String_Node_Str";
  if (lookDir != null)   lookWhere=lookDir.name();
  if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(true);
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() - (float)80;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() + (float)80;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=theDenizen.getHandle().pitch - (float)60;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=theDenizen.getHandle().pitch + (float)40;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=theDenizen.getLocation().getYaw() - 180;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=0;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=90;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=180;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().yaw=270;
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
 else   if (lookWhere.equals("String_Node_Str")) {
    theDenizen.lookClose(false);
    faceEntity(theDenizen.getEntity(),theEntity);
  }
 else   if (lookLoc != null) {
    theDenizen.lookClose(false);
    theDenizen.getHandle().pitch=lookLoc.getPitch();
    theDenizen.getHandle().yaw=lookLoc.getYaw();
    theDenizen.getHandle().as=theDenizen.getHandle().yaw;
  }
  if (duration != null) {
    plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new LookCommandRunnable<DenizenNPC,Location,Boolean,Float>(restoreDenizen,restoreLocation,restoreLookClose,theDenizen.getLocation().getYaw()){
      @Override public void run(      DenizenNPC denizen,      Location location,      Boolean lookClose,      Float checkYaw){
        denizen.lookClose(lookClose);
        denizen.getHandle().yaw=location.getYaw();
        denizen.getHandle().pitch=location.getPitch();
        denizen.getHandle().as=denizen.getHandle().yaw;
      }
    }
,duration * 20);
  }
}