refactor: restructure services and filters architecture

- Remove deprecated service interfaces (CooldownService, IgnoreService, PMService, PlayerDataService, SpyService)
- Add new unified service interfaces (MessagingService, PlayerService, PunishmentService)
- Extract FilterResult as standalone class from AdvancedMessageFilter
- Implement individual filter classes (CharacterFilter, FloodFilter, SpamFilter, SwearFilter, UrlFilter)
- Add moderation commands (BanCommand, WarnCommand, SilentWarnCommand, UnbanCommand)
- Introduce data models for punishment tracking (BanRecord, WarnEntry)
- Refactor messaging service with new MessagingServiceImpl implementation
- Add mute service utilities (MuteDataStorage, MutePermissionChecker)
- Implement PunishmentServiceImpl with snapshot tracking
- Add Discord integration components (DiscordConfig, DiscordMessageService)
- Introduce command handlers for gradient module (ColorCommandHandler, PrefixCommandHandler)
- Add renderer components (EmojiComponent, GradientBuilder, UrlProcessor)
- Add utility classes (ColorConverter, MessageSender, PlaceholderProcessor)
- Update configuration files and plugin metadata
- Add documentation files (CODE_REVIEW_RU.md, REFACTORING_SERVICES.md)
- Consolidate service architecture for improved maintainability and separation of concerns
This commit is contained in:
loki5512344 2026-04-06 00:18:25 +02:00
parent 2d79d2a91d
commit bba480002f
181 changed files with 3455 additions and 2908 deletions

View file

@ -2,9 +2,7 @@ package com.loki.lochat.integrations;
import com.loki.lochat.LoChat;
import com.loki.lochat.api.service.ChatService;
import com.loki.lochat.api.service.IgnoreService;
import com.loki.lochat.api.service.PMService;
import com.loki.lochat.api.service.SpyService;
import com.loki.lochat.api.service.MessagingService;
import com.loki.lochat.gradient.GradientModule;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
@ -19,17 +17,13 @@ import java.util.UUID;
public class PlaceholderAPIHook extends PlaceholderExpansion {
private final LoChat plugin;
private final IgnoreService ignoreService;
private final MessagingService messagingService;
private final ChatService chatService;
private final PMService pmService;
private final SpyService spyService;
public PlaceholderAPIHook(LoChat plugin) {
this.plugin = plugin;
this.ignoreService = plugin.getServiceRegistry().get(IgnoreService.class);
this.messagingService = plugin.getServiceRegistry().get(MessagingService.class);
this.chatService = plugin.getServiceRegistry().get(ChatService.class);
this.pmService = plugin.getServiceRegistry().get(PMService.class);
this.spyService = plugin.getServiceRegistry().get(SpyService.class);
}
@Override
@ -60,15 +54,15 @@ public class PlaceholderAPIHook extends PlaceholderExpansion {
GradientModule gradient = plugin.getGradientModule();
return switch (params.toLowerCase()) {
case "ignored_count" -> String.valueOf(ignoreService.getIgnoredCount(uuid));
case "ignored_count" -> String.valueOf(messagingService.getIgnoredCount(uuid));
case "global_enabled" -> String.valueOf(!chatService.isGlobalChatDisabled(uuid));
case "last_pm" -> {
Optional<UUID> lastOpt = pmService.getLastConversation(uuid);
Optional<UUID> lastOpt = messagingService.getLastConversation(uuid);
if (lastOpt.isEmpty()) yield "";
var lastPlayer = Bukkit.getOfflinePlayer(lastOpt.get());
yield lastPlayer.getName() != null ? lastPlayer.getName() : "";
}
case "spy_enabled" -> String.valueOf(spyService.isSpying(uuid));
case "spy_enabled" -> String.valueOf(messagingService.isSpying(uuid));
// Gradient placeholders (совместимость с LoPreff)
// Используем TAB формат §x§R§R§G§G§B§B для совместимости с TAB плагином