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:
parent
2d79d2a91d
commit
bba480002f
181 changed files with 3455 additions and 2908 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package com.loki.lochat.commands.rp;
|
||||
|
||||
import com.loki.lochat.LoChat;
|
||||
import com.loki.lochat.api.service.CooldownService;
|
||||
import com.loki.lochat.api.service.PlayerService;
|
||||
import com.loki.lochat.commands.base.PlayerCommand;
|
||||
import com.loki.lochat.utils.ChatFormatter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
|
@ -19,11 +19,11 @@ import java.util.Random;
|
|||
public class TryCommand extends PlayerCommand {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
private final CooldownService cooldownService;
|
||||
private final PlayerService playerService;
|
||||
|
||||
public TryCommand(LoChat plugin) {
|
||||
super(plugin);
|
||||
this.cooldownService = plugin.getServiceRegistry().get(CooldownService.class);
|
||||
this.playerService = plugin.getServiceRegistry().get(PlayerService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,8 +32,8 @@ public class TryCommand extends PlayerCommand {
|
|||
if (!requirePermission(player, "lochat.rp.try")) return true;
|
||||
|
||||
int cooldown = plugin.getConfigManager().getInt("rp.cooldowns.try", 0);
|
||||
if (cooldown > 0 && cooldownService.isOnCooldown(player.getUniqueId(), "rp_try", cooldown)) {
|
||||
int remaining = cooldownService.getRemainingCooldown(player.getUniqueId(), "rp_try", cooldown);
|
||||
if (cooldown > 0 && playerService.isOnCooldown(player.getUniqueId(), "rp_try", cooldown)) {
|
||||
int remaining = playerService.getRemainingCooldown(player.getUniqueId(), "rp_try", cooldown);
|
||||
String msg = plugin.getConfigManager().getMessagesConfig().getCooldownMessage().replace("{remaining}", String.valueOf(remaining));
|
||||
player.sendMessage(ChatFormatter.parse(msg));
|
||||
return true;
|
||||
|
|
@ -64,7 +64,7 @@ public class TryCommand extends PlayerCommand {
|
|||
int radius = plugin.getConfigManager().getInt("rp.radius", 100);
|
||||
RpUtil.sendToRadius(player, message, radius);
|
||||
|
||||
if (cooldown > 0) cooldownService.setCooldown(player.getUniqueId(), "rp_try");
|
||||
if (cooldown > 0) playerService.setCooldown(player.getUniqueId(), "rp_try");
|
||||
plugin.getLogger().info("[TRY] " + player.getName() + ": " + action + " -> " + (success ? "SUCCESS" : "FAIL"));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue