.map(row -> { ProjectsWithCostsGreaterThanOutput output = new ProjectsWithCostsGreaterThanOutput(); output.setProjectName(row.getString("project_name")); output.setTotalCost(row.getBigDecimal("total_cost")); output.setCompanyName(row.getString("company_name")); output.setCompanyCost(row.getBigDecimal("company_cost")); return output;
@Override public synchronized List<AccountChest> getChests(GringottsAccount account) { // TODO ensure world interaction is done in sync task SqlQuery getChests = db.createSqlQuery("SELECT ac.world, ac.x, ac.y, ac.z " + "FROM gringotts_accountchest ac JOIN gringotts_account a ON ac.account = a.id " + "WHERE a.owner = :owner and a.type = :type"); getChests.setParameter("owner", account.owner.getId()); getChests.setParameter("type", account.owner.getType()); List<AccountChest> chests = new LinkedList<>(); for (SqlRow result : getChests.findSet()) { String worldName = result.getString("world"); int x = result.getInteger("x"); int y = result.getInteger("y"); int z = result.getInteger("z"); World world = Bukkit.getWorld(worldName); if (world == null) { continue; // skip chest if it is in non-existent world } Location loc = new Location(world, x, y, z); Block signBlock = loc.getBlock(); if (Util.isSignBlock(signBlock)) { Sign sign = (Sign) loc.getBlock().getState(); chests.add(new AccountChest(sign, account)); } else { // remove accountchest from storage if it is not a valid chest deleteAccountChest(worldName, x, y, z); } } return chests; }