use of com.djrapitops.plan.gathering.domain.PlayerKills in project Plan by plan-player-analytics.
the class KillsTable method addSessionKillsToBatch.
public static void addSessionKillsToBatch(PreparedStatement statement, FinishedSession session) throws SQLException {
UUID playerUUID = session.getPlayerUUID();
ServerUUID serverUUID = session.getServerUUID();
Optional<PlayerKills> playerKills = session.getExtraData().get(PlayerKills.class);
if (!playerKills.isPresent())
return;
for (PlayerKill kill : playerKills.get().asList()) {
// Session ID select statement parameters
statement.setString(1, playerUUID.toString());
statement.setString(2, serverUUID.toString());
statement.setLong(3, session.getStart());
statement.setLong(4, session.getEnd());
// Kill data
statement.setString(5, playerUUID.toString());
statement.setString(6, kill.getVictim().getUuid().toString());
statement.setString(7, serverUUID.toString());
statement.setLong(8, kill.getDate());
statement.setString(9, StringUtils.truncate(kill.getWeapon(), WEAPON_COLUMN_LENGTH));
statement.addBatch();
}
}
Aggregations