diff --git a/src/main/java/com/loki/lochat/core/factory/ServiceFactory.java b/src/main/java/com/loki/lochat/core/factory/ServiceFactory.java index 1f406c9..08c1b6e 100644 --- a/src/main/java/com/loki/lochat/core/factory/ServiceFactory.java +++ b/src/main/java/com/loki/lochat/core/factory/ServiceFactory.java @@ -1,6 +1,9 @@ package com.loki.lochat.core.factory; +import com.loki.lochat.api.service.MessagingService; import com.loki.lochat.api.service.MuteService; +import com.loki.lochat.config.MessageConfig; +import com.loki.lochat.core.service.MessagingServiceImpl; import com.loki.lochat.core.service.MuteServiceImpl; import com.loki.lochat.core.service.mute.MuteDataStorage; import com.loki.lochat.core.service.mute.MuteHistoryManager; @@ -39,4 +42,11 @@ public class ServiceFactory { // Собираем сервис return new MuteServiceImpl(plugin, strategies, storage, historyManager); } + + /** + * Создать MessagingService со всеми зависимостями + */ + public static MessagingService createMessagingService(JavaPlugin plugin, MessageConfig messageConfig) { + return new MessagingServiceImpl(plugin, messageConfig); + } } diff --git a/src/main/java/com/loki/lochat/core/registry/ServiceRegistry.java b/src/main/java/com/loki/lochat/core/registry/ServiceRegistry.java index e1d5979..15c69f9 100644 --- a/src/main/java/com/loki/lochat/core/registry/ServiceRegistry.java +++ b/src/main/java/com/loki/lochat/core/registry/ServiceRegistry.java @@ -34,8 +34,8 @@ public class ServiceRegistry { register(MessageService.class, new MessageServiceImpl(plugin, this)); - // ✅ NEW: Объединённый MessagingService (PM + Spy + Ignore) - MessagingService messagingService = new MessagingServiceImpl(plugin, messageConfig); + // ✅ NEW: Объединённый MessagingService (PM + Spy + Ignore) через фабрику + MessagingService messagingService = ServiceFactory.createMessagingService(plugin, messageConfig); register(MessagingService.class, messagingService); register(MentionService.class, new MentionServiceImpl(configManager));