Search in sources :

Example 1 with WatchedFile

use of com.djrapitops.plan.settings.upkeep.WatchedFile in project Plan by plan-player-analytics.

the class ServerSettingsManager method prepareFileWatcher.

private FileWatcher prepareFileWatcher() {
    FileWatcher fileWatcher = new FileWatcher(files.getDataFolder(), errorLogger);
    File configFile = files.getConfigFile();
    fileWatcher.addToWatchlist(new WatchedFile(configFile, () -> updateConfigInDB(configFile)));
    return fileWatcher;
}
Also used : FileWatcher(com.djrapitops.plan.settings.upkeep.FileWatcher) WatchedFile(com.djrapitops.plan.settings.upkeep.WatchedFile) File(java.io.File) WatchedFile(com.djrapitops.plan.settings.upkeep.WatchedFile)

Example 2 with WatchedFile

use of com.djrapitops.plan.settings.upkeep.WatchedFile 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)

Aggregations

WatchedFile (com.djrapitops.plan.settings.upkeep.WatchedFile)2 ServerUUID (com.djrapitops.plan.identification.ServerUUID)1 FileWatcher (com.djrapitops.plan.settings.upkeep.FileWatcher)1 File (java.io.File)1