Search in sources :

Example 56 with ServerUUID

use of com.djrapitops.plan.identification.ServerUUID in project Plan by plan-player-analytics.

the class NetworkConfigStoreTask method updateDBConfigs.

private void updateDBConfigs() {
    File[] configFiles = networkSettingManager.getConfigFiles();
    for (File configFile : configFiles) {
        ServerUUID serverUUID = NetworkSettingManager.getServerUUIDFromFilename(configFile);
        networkSettingManager.updateConfigInDB(configFile, serverUUID);
    }
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) File(java.io.File)

Example 57 with ServerUUID

use of com.djrapitops.plan.identification.ServerUUID in project Plan by plan-player-analytics.

the class NetworkSettingManager method updateConfigFromDBIfUpdated.

private void updateConfigFromDBIfUpdated() {
    Database database = dbSystem.getDatabase();
    Set<ServerUUID> serverUUIDs = database.query(ServerQueries.fetchPlanServerInformation()).keySet();
    // Remove the proxy server from the list
    serverUUIDs.remove(serverInfo.getServerUUID());
    for (ServerUUID serverUUID : serverUUIDs) {
        updateConfigFromDBIfUpdated(database, serverUUID);
    }
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) Database(com.djrapitops.plan.storage.database.Database)

Example 58 with ServerUUID

use of com.djrapitops.plan.identification.ServerUUID in project Plan by plan-player-analytics.

the class NetworkSettingManager method addFileToWatchList.

private void addFileToWatchList(FileWatcher fileWatcher, File file) {
    try {
        ServerUUID serverUUID = getServerUUIDFromFilename(file);
        fileWatcher.addToWatchlist(new WatchedFile(file, () -> updateConfigInDB(file, serverUUID)));
    } catch (IndexOutOfBoundsException | IllegalArgumentException ignore) {
    /* Invalid file-name, ignored */
    }
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) WatchedFile(com.djrapitops.plan.settings.upkeep.WatchedFile)

Example 59 with ServerUUID

use of com.djrapitops.plan.identification.ServerUUID in project Plan by plan-player-analytics.

the class WorldObj method applyPatch.

@Override
protected void applyPatch() {
    Collection<ServerUUID> serverUUIDs = query(ServerQueries.fetchPlanServerInformation()).keySet();
    Map<ServerUUID, Collection<String>> worldsPerServer = new HashMap<>();
    for (ServerUUID serverUUID : serverUUIDs) {
        worldsPerServer.put(serverUUID, getWorldNamesOld(serverUUID));
    }
    execute(LargeStoreQueries.storeAllWorldNames(worldsPerServer));
    updateWorldTimesTableWorldIDs();
    executeSwallowingExceptions(DELETE_FROM + WorldTable.TABLE_NAME + WHERE + "server_id=0");
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID)

Example 60 with ServerUUID

use of com.djrapitops.plan.identification.ServerUUID 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

ServerUUID (com.djrapitops.plan.identification.ServerUUID)105 UUID (java.util.UUID)26 ResultSet (java.sql.ResultSet)23 PreparedStatement (java.sql.PreparedStatement)21 Database (com.djrapitops.plan.storage.database.Database)17 Test (org.junit.jupiter.api.Test)17 FinishedSession (com.djrapitops.plan.gathering.domain.FinishedSession)14 WorldTimes (com.djrapitops.plan.gathering.domain.WorldTimes)12 Nickname (com.djrapitops.plan.delivery.domain.Nickname)11 ActiveSession (com.djrapitops.plan.gathering.domain.ActiveSession)11 Server (com.djrapitops.plan.identification.Server)11 HashMap (java.util.HashMap)11 ExtensionSvc (com.djrapitops.plan.extension.ExtensionSvc)9 PlanConfig (com.djrapitops.plan.settings.config.PlanConfig)9 QueryStatement (com.djrapitops.plan.storage.database.queries.QueryStatement)9 WorldNameStoreTransaction (com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction)9 Lists (com.djrapitops.plan.utilities.java.Lists)9 CallEvents (com.djrapitops.plan.extension.CallEvents)8 List (java.util.List)8 Map (java.util.Map)8