refactor: Remove emoji system and chat filters, implement SOLID architecture
This commit is contained in:
parent
16a5e09118
commit
74482851aa
72 changed files with 2654 additions and 1287 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package com.loki.lochat.commands;
|
||||
|
||||
import com.loki.lochat.LoChat;
|
||||
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.utils.ChatFormatter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
|
|
@ -10,14 +13,25 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Команда для ответа на последнее личное сообщение
|
||||
* /reply <сообщение>
|
||||
*/
|
||||
public class ReplyCommand implements CommandExecutor {
|
||||
|
||||
private final LoChat plugin;
|
||||
private final PMService pmService;
|
||||
private final IgnoreService ignoreService;
|
||||
private final SpyService spyService;
|
||||
|
||||
public ReplyCommand(LoChat plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pmService = plugin.getServiceRegistry().get(PMService.class);
|
||||
this.ignoreService = plugin.getServiceRegistry().get(IgnoreService.class);
|
||||
this.spyService = plugin.getServiceRegistry().get(SpyService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -36,12 +50,13 @@ public class ReplyCommand implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
UUID lastUuid = plugin.getPmManager().getLastConversation(player.getUniqueId());
|
||||
if (lastUuid == null) {
|
||||
Optional<UUID> lastUuidOpt = pmService.getLastConversation(player.getUniqueId());
|
||||
if (lastUuidOpt.isEmpty()) {
|
||||
player.sendMessage(ChatFormatter.parse(plugin.getMessageConfig().get("pm.no-reply")));
|
||||
return true;
|
||||
}
|
||||
|
||||
UUID lastUuid = lastUuidOpt.get();
|
||||
Player target = Bukkit.getPlayer(lastUuid);
|
||||
if (target == null) {
|
||||
player.sendMessage(ChatFormatter.parse(plugin.getMessageConfig().get("pm.player-offline")));
|
||||
|
|
@ -49,7 +64,7 @@ public class ReplyCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
// Проверка игнора
|
||||
if (plugin.getIgnoreManager().isIgnoring(target.getUniqueId(), player.getUniqueId())) {
|
||||
if (ignoreService.isIgnoring(target.getUniqueId(), player.getUniqueId())) {
|
||||
player.sendMessage(ChatFormatter.parse(plugin.getMessageConfig().get("pm.ignored")));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -80,10 +95,10 @@ public class ReplyCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
// Шпион
|
||||
plugin.getSpyManager().broadcastPM(player, target, message);
|
||||
spyService.broadcastPM(player, target, message);
|
||||
|
||||
// Обновляем последнего собеседника
|
||||
plugin.getPmManager().setLastConversation(target.getUniqueId(), player.getUniqueId());
|
||||
pmService.setLastConversation(target.getUniqueId(), player.getUniqueId());
|
||||
|
||||
// Логирование
|
||||
if (plugin.getConfigManager().isPmLogEnabled()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue