refactor(core): обновить ServiceFactory и ServiceRegistry
Добавлен фабричный метод для MessagingService: - ServiceFactory.createMessagingService() - создание MessagingService - ServiceRegistry теперь использует фабрику для MessagingService Изменения: ~ core/factory/ServiceFactory.java + createMessagingService(plugin, messageConfig) ~ core/registry/ServiceRegistry.java - new MessagingServiceImpl(plugin, messageConfig) + ServiceFactory.createMessagingService(plugin, messageConfig) Результат: - Единообразное создание сервисов через фабрику - Упрощена инициализация в ServiceRegistry - Улучшена тестируемость
This commit is contained in:
parent
3e5dcbf3ac
commit
e7b10a7daa
2 changed files with 12 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue