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,7 @@
|
|||
package com.loki.lochat.commands;
|
||||
|
||||
import com.loki.lochat.LoChat;
|
||||
import com.loki.lochat.api.service.ChatService;
|
||||
import com.loki.lochat.utils.ChatFormatter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
|
@ -10,13 +11,20 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Команда для глобального чата
|
||||
* /g <сообщение> - отправить сообщение в глобальный чат
|
||||
* /globalchat toggle - переключить режим глобального чата
|
||||
*/
|
||||
public class GlobalChatCommand implements CommandExecutor {
|
||||
|
||||
private final LoChat plugin;
|
||||
private final ChatService chatService;
|
||||
private static final MiniMessage MM = MiniMessage.miniMessage();
|
||||
|
||||
public GlobalChatCommand(LoChat plugin) {
|
||||
this.plugin = plugin;
|
||||
this.chatService = plugin.getServiceRegistry().get(ChatService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -29,7 +37,7 @@ public class GlobalChatCommand implements CommandExecutor {
|
|||
// /globalchat toggle
|
||||
if (command.getName().equalsIgnoreCase("globalchat")) {
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("toggle")) {
|
||||
boolean enabled = plugin.getChatManager().toggleGlobalChat(player.getUniqueId());
|
||||
boolean enabled = chatService.toggleGlobalChat(player.getUniqueId());
|
||||
String msgKey = enabled ? "global.toggled-on" : "global.toggled-off";
|
||||
player.sendMessage(ChatFormatter.parse(plugin.getMessageConfig().get(msgKey)));
|
||||
} else {
|
||||
|
|
@ -46,10 +54,10 @@ public class GlobalChatCommand implements CommandExecutor {
|
|||
|
||||
String message = String.join(" ", args);
|
||||
|
||||
// Конвертируем String в Component для новой сигнатуры ChatManager
|
||||
// Конвертируем String в Component для новой сигнатуры ChatService
|
||||
Component messageComponent = MM.deserialize(message);
|
||||
|
||||
plugin.getChatManager().sendGlobalMessage(player, messageComponent);
|
||||
chatService.sendGlobalMessage(player, messageComponent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue