/* * (non-Javadoc) * @see com.syncnapsis.data.service.PlayerManager#login(java.lang.String, java.lang.String) */ @Override public Player login(String username, String password) { User user = userManager.login(username, password); if (user == null) return null; Player player = getByUsername(username); if (player != null) { securityManager.getPlayerProvider().set(player); securityManager.getEmpireProvider().set(player.getCurrentEmpire()); return player; } else { userManager.logout(); return null; } }
/* * (non-Javadoc) * @see com.syncnapsis.data.service.PlayerManager#getCurrent() */ @Override public Player getCurrent() { return securityManager.getPlayerProvider().get(); }
/* * (non-Javadoc) * @see com.syncnapsis.data.service.PlayerManager#logout() */ @Override public boolean logout() { securityManager.getPlayerProvider().set(null); return userManager.logout(); }