refactor: Remove emoji system and chat filters, implement SOLID architecture

This commit is contained in:
loki5512344 2026-02-23 12:10:51 +01:00
parent 16a5e09118
commit 74482851aa
72 changed files with 2654 additions and 1287 deletions

View file

@ -1,6 +1,7 @@
package com.loki.lochat.integrations;
import com.loki.lochat.LoChat;
import com.loki.lochat.api.service.*;
import com.loki.lochat.gradient.GradientModule;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
@ -9,14 +10,23 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.UUID;
public class PlaceholderAPIHook extends PlaceholderExpansion {
private final LoChat plugin;
private final IgnoreService ignoreService;
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.chatService = plugin.getServiceRegistry().get(ChatService.class);
this.pmService = plugin.getServiceRegistry().get(PMService.class);
this.spyService = plugin.getServiceRegistry().get(SpyService.class);
}
@Override
@ -47,15 +57,15 @@ public class PlaceholderAPIHook extends PlaceholderExpansion {
GradientModule gradient = plugin.getGradientModule();
return switch (params.toLowerCase()) {
case "ignored_count" -> String.valueOf(plugin.getIgnoreManager().getIgnoredCount(uuid));
case "global_enabled" -> String.valueOf(!plugin.getChatManager().isGlobalChatDisabled(uuid));
case "ignored_count" -> String.valueOf(ignoreService.getIgnoredCount(uuid));
case "global_enabled" -> String.valueOf(!chatService.isGlobalChatDisabled(uuid));
case "last_pm" -> {
UUID last = plugin.getPmManager().getLastConversation(uuid);
if (last == null) yield "";
var lastPlayer = Bukkit.getOfflinePlayer(last);
Optional<UUID> lastOpt = pmService.getLastConversation(uuid);
if (lastOpt.isEmpty()) yield "";
var lastPlayer = Bukkit.getOfflinePlayer(lastOpt.get());
yield lastPlayer.getName() != null ? lastPlayer.getName() : "";
}
case "spy_enabled" -> String.valueOf(plugin.getSpyManager().isSpying(uuid));
case "spy_enabled" -> String.valueOf(spyService.isSpying(uuid));
// Gradient placeholders (совместимость с LoPreff)
// Используем TAB формат §x§R§R§G§G§B§B для совместимости с TAB плагином