diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java index 5e1775fc8..0ca7d16eb 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java @@ -24,6 +24,7 @@ import com.djrapitops.plan.extension.implementation.providers.gathering.Provider import com.djrapitops.plan.system.DebugChannels; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.config.PlanConfig; import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.console.PluginLogger; @@ -48,6 +49,7 @@ public class ExtensionServiceImplementation implements ExtensionService { private final PlanConfig config; private final DBSystem dbSystem; private final ServerInfo serverInfo; + private final Processing processing; private final ExtensionRegister extensionRegister; private final PluginLogger logger; private final ErrorHandler errorHandler; @@ -59,6 +61,7 @@ public class ExtensionServiceImplementation implements ExtensionService { PlanConfig config, DBSystem dbSystem, ServerInfo serverInfo, + Processing processing, ExtensionRegister extensionRegister, PluginLogger logger, ErrorHandler errorHandler @@ -66,6 +69,7 @@ public class ExtensionServiceImplementation implements ExtensionService { this.config = config; this.dbSystem = dbSystem; this.serverInfo = serverInfo; + this.processing = processing; this.extensionRegister = extensionRegister; this.logger = logger; this.errorHandler = errorHandler; @@ -97,7 +101,7 @@ public class ExtensionServiceImplementation implements ExtensionService { updateServerValues(gatherer, CallEvents.SERVER_EXTENSION_REGISTER); logger.getDebugLogger().logOn(DebugChannels.DATA_EXTENSIONS, pluginName + " extension registered."); - return Optional.of(new CallerImplementation(gatherer, this)); + return Optional.of(new CallerImplementation(gatherer, this, processing)); } @Override diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/CallerImplementation.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/CallerImplementation.java index f817a5f4b..e3f526c99 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/CallerImplementation.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/CallerImplementation.java @@ -20,6 +20,7 @@ import com.djrapitops.plan.extension.CallEvents; import com.djrapitops.plan.extension.Caller; import com.djrapitops.plan.extension.ExtensionServiceImplementation; import com.djrapitops.plan.extension.implementation.providers.gathering.ProviderValueGatherer; +import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plugin.utilities.Verify; import java.util.UUID; @@ -33,21 +34,27 @@ public class CallerImplementation implements Caller { private final ProviderValueGatherer gatherer; private final ExtensionServiceImplementation extensionServiceImplementation; + private final Processing processing; - public CallerImplementation(ProviderValueGatherer gatherer, ExtensionServiceImplementation extensionServiceImplementation) { + public CallerImplementation( + ProviderValueGatherer gatherer, + ExtensionServiceImplementation extensionServiceImplementation, + Processing processing + ) { this.gatherer = gatherer; this.extensionServiceImplementation = extensionServiceImplementation; + this.processing = processing; } @Override public void updatePlayerData(UUID playerUUID, String playerName) throws IllegalArgumentException { Verify.nullCheck(playerUUID, () -> new IllegalArgumentException("'playerUUID' can not be null!")); Verify.nullCheck(playerName, () -> new IllegalArgumentException("'playerName' can not be null!")); - extensionServiceImplementation.updatePlayerValues(gatherer, playerUUID, playerName, CallEvents.MANUAL); + processing.submitNonCritical(() -> extensionServiceImplementation.updatePlayerValues(gatherer, playerUUID, playerName, CallEvents.MANUAL)); } @Override public void updateServerData() { - extensionServiceImplementation.updateServerValues(gatherer, CallEvents.MANUAL); + processing.submitNonCritical(() -> extensionServiceImplementation.updateServerValues(gatherer, CallEvents.MANUAL)); } } \ No newline at end of file