import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;

import biz.plexers.sparrow.core.Pirate;
import biz.plexers.sparrow.core.Ship;
import biz.plexers.sparrow.core.UserManager;
import biz.plexers.sparrow.db.exceptions.SignInException;
import biz.plexers.sparrow.db.exceptions.SignUpException;
import biz.plexers.sparrow.sp.ShipMarket;

public class Game {
	private static Scanner s;

	public static void startGame() {
		s = new Scanner(System.in);
		System.out.print("1. Login 2. Sign-Up :");
		int choice = Integer.parseInt(s.next(Pattern.compile("\\A[12]\\Z")));

		switch (choice) {
		case 1:
			login();
			break;
		case 2:
			signUp();
			break;
		default:
			System.out.println("Wrong choice");
			break;
		}

	}

	public static void main(String[] args) {
		startGame();
	}

	private static void login() {
		System.out.print("Enter username:");
		String username = s.next();
		System.out.print("Enter password: ");
		String password = s.next();
		boolean signedIn = false;
		try {
			signedIn = UserManager.signIn(username, password);
		} catch (SignInException e) {
			System.out.println(e.getMessage());
		}
		if (signedIn) {
			System.out.println("User " + username + " successfully loged in");
			mainWindow();
		}
	}

	private static void signUp() {
		System.out.print("Enter username:");
		String username = s.next();
		System.out.print("Enter password: ");
		String password = s.next();
		System.out.print("Enter email: ");
		String email = s.next();
		boolean signedUp = false;
		try {
			signedUp = UserManager.signUp(username, password, email);
		} catch (SignUpException e) {
			System.out.println(e.getMessage());
		}
		if (signedUp) {
			System.out.println("User " + username + " created!");
			startGame();
		}

	}

	private static void mainWindow() {
		System.out.print("1. Single Player 2. Multiplayer :");
		int choice = Integer.parseInt(s.next());

		switch (choice) {
		case 1:
			singlePlayer();
			break;
		case 2:
			multiPlayer();
			break;
		default:
			System.out.println("Wrong choice");
			break;
		}
	}

	private static void singlePlayer() {
		Pirate pirate = UserManager.getPirate();
		
		if (UserManager.shipExists())
		{
			ShipMarket shipMarket = ShipMarket.getInstance();
			List<Ship> ships = shipMarket.getShips();
			for (int i = 0; i < ships.size(); i++) {
				Ship s = ships.get(i);
				System.out.println((i + 1) + ". " + s.getName());
			}

			int choice = Game.s.nextInt();
			try {
				pirate.buyShip(shipMarket, choice - 1);
			} catch (Exception e) {
				System.out.println(e.getMessage());
			}
			
			System.out.print("Give a name for your pirate: ");
			String name = s.next();
			pirate.setName(name);
			System.out.println("Successfully created your pirate !!!");
		}

	}

	private static void multiPlayer() {
		// TODO Auto-generated method stub

	}
}

@@ -2851,38 +2851,613 @@
 te !!!%22);%0D%0A%09%09%7D%0D%0A
+%09%09%0D%0A%09%09System.out.print(%221. Raid Island 2. Buy Ship  3. Buy Resources 4. Upgrade Ship :%22);%0D%0A%09%09int choice = Integer.parseInt(s.next());%0D%0A%0D%0A%09%09switch (choice) %7B%0D%0A%09%09case 1:%0D%0A%09%09%09raidIsland();%0D%0A%09%09%09break;%0D%0A%09%09case 2:%0D%0A%09%09%09buyShip();%0D%0A%09%09%09break;%0D%0A%09%09case 3:%0D%0A%09%09%09buyResources();%0D%0A%09%09%09break;%0D%0A%09%09case 4:%0D%0A%09%09%09upgradeShip();%0D%0A%09%09%09break;%0D%0A%09%09default:%0D%0A%09%09%09System.out.println(%22Wrong choice%22);%0D%0A%09%09%09break;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09%0D%0A%09private static void raidIsland()%7B%0D%0A%09%09%0D%0A%09%7D%0D%0A%0D%0A%09private static void buyShip()%7B%0D%0A%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%09private static void buyResources()%7B%0D%0A%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%09private static void upgradeShip()%7B%0D%0A%09%09%0D%0A%09%7D
 %0D%0A%09
-%7D%0D%0A
 %0D%0A%09private stati

Add singleplayer choices