private GameLog createCommonGameLog(String pbfId, String playerId) { GameLog pl = new GameLog(); pl.setPbfId(pbfId); try { pl.setUsername(CivSingleton.instance().playerCache().get(playerId)); } catch (Exception e) { log.error("Couldn't retrieve username from cache"); pl.setUsername(getUsernameFromPlayerId(playerId)); } return pl; }
public GameLog createGameLog(String pbfId, GameLog.LogType logType, String playerId) { GameLog pl = new GameLog(); pl.setPbfId(pbfId); try { pl.setUsername(CivSingleton.instance().playerCache().get(playerId)); } catch (ExecutionException e) { log.error("Couldn't retrieve username from cache"); pl.setUsername(getUsernameFromPlayerId(playerId)); } pl.createAndSetLog(logType, 0); pl.setId(save(pl)); return pl; }
public GameLog createGameLog(Draw draw, GameLog.LogType logType) { GameLog pl = new GameLog(); pl.setDraw(draw); pl.setPbfId(draw.getPbfId()); try { pl.setUsername(CivSingleton.instance().playerCache().get(draw.getPlayerId())); } catch (ExecutionException e) { log.error("Couldn't retrieve username from cache"); pl.setUsername(getUsernameFromPlayerId(draw.getPlayerId())); } pl.createAndSetLog(logType, draw.getItem() != null ? draw.getItem().getItemNumber() : 0); pl.setId(save(pl)); return pl; }
public GameLog createGameLog(Item item, String pbfId, GameLog.LogType logType, String playerId) { GameLog pl = new GameLog(); Draw<Item> draw = new Draw<>(pbfId, item.getOwnerId()); draw.setItem(item); pl.setDraw(draw); pl.setPbfId(pbfId); try { pl.setUsername(CivSingleton.instance().playerCache().get(playerId)); } catch (ExecutionException e) { log.error("Couldn't retrieve username from cache"); pl.setUsername(getUsernameFromPlayerId(playerId)); } pl.createAndSetLog(logType, item.getItemNumber()); pl.setId(save(pl)); return pl; }
public void createTradeGameLog( Item item, String pbfId, GameLog.LogType logType, String username) { GameLog gl = new GameLog(); Draw<Item> draw = new Draw<>(pbfId, item.getOwnerId()); draw.setItem(item); gl.setDraw(draw); gl.setPbfId(pbfId); try { gl.setUsername(CivSingleton.instance().playerCache().get(item.getOwnerId())); } catch (ExecutionException e) { log.error("Couldn't retrieve username from cache"); gl.setUsername(getUsernameFromPlayerId(item.getOwnerId())); } gl.createAndSetLog(logType, item.getItemNumber()); gl.setId(save(gl)); GameLog gl2 = new GameLog(); gl2.setPbfId(pbfId); gl2.setUsername(username); gl2.setPrivateLog(gl.getUsername() + " has received - " + draw.getItem().revealAll()); gl2.setPublicLog(""); gl2.setId(save(gl2)); }