Search in sources :

Example 1 with HasExtensionDataForPluginQuery

use of com.djrapitops.plan.extension.implementation.storage.queries.HasExtensionDataForPluginQuery in project Plan by plan-player-analytics.

the class ExtensionDisableOnGameServerTask method checkAndDisableProxyExtension.

private void checkAndDisableProxyExtension(ServerUUID proxyUUID, String pluginName) {
    Database db = dbSystem.getDatabase();
    ExtensionSettings extensionSettings = config.getExtensionSettings();
    boolean isInstalledOnProxy = db.query(new HasExtensionDataForPluginQuery(pluginName, proxyUUID));
    if (isInstalledOnProxy && extensionSettings.isEnabled(pluginName)) {
        extensionSettings.setEnabled(pluginName, false);
        logger.info("Set " + pluginName + " Extension as disabled in config since it is already enabled on the proxy server. This is to avoid duplicate data.");
    }
}
Also used : Database(com.djrapitops.plan.storage.database.Database) HasExtensionDataForPluginQuery(com.djrapitops.plan.extension.implementation.storage.queries.HasExtensionDataForPluginQuery) ExtensionSettings(com.djrapitops.plan.settings.config.ExtensionSettings)

Aggregations

HasExtensionDataForPluginQuery (com.djrapitops.plan.extension.implementation.storage.queries.HasExtensionDataForPluginQuery)1 ExtensionSettings (com.djrapitops.plan.settings.config.ExtensionSettings)1 Database (com.djrapitops.plan.storage.database.Database)1