@Override
    public void actionPerformed(ActionEvent e) {

        if (e.getSource() == buttonPane.getPlayButton()) {
            
            errorPane.clearErrors();
            buttonPane.setPlayButtonStates();

            if (scriptEditor.isScriptEmpty() == false) {
                
                try {
                    playerInst.canPlayerMove(true);
                    
                    //Within this method, the whole process of creating UserClass.java is created.
                    
                    final LearningConfig config = LearningConfig.getInstance();

                    CreateUserFile writeToFile = new CreateUserFile();
                    writeToFile.createFile(config.getProperty("userCodeDirectory"), scriptEditor.getUserInput());

                    CompileUserCode compileUserClass = new CompileUserCode();

                    boolean hasClassCompiled = compileUserClass.compileClass(config.getProperty("userCodeDirectory"), "UserClass");

                    if (hasClassCompiled == true) {
                        ExecuteUserCode executeUserCode = new ExecuteUserCode();
                        executeUserCode.runMethod(config.getProperty("userCodeDirectory"), "UserClass");
                    } else {
                        String error = compileUserClass.getErrors();
                        errorPane.setErrorMessage(error);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }

            }
        }

        if (e.getSource() == buttonPane.getResetButton()) {
            buttonPane.enableAllButtons();
            gameWindow.resetLevel();
        }
    }