Program: 171291
Project: 171291
Buggy source:
private void setUpButtons(){
  actionKeyPressed=new EventHandler<KeyEvent>(){
    private Map.Entry<KeyboardAction,KeyCodeWithModifiers> findExistingBinding(    Map<KeyboardAction,KeyCodeWithModifiers> bindings,    KeyEvent lookingFor){
      return bindings.entrySet().stream().filter(entry -> entry.getValue() != null).filter(entry -> entry.getValue().matches(lookingFor)).findFirst().orElse(null);
    }
    private void printAlreadyExistingBinding(    String primarySecondary,    String actionName,    String eventCodeName){
      Main.game.getTextStartStringBuilder().append("String_Node_Str" + "String_Node_Str" + Colour.GENERIC_BAD.toWebHexString() + "String_Node_Str"+ eventCodeName+ "String_Node_Str"+ primarySecondary+ "String_Node_Str"+ actionName+ "String_Node_Str"+ "String_Node_Str");
      Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
    }
    private boolean handleExistingBindings(    Map<KeyboardAction,KeyCodeWithModifiers> bindings,    KeyEvent lookingFor,    String primarySecondary){
      Map.Entry<KeyboardAction,KeyCodeWithModifiers> existingBinding=findExistingBinding(bindings,lookingFor);
      boolean hasExistingBinding=existingBinding != null;
      if (hasExistingBinding) {
        actionToBind=null;
        printAlreadyExistingBinding(primarySecondary,existingBinding.getKey().getName(),existingBinding.getValue().getFullName());
      }
      return hasExistingBinding;
    }
    public void handle(    KeyEvent event){
      if (allowInput) {
        if (Main.game.getCurrentDialogueNode() == OptionsDialogue.KEYBINDS) {
          if (actionToBind != null) {
            KeyCode eventCode=event.getCode();
            if (eventCode == KeyCode.SHIFT || eventCode == KeyCode.CONTROL) {
              return;
            }
            if (handleExistingBindings(Main.getProperties().hotkeyMapPrimary,event,"String_Node_Str") || handleExistingBindings(Main.getProperties().hotkeyMapSecondary,event,"String_Node_Str")) {
              return;
            }
            KeyCodeWithModifiers newBinding=new KeyCodeWithModifiers(eventCode,event.isControlDown(),event.isShiftDown());
            if (primaryBinding)             Main.getProperties().hotkeyMapPrimary.put(actionToBind,newBinding);
 else             Main.getProperties().hotkeyMapSecondary.put(actionToBind,newBinding);
            actionToBind=null;
            Main.saveProperties();
            Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
            return;
          }
        }
 else {
          actionToBind=null;
        }
        if (!buttonsPressed.contains(event.getCode())) {
          buttonsPressed.add(event.getCode());
          System.arraycopy(lastKeys,0,lastKeys,1,4);
          lastKeys[0]=event.getCode();
          checkLastKeys();
          if (event.getCode() == KeyCode.END) {
            for (int i=0; i <= 1000; i++) {
              System.out.println(Util.intToString(i));
            }
            System.out.println(Main.isVersionOlderThan("String_Node_Str",Main.VERSION_NUMBER));
          }
          if (keyEventMatchesBindings(KeyboardAction.MENU,event))           openOptions();
          if (keyEventMatchesBindings(KeyboardAction.MOVE_NORTH,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveNorth();
            }
 else {
              Main.game.responseNavigationUp();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_WEST,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveWest();
            }
 else {
              Main.game.responseNavigationLeft();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_SOUTH,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveSouth();
            }
 else {
              Main.game.responseNavigationDown();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_EAST,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveEast();
            }
 else {
              Main.game.responseNavigationRight();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_NORTH,event)) {
            Main.game.responseNavigationUp();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_WEST,event)) {
            Main.game.responseNavigationLeft();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_SOUTH,event)) {
            Main.game.responseNavigationDown();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_EAST,event)) {
            Main.game.responseNavigationRight();
          }
          if (keyEventMatchesBindings(KeyboardAction.QUICKSAVE,event)) {
            Main.quickSaveGame();
          }
          if (keyEventMatchesBindings(KeyboardAction.QUICKLOAD,event)) {
            Main.quickLoadGame();
          }
          boolean allowInput=true;
          boolean enterConsumed=false;
          if (Main.game.getCurrentDialogueNode() == CharacterCreation.CHOOSE_NAME || Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.ROOM_UPGRADES) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getPlayerCell().getPlace().setName(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent());
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == OptionsDialogue.SAVE_LOAD) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.mainController.getWebEngine().executeScript("String_Node_Str");
                Main.saveGame(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent(),false);
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_INSPECT || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_JOBS || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_PERMISSIONS) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setPlayerPetName(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent());
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
            if (((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setName(new NameTriplet(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent()));
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
          }
          if (((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))) {
            allowInput=false;
          }
          if (Main.game.getCurrentDialogueNode() == OptionsDialogue.OPTIONS_PRONOUNS) {
            for (            GenderPronoun gp : GenderPronoun.values()) {
              if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + gp + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + gp + "String_Node_Str")) {
                allowInput=false;
                if (event.getCode() == KeyCode.ENTER) {
                  enterConsumed=true;
                  Main.game.setContent(1);
                }
              }
            }
            for (            GenderNames genderName : GenderNames.values()) {
              if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str")) {
                allowInput=false;
                if (event.getCode() == KeyCode.ENTER) {
                  enterConsumed=true;
                  Main.game.setContent(1);
                }
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == DebugDialogue.PARSER) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))             allowInput=false;
          }
          if (allowInput) {
            if (keyEventMatchesBindings(KeyboardAction.INVENTORY,event))             openInventory();
            if (keyEventMatchesBindings(KeyboardAction.JOURNAL,event))             openPhone();
            if (keyEventMatchesBindings(KeyboardAction.CHARACTERS,event))             openCharactersPresent(null);
            if (keyEventMatchesBindings(KeyboardAction.ZOOM,event))             zoomMap();
            if (keyEventMatchesBindings(KeyboardAction.SCROLL_UP,event))             Main.mainController.getWebEngine().executeScript("String_Node_Str");
            if (keyEventMatchesBindings(KeyboardAction.SCROLL_DOWN,event))             Main.mainController.getWebEngine().executeScript("String_Node_Str");
            KeyboardAction[] keyboardActionsForResponses={KeyboardAction.RESPOND_0,KeyboardAction.RESPOND_1,KeyboardAction.RESPOND_2,KeyboardAction.RESPOND_3,KeyboardAction.RESPOND_4,KeyboardAction.RESPOND_5,KeyboardAction.RESPOND_6,KeyboardAction.RESPOND_7,KeyboardAction.RESPOND_8,KeyboardAction.RESPOND_9,KeyboardAction.RESPOND_10,KeyboardAction.RESPOND_11,KeyboardAction.RESPOND_12,KeyboardAction.RESPOND_13,KeyboardAction.RESPOND_14};
            for (int i=0; i < keyboardActionsForResponses.length; i++) {
              if (keyEventMatchesBindings(keyboardActionsForResponses[i],event)) {
                processResponse(i);
              }
            }
            if (keyEventMatchesBindings(KeyboardAction.MENU_SELECT,event)) {
              if (event.getCode() == KeyCode.ENTER) {
                if (!enterConsumed) {
                  Main.game.setContent(Main.game.getResponsePointer());
                }
              }
 else {
                Main.game.setContent(Main.game.getResponsePointer());
              }
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_TAB,event)) {
            if (Main.game.incrementResponseTab()) {
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_TAB,event)) {
            if (Main.game.decrementResponseTab()) {
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_PAGE,event)) {
            if (Main.game.isHasNextResponsePage()) {
              Main.game.setResponsePage(Main.game.getResponsePage() + 1);
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_PAGE,event)) {
            if (Main.game.getResponsePage() != 0) {
              Main.game.setResponsePage(Main.game.getResponsePage() - 1);
              Main.game.updateResponses();
            }
          }
        }
      }
    }
  }
;
  actionKeyReleased=new EventHandler<KeyEvent>(){
    public void handle(    KeyEvent event){
      if (buttonsPressed.contains(event.getCode())) {
        buttonsPressed.remove(event.getCode());
      }
    }
  }
;
  Main.primaryStage.addEventFilter(KeyEvent.KEY_PRESSED,actionKeyPressed);
  Main.primaryStage.addEventFilter(KeyEvent.KEY_RELEASED,actionKeyReleased);
}

Fixed version (ground truth):
private void setUpButtons(){
  actionKeyPressed=new EventHandler<KeyEvent>(){
    private Map.Entry<KeyboardAction,KeyCodeWithModifiers> findExistingBinding(    Map<KeyboardAction,KeyCodeWithModifiers> bindings,    KeyEvent lookingFor){
      return bindings.entrySet().stream().filter(entry -> entry.getValue() != null).filter(entry -> entry.getValue().matches(lookingFor)).findFirst().orElse(null);
    }
    private void printAlreadyExistingBinding(    String primarySecondary,    String actionName,    String eventCodeName){
      Main.game.getTextStartStringBuilder().append("String_Node_Str" + "String_Node_Str" + Colour.GENERIC_BAD.toWebHexString() + "String_Node_Str"+ eventCodeName+ "String_Node_Str"+ primarySecondary+ "String_Node_Str"+ actionName+ "String_Node_Str"+ "String_Node_Str");
      Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
    }
    private boolean handleExistingBindings(    Map<KeyboardAction,KeyCodeWithModifiers> bindings,    KeyEvent lookingFor,    String primarySecondary){
      Map.Entry<KeyboardAction,KeyCodeWithModifiers> existingBinding=findExistingBinding(bindings,lookingFor);
      boolean hasExistingBinding=existingBinding != null;
      if (hasExistingBinding) {
        actionToBind=null;
        printAlreadyExistingBinding(primarySecondary,existingBinding.getKey().getName(),existingBinding.getValue().getFullName());
      }
      return hasExistingBinding;
    }
    public void handle(    KeyEvent event){
      if (allowInput) {
        if (Main.game.getCurrentDialogueNode() == OptionsDialogue.KEYBINDS) {
          if (actionToBind != null) {
            KeyCode eventCode=event.getCode();
            if (eventCode == KeyCode.SHIFT || eventCode == KeyCode.CONTROL) {
              return;
            }
            if (handleExistingBindings(Main.getProperties().hotkeyMapPrimary,event,"String_Node_Str") || handleExistingBindings(Main.getProperties().hotkeyMapSecondary,event,"String_Node_Str")) {
              return;
            }
            KeyCodeWithModifiers newBinding=new KeyCodeWithModifiers(eventCode,event.isControlDown(),event.isShiftDown());
            if (primaryBinding)             Main.getProperties().hotkeyMapPrimary.put(actionToBind,newBinding);
 else             Main.getProperties().hotkeyMapSecondary.put(actionToBind,newBinding);
            actionToBind=null;
            Main.saveProperties();
            Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
            return;
          }
        }
 else {
          actionToBind=null;
        }
        if (!buttonsPressed.contains(event.getCode())) {
          buttonsPressed.add(event.getCode());
          System.arraycopy(lastKeys,0,lastKeys,1,4);
          lastKeys[0]=event.getCode();
          checkLastKeys();
          if (event.getCode() == KeyCode.END) {
            for (int i=0; i <= 1000; i++) {
              System.out.println(Util.intToString(i));
            }
            System.out.println(Main.isVersionOlderThan("String_Node_Str",Main.VERSION_NUMBER));
          }
          if (keyEventMatchesBindings(KeyboardAction.MENU,event))           openOptions();
          if (keyEventMatchesBindings(KeyboardAction.MOVE_NORTH,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveNorth();
            }
 else {
              Main.game.responseNavigationUp();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_WEST,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveWest();
            }
 else {
              Main.game.responseNavigationLeft();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_SOUTH,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveSouth();
            }
 else {
              Main.game.responseNavigationDown();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_EAST,event)) {
            if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
              moveEast();
            }
 else {
              Main.game.responseNavigationRight();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_NORTH,event)) {
            Main.game.responseNavigationUp();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_WEST,event)) {
            Main.game.responseNavigationLeft();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_SOUTH,event)) {
            Main.game.responseNavigationDown();
          }
          if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_EAST,event)) {
            Main.game.responseNavigationRight();
          }
          if (keyEventMatchesBindings(KeyboardAction.QUICKSAVE,event)) {
            Main.quickSaveGame();
          }
          if (keyEventMatchesBindings(KeyboardAction.QUICKLOAD,event)) {
            Main.quickLoadGame();
          }
          boolean allowInput=true;
          boolean enterConsumed=false;
          if (Main.game.getCurrentDialogueNode() == CharacterCreation.CHOOSE_NAME || Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.ROOM_UPGRADES) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getPlayerCell().getPlace().setName(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent());
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.game.setContent(1);
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == OptionsDialogue.SAVE_LOAD) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                Main.mainController.getWebEngine().executeScript("String_Node_Str");
                if (Main.isSaveGameAvailable()) {
                  Main.saveGame(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent(),false);
                }
                Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_INSPECT || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_JOBS || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_PERMISSIONS) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str")) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setPlayerPetName(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent());
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
            if (((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))) {
              allowInput=false;
              if (event.getCode() == KeyCode.ENTER) {
                enterConsumed=true;
                boolean unsuitableName=false;
                if (Main.mainController.getWebEngine().executeScript("String_Node_Str") != null) {
                  Main.mainController.getWebEngine().executeScript("String_Node_Str");
                  if (Main.mainController.getWebEngine().getDocument() != null) {
                    unsuitableName=Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent().length() > 32;
                  }
                  if (!unsuitableName) {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()){
                      @Override public void effects(){
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setName(new NameTriplet(Main.mainController.getWebEngine().getDocument().getElementById("String_Node_Str").getTextContent()));
                      }
                    }
);
                  }
 else {
                    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()));
                  }
                }
              }
            }
          }
          if (((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))) {
            allowInput=false;
          }
          if (Main.game.getCurrentDialogueNode() == OptionsDialogue.OPTIONS_PRONOUNS) {
            for (            GenderPronoun gp : GenderPronoun.values()) {
              if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + gp + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + gp + "String_Node_Str")) {
                allowInput=false;
                if (event.getCode() == KeyCode.ENTER) {
                  enterConsumed=true;
                  Main.game.setContent(1);
                }
              }
            }
            for (            GenderNames genderName : GenderNames.values()) {
              if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str") || (boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str" + genderName + "String_Node_Str")) {
                allowInput=false;
                if (event.getCode() == KeyCode.ENTER) {
                  enterConsumed=true;
                  Main.game.setContent(1);
                }
              }
            }
          }
          if (Main.game.getCurrentDialogueNode() == DebugDialogue.PARSER) {
            if ((boolean)Main.mainController.getWebEngine().executeScript("String_Node_Str"))             allowInput=false;
          }
          if (allowInput) {
            if (keyEventMatchesBindings(KeyboardAction.INVENTORY,event))             openInventory();
            if (keyEventMatchesBindings(KeyboardAction.JOURNAL,event))             openPhone();
            if (keyEventMatchesBindings(KeyboardAction.CHARACTERS,event))             openCharactersPresent(null);
            if (keyEventMatchesBindings(KeyboardAction.ZOOM,event))             zoomMap();
            if (keyEventMatchesBindings(KeyboardAction.SCROLL_UP,event))             Main.mainController.getWebEngine().executeScript("String_Node_Str");
            if (keyEventMatchesBindings(KeyboardAction.SCROLL_DOWN,event))             Main.mainController.getWebEngine().executeScript("String_Node_Str");
            KeyboardAction[] keyboardActionsForResponses={KeyboardAction.RESPOND_0,KeyboardAction.RESPOND_1,KeyboardAction.RESPOND_2,KeyboardAction.RESPOND_3,KeyboardAction.RESPOND_4,KeyboardAction.RESPOND_5,KeyboardAction.RESPOND_6,KeyboardAction.RESPOND_7,KeyboardAction.RESPOND_8,KeyboardAction.RESPOND_9,KeyboardAction.RESPOND_10,KeyboardAction.RESPOND_11,KeyboardAction.RESPOND_12,KeyboardAction.RESPOND_13,KeyboardAction.RESPOND_14};
            for (int i=0; i < keyboardActionsForResponses.length; i++) {
              if (keyEventMatchesBindings(keyboardActionsForResponses[i],event)) {
                processResponse(i);
              }
            }
            if (keyEventMatchesBindings(KeyboardAction.MENU_SELECT,event)) {
              if (event.getCode() == KeyCode.ENTER) {
                if (!enterConsumed) {
                  Main.game.setContent(Main.game.getResponsePointer());
                }
              }
 else {
                Main.game.setContent(Main.game.getResponsePointer());
              }
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_TAB,event)) {
            if (Main.game.incrementResponseTab()) {
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_TAB,event)) {
            if (Main.game.decrementResponseTab()) {
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_PAGE,event)) {
            if (Main.game.isHasNextResponsePage()) {
              Main.game.setResponsePage(Main.game.getResponsePage() + 1);
              Main.game.updateResponses();
            }
          }
          if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_PAGE,event)) {
            if (Main.game.getResponsePage() != 0) {
              Main.game.setResponsePage(Main.game.getResponsePage() - 1);
              Main.game.updateResponses();
            }
          }
        }
      }
    }
  }
;
  actionKeyReleased=new EventHandler<KeyEvent>(){
    public void handle(    KeyEvent event){
      if (buttonsPressed.contains(event.getCode())) {
        buttonsPressed.remove(event.getCode());
      }
    }
  }
;
  Main.primaryStage.addEventFilter(KeyEvent.KEY_PRESSED,actionKeyPressed);
  Main.primaryStage.addEventFilter(KeyEvent.KEY_RELEASED,actionKeyReleased);
}