src/main/java/com/webcheckers/ui/PostGameRoute.java
@Override
    public Object handle(Request request, Response response){

        // The opponent that was clicked on
        Player opponent=lobby.getPlayer(request.queryParams("key"));

        // If the person you are trying to play with is not in game
        if(opponent.isAvailable()){

            // Adds the current player as the red side to the attributes
            request.session().attribute(GetGameRoute.RED_PLAYER,
                    (Player)request.session().attribute(GetHomeRoute.CURRENT_USER));
            sessions.get(opponent.getName()).attribute(GetGameRoute.RED_PLAYER,
                    (Player)request.session().attribute(GetHomeRoute.CURRENT_USER));

            // Adds the white side to the attributes
            request.session().attribute(GetGameRoute.WHITE_PLAYER, opponent);
            sessions.get(opponent.getName()).attribute(GetGameRoute.WHITE_PLAYER, opponent);

            // Change the states to IN_GAME
            opponent.startGame();
            ((Player)request.session().attribute(GetHomeRoute.CURRENT_USER)).startGame();

            // Redirects the player
            response.redirect(WebServer.GAME_URL);
        }

        // Redirects back to the home page with an error
        else{

            request.session().attribute(GetHomeRoute.ERROR, Message.error("That person is currently in game. Try another person."));
            response.redirect(WebServer.HOME_URL);
        }
        return null;
    }
/**
     * Handles a request for a Game being initiated
     * @param request the HTTP request
     * @param response the HTTP response
     * @return the rendered HTML code for the game page
     */
Handles a request for a Game being initiated
@param request the HTTP request
@param response the HTTP response
@return the rendered HTML code for the game page
Handles a request for a Game being initiated @param request the HTTP request @param response the HTTP response @return the rendered HTML code for the game page
@Override
    public Object handle(Request request, Response response){
        Player opponent=lobby.getPlayer(request.queryParams("key"));
        if(opponent.isAvailable()){
            request.session().attribute(GetGameRoute.RED_PLAYER,
                    (Player)request.session().attribute(GetHomeRoute.CURRENT_USER));
            sessions.get(opponent.getName()).attribute(GetGameRoute.RED_PLAYER,
                    (Player)request.session().attribute(GetHomeRoute.CURRENT_USER));
            request.session().attribute(GetGameRoute.WHITE_PLAYER, opponent);
            sessions.get(opponent.getName()).attribute(GetGameRoute.WHITE_PLAYER, opponent);
            opponent.startGame();
            ((Player)request.session().attribute(GetHomeRoute.CURRENT_USER)).startGame();
            response.redirect(WebServer.GAME_URL);
        }
        else{
            request.session().attribute(GetHomeRoute.ERROR, Message.error("That person is currently in game. Try another person."));
            response.redirect(WebServer.HOME_URL);
        }
        return null;
    }
@ Override public Object handle ( Request request , Response response ) { Player opponent = lobby . getPlayer ( request . queryParams ( "key" ) ) ; if ( opponent . isAvailable ( ) ) { request . session ( ) . attribute ( GetGameRoute . RED_PLAYER , ( Player ) request . session ( ) . attribute ( GetHomeRoute . CURRENT_USER ) ) ; sessions . get ( opponent . getName ( ) ) . attribute ( GetGameRoute . RED_PLAYER , ( Player ) request . session ( ) . attribute ( GetHomeRoute . CURRENT_USER ) ) ; request . session ( ) . attribute ( GetGameRoute . WHITE_PLAYER , opponent ) ; sessions . get ( opponent . getName ( ) ) . attribute ( GetGameRoute . WHITE_PLAYER , opponent ) ; opponent . startGame ( ) ; ( ( Player ) request . session ( ) . attribute ( GetHomeRoute . CURRENT_USER ) ) . startGame ( ) ; response . redirect ( WebServer . GAME_URL ) ; } else { request . session ( ) . attribute ( GetHomeRoute . ERROR , Message . error ( "That person is currently in game. Try another person." ) ) ; response . redirect ( WebServer . HOME_URL ) ; } return null ; }
Handles a request for a Game being initiated
 @param request the HTTP request
 @param response the HTTP response
 @return the rendered HTML code for the game page
Handles a request for a Game being initiated @param request the HTTP request @param response the HTTP response @return the rendered HTML code for the game page
// The opponent that was clicked on
 // If the person you are trying to play with is not in game
 // Adds the current player as the red side to the attributes
 // Adds the white side to the attributes
 // Change the states to IN_GAME
 // Redirects the player
 // Redirects back to the home page with an error
