package web.servlets;
import javax.servlet.http.HttpServletRequest;
import org.scotlandyard.engine.Game;
import org.scotlandyard.engine.json.JsonFactory;
import org.scotlandyard.impl.engine.GameEngine;
public class GetPlayerPosition extends AbstractServlet implements
IRequestProcessor {
@Override
public Object getOutput(HttpServletRequest request, GameEngine engine)
throws Exception {
final String playerEmail = engine.getUsers().get(getSessionId()).getEmail();
final String gameId=request.getParameter("gameId");
final Game game = engine.getLobby().getGame(gameId);
String position = game.getPlayerPosition(playerEmail);
return JsonFactory.toJson(position);
}
@Override
public void validateRequest(HttpServletRequest request, GameEngine engine)
throws Exception {
}
}