Search in sources :

Example 1 with PlayerKills

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();
    }
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) PlayerKill(com.djrapitops.plan.gathering.domain.PlayerKill) PlayerKills(com.djrapitops.plan.gathering.domain.PlayerKills) ServerUUID(com.djrapitops.plan.identification.ServerUUID) UUID(java.util.UUID)

Aggregations

PlayerKill (com.djrapitops.plan.gathering.domain.PlayerKill)1 PlayerKills (com.djrapitops.plan.gathering.domain.PlayerKills)1 ServerUUID (com.djrapitops.plan.identification.ServerUUID)1 UUID (java.util.UUID)1