コード例 #1
0
 public void createUndoLog(String pbfId, String message, Item item) {
   Preconditions.checkNotNull(message);
   GameLog log = new GameLog();
   log.setPublicLog("System: " + message + ". Item number #" + item.getItemNumber());
   log.setPrivateLog("System: " + message + ". Item number #" + item.getItemNumber());
   log.setUsername("System");
   log.setPbfId(pbfId);
   save(log);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
  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));
  }
コード例 #4
0
 public GameLog createGameLog(Item item, String pbfId, GameLog.LogType logType) {
   return createGameLog(item, pbfId, logType, item.getOwnerId());
 }