コード例 #1
0
  @Override
  public void loadPlayerPunishments(final Player player) {
    DB.select(
        SELECT_QUERY,
        new ParamReadStH() {
          @Override
          public void setParams(PreparedStatement ps) throws SQLException {
            ps.setInt(1, player.getObjectId());
          }

          @Override
          public void handleRead(ResultSet rs) throws SQLException {
            while (rs.next()) {
              player.setPrisonTimer(rs.getLong("punishment_timer"));

              if (player.isInPrison()) player.setPrisonTimer(rs.getLong("punishment_timer"));
              else player.setPrisonTimer(0);
            }
          }
        });
  }
コード例 #2
0
  @Override
  public TitleList loadTitleList(final int playerId) {
    final TitleList tl = new TitleList();

    DB.select(
        LOAD_QUERY,
        new ParamReadStH() {

          @Override
          public void setParams(PreparedStatement stmt) throws SQLException {
            stmt.setInt(1, playerId);
          }

          @Override
          public void handleRead(ResultSet rset) throws SQLException {
            while (rset.next()) {
              int id = rset.getInt("title_id");
              int remaining = rset.getInt("remaining");
              tl.addEntry(id, remaining);
            }
          }
        });
    return tl;
  }